diff options
author | June McEnroe <june@causal.agency> | 2021-01-12 22:24:33 -0500 |
---|---|---|
committer | June McEnroe <june@causal.agency> | 2021-01-12 22:24:33 -0500 |
commit | a76cc474b8765c547ea033095b8d170cd0f60845 (patch) | |
tree | 2b1774328afaee992c92bc253726388776da0cb9 | |
parent | Move hilex out of hilex directory (diff) | |
download | src-a76cc474b8765c547ea033095b8d170cd0f60845.tar.gz src-a76cc474b8765c547ea033095b8d170cd0f60845.zip |
Don't output a pre in hilex by default
-rw-r--r-- | bin/hilex.c | 7 | ||||
-rw-r--r-- | 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("<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 . |