summary refs log tree commit diff
path: root/bin/hilex.c
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
commita76cc474b8765c547ea033095b8d170cd0f60845 (patch)
tree2b1774328afaee992c92bc253726388776da0cb9 /bin/hilex.c
parentMove hilex out of hilex directory (diff)
downloadsrc-a76cc474b8765c547ea033095b8d170cd0f60845.tar.gz
src-a76cc474b8765c547ea033095b8d170cd0f60845.zip
Don't output a pre in hilex by default
Diffstat (limited to '')
-rw-r--r--bin/hilex.c7
1 files changed, 4 insertions, 3 deletions
diff --git a/bin/hilex.c b/bin/hilex.c
index ccbfa8ad..afcc5000 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");
 }