diff options
-rw-r--r-- | mdoc_html.c | 27 | ||||
-rw-r--r-- | mdoc_macro.c | 11 | ||||
-rw-r--r-- | mdoc_term.c | 17 |
3 files changed, 51 insertions, 4 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); } diff --git a/mdoc_macro.c b/mdoc_macro.c index 9ee6a0bd..ca4e554f 100644 --- a/mdoc_macro.c +++ b/mdoc_macro.c @@ -808,6 +808,17 @@ in_line(MACRO_PROT_ARGS) cnt++; if ( ! mdoc_word_alloc(m, line, la, p)) return(0); + + /* + * `Fl' macros have their scope re-opened with each new + * word so that the `-' can be added to each one without + * having to parse out spaces. + */ + if (0 == lastpunct && MDOC_Fl == tok) { + if ( ! rew_elem(m, tok)) + return(0); + lastpunct = 1; + } } if (0 == lastpunct && ! rew_elem(m, tok)) diff --git a/mdoc_term.c b/mdoc_term.c index de73b311..82d32adc 100644 --- a/mdoc_term.c +++ b/mdoc_term.c @@ -1019,8 +1019,23 @@ termp_fl_pre(DECL_ARGS) { term_fontpush(p, TERMFONT_BOLD); + + /* 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); + } + term_word(p, "\\-"); - p->flags |= TERMP_NOSPACE; + + /* A blank `Fl' should incur a subsequent space. */ + + if (n->child) + p->flags |= TERMP_NOSPACE; + return(1); } |