summaryrefslogtreecommitdiffstats
path: root/mdoc_html.c
diff options
context:
space:
mode:
authorKristaps Dzonsons <kristaps@bsd.lv>2010-01-01 13:17:58 +0000
committerKristaps Dzonsons <kristaps@bsd.lv>2010-01-01 13:17:58 +0000
commit47413dce678dda2ae975720bf472a4a00ecde62a (patch)
tree942ea6e02b6e8833cd85829bf173d661f83b7865 /mdoc_html.c
parentc5b2462b76dc92a73a1f5ae0226aea1b37d83f0e (diff)
downloadmandoc-47413dce678dda2ae975720bf472a4a00ecde62a.tar.gz
`Fl' has each argument be in a separate scope (thanks Ingo Schwarze).
Situation of `Fl [arg]* "" [arg]*' is fixed: empty arguments are ignored. Note that OpenBSD crashes when this happens. Situation of `Fl' is fixed wrt trailing whitespace.
Diffstat (limited to 'mdoc_html.c')
-rw-r--r--mdoc_html.c27
1 files changed, 24 insertions, 3 deletions
diff --git a/mdoc_html.c b/mdoc_html.c
index 66ce08c7..719d9df5 100644
--- a/mdoc_html.c
+++ b/mdoc_html.c
@@ -659,12 +659,33 @@ mdoc_fl_pre(MDOC_ARGS)
{
struct htmlpair tag;
+ /* `Cm' has no leading hyphen. */
+
+ if (MDOC_Cm == n->tok) {
+ PAIR_CLASS_INIT(&tag, "flag");
+ print_otag(h, TAG_SPAN, 1, &tag);
+ return(1);
+ }
+
+ /* A zero-length child shouldn't get a dash. */
+
+ if (n->child) {
+ assert(MDOC_TEXT == n->child->type);
+ assert(n->child->string);
+ if ('\0' == *n->child->string)
+ return(0);
+ }
+
PAIR_CLASS_INIT(&tag, "flag");
print_otag(h, TAG_SPAN, 1, &tag);
- if (MDOC_Fl == n->tok) {
- print_text(h, "\\-");
+
+ print_text(h, "\\-");
+
+ /* A blank `Fl' should incur a subsequent space. */
+
+ if (n->child)
h->flags |= HTML_NOSPACE;
- }
+
return(1);
}