=================================================================== RCS file: /cvs/mandoc/mdoc_html.c,v retrieving revision 1.76 retrieving revision 1.77 diff -u -p -r1.76 -r1.77 --- mandoc/mdoc_html.c 2010/06/04 22:26:13 1.76 +++ mandoc/mdoc_html.c 2010/06/06 10:50:56 1.77 @@ -1,4 +1,4 @@ -/* $Id: mdoc_html.c,v 1.76 2010/06/04 22:26:13 kristaps Exp $ */ +/* $Id: mdoc_html.c,v 1.77 2010/06/06 10:50:56 kristaps Exp $ */ /* * Copyright (c) 2008, 2009 Kristaps Dzonsons * @@ -1247,7 +1247,7 @@ mdoc_d1_pre(MDOC_ARGS) /* FIXME: D1 shouldn't be literal. */ - SCALE_VS_INIT(&su, INDENT - 1); + SCALE_VS_INIT(&su, INDENT - 2); bufcat_su(h, "margin-left", &su); PAIR_CLASS_INIT(&tag[0], "lit"); PAIR_STYLE_INIT(&tag[1], h); @@ -1563,8 +1563,8 @@ mdoc_ft_pre(MDOC_ARGS) { struct htmlpair tag; - if (SEC_SYNOPSIS == n->sec && MDOC_LINE & n->flags) - print_otag(h, TAG_DIV, 0, NULL); + if (SEC_SYNOPSIS == n->sec && n->prev) + print_otag(h, TAG_BR, 0, NULL); PAIR_CLASS_INIT(&tag, "ftype"); print_otag(h, TAG_SPAN, 1, &tag); @@ -1594,10 +1594,6 @@ mdoc_fn_pre(MDOC_ARGS) SCALE_VS_INIT(&su, 1); bufcat_su(h, "margin-top", &su); } - if (n->next) { - SCALE_VS_INIT(&su, 1); - bufcat_su(h, "margin-bottom", &su); - } PAIR_STYLE_INIT(&tag[0], h); print_otag(h, TAG_DIV, 1, tag); } @@ -1785,25 +1781,39 @@ mdoc_mt_pre(MDOC_ARGS) static int mdoc_fo_pre(MDOC_ARGS) { - struct htmlpair tag; - struct roffsu su; + struct htmlpair tag; + struct roffsu su; + struct tag *t; if (MDOC_BODY == n->type) { h->flags |= HTML_NOSPACE; print_text(h, "("); h->flags |= HTML_NOSPACE; return(1); - } else if (MDOC_BLOCK == n->type && n->next) { + } else if (MDOC_BLOCK == n->type) { + if (SEC_SYNOPSIS != n->sec) + return(1); + if (NULL == n->prev || MDOC_Ft == n->prev->tok) { + print_otag(h, TAG_DIV, 0, NULL); + return(1); + } 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); return(1); } + /* XXX: we drop non-initial arguments as per groff. */ + + assert(n->child); + assert(n->child->string); + PAIR_CLASS_INIT(&tag, "fname"); - print_otag(h, TAG_SPAN, 1, &tag); - return(1); + t = print_otag(h, TAG_SPAN, 1, &tag); + print_text(h, n->child->string); + print_tagq(h, t); + return(0); }