summary refs log tree commit diff
path: root/bin
diff options
context:
space:
mode:
authorJune McEnroe <june@causal.agency>2021-01-12 22:24:33 -0500
committerJune McEnroe <june@causal.agency>2021-01-12 22:24:33 -0500
commite673ea6deaee59a72c8861a67b10489703f75c61 (patch)
tree680f1a9e5b026283ed0f9f4e6fd4f4cf726bb249 /bin
parentMove hilex out of hilex directory (diff)
downloadsrc-e673ea6deaee59a72c8861a67b10489703f75c61.tar.gz
src-e673ea6deaee59a72c8861a67b10489703f75c61.zip
Don't output a pre in hilex by default
Diffstat (limited to '')
-rw-r--r--bin/hilex.c7
-rw-r--r--bin/man1/hilex.146
2 files changed, 25 insertions, 28 deletions
diff --git a/bin/hilex.c b/bin/hilex.c
index d9b747cc..e91442f6 100644
--- a/bin/hilex.c
+++ b/bin/hilex.c
@@ -71,6 +71,7 @@ static const struct Lexer *matchLexer(const char *name) {
 	X(Document, "document") \
 	X(Inline, "inline") \
 	X(Monospace, "monospace") \
+	X(Pre, "pre") \
 	X(Style, "style") \
 	X(Tab, "tab") \
 	X(Title, "title")
@@ -207,17 +208,17 @@ static void htmlHeader(const char *opts[]) {
 	}
 
 body:
-	if (opts[Inline] && opts[Tab]) {
+	if ((opts[Document] || opts[Pre]) && opts[Inline] && opts[Tab]) {
 		printf("<pre class=\"hilex\" style=\"");
 		styleTabSize(opts[Tab]);
 		printf("\">");
-	} else {
+	} else if (opts[Document] || opts[Pre]) {
 		printf("<pre class=\"hilex\">");
 	}
 }
 
 static void htmlFooter(const char *opts[]) {
-	printf("</pre>");
+	if (opts[Document] || opts[Pre]) printf("</pre>");
 	if (opts[Document]) printf("\n");
 }
 
diff --git a/bin/man1/hilex.1 b/bin/man1/hilex.1
index 858c8565..aec57860 100644
--- a/bin/man1/hilex.1
+++ b/bin/man1/hilex.1
@@ -67,11 +67,8 @@ Output ANSI terminal control sequences.
 .
 .It Cm html
 Output HTML
-.Sy <span>
-elements
-within a
-.Sy <pre>
-element.
+.Sy span
+elements.
 Each element has the classes
 .Sy hilex
 and one of the following:
@@ -89,43 +86,42 @@ and one of the following:
 .Pp
 The options are as follows:
 .Bl -tag -width "title=..."
+.It Cm document
+Output an HTML document containing a
+.Sy pre
+element.
+.It Cm inline
+Output inline style attributes
+rather than classes.
+.It Cm pre
+Wrap the output in a
+.Sy pre
+element with the class
+.Sy hilex .
 .It Cm style Ns = Ns Ar url
 With
 .Cm document ,
-output a
-.Sy <link>
-element for the external stylesheet
+use the external stylesheet
 .Ar url .
 If unset,
-output default styles in a
-.Sy <style>
-element.
-.
-.It Cm document
-Output an HTML document containing the
-.Sy <pre>
-element.
-.
-.It Cm inline
-Output inline
+default styles are included in a
 .Sy style
-attributes rather than classes.
-.
+element.
 .It Cm tab Ns = Ns Ar n
 With
-.Cm document
+.Cm document ,
+.Cm inline
 or
-.Cm inline ,
+.Cm pre ,
 set the
 .Sy tab-size
 property to
 .Ar n .
-.
 .It Cm title Ns = Ns Ar ...
 With
 .Cm document ,
 set the
-.Sy <title>
+.Sy title
 element text.
 The default title is the same as
 .Ar name .