From a76cc474b8765c547ea033095b8d170cd0f60845 Mon Sep 17 00:00:00 2001 From: "C. McEnroe" Date: Tue, 12 Jan 2021 22:24:33 -0500 Subject: Don't output a pre in hilex by default --- bin/hilex.c | 7 ++++--- bin/man1/hilex.1 | 46 +++++++++++++++++++++------------------------- 2 files changed, 25 insertions(+), 28 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("
");
-	} else {
+	} else if (opts[Document] || opts[Pre]) {
 		printf("
");
 	}
 }
 
 static void htmlFooter(const char *opts[]) {
-	printf("
"); + if (opts[Document] || opts[Pre]) printf("
"); 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 -elements -within a -.Sy
-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 
-element for the external stylesheet
+use the external stylesheet
 .Ar url .
 If unset,
-output default styles in a
-.Sy