=================================================================== RCS file: /cvs/mandoc/mdoc_html.c,v retrieving revision 1.47 retrieving revision 1.50 diff -u -p -r1.47 -r1.50 --- mandoc/mdoc_html.c 2009/11/14 12:04:59 1.47 +++ mandoc/mdoc_html.c 2010/01/01 13:17:58 1.50 @@ -1,4 +1,4 @@ -/* $Id: mdoc_html.c,v 1.47 2009/11/14 12:04:59 kristaps Exp $ */ +/* $Id: mdoc_html.c,v 1.50 2010/01/01 13:17:58 kristaps Exp $ */ /* * Copyright (c) 2008, 2009 Kristaps Dzonsons * @@ -424,7 +424,7 @@ print_mdoc_node(MDOC_ARGS) break; case (MDOC_TEXT): print_text(h, n->string); - break; + return; default: if (mdocs[n->tok].pre) child = (*mdocs[n->tok].pre)(m, n, h); @@ -441,8 +441,6 @@ print_mdoc_node(MDOC_ARGS) case (MDOC_ROOT): mdoc_root_post(m, n, h); break; - case (MDOC_TEXT): - break; default: if (mdocs[n->tok].post) (*mdocs[n->tok].post)(m, n, h); @@ -661,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); } @@ -1575,9 +1594,9 @@ mdoc_vt_pre(MDOC_ARGS) struct roffsu su; if (SEC_SYNOPSIS == n->sec) { - if (n->next && MDOC_Vt != n->next->tok) { + if (n->prev && MDOC_Vt != n->prev->tok) { SCALE_VS_INIT(&su, 1); - bufcat_su(h, "margin-bottom", &su); + bufcat_su(h, "margin-top", &su); PAIR_STYLE_INIT(&tag, h); print_otag(h, TAG_DIV, 1, &tag); } else