=================================================================== RCS file: /cvsrepo/anoncvs/cvs/src/usr.bin/mandoc/man_html.c,v retrieving revision 1.37 retrieving revision 1.38 diff -u -r1.37 -r1.38 --- src/usr.bin/mandoc/man_html.c 2011/04/21 22:59:54 1.37 +++ src/usr.bin/mandoc/man_html.c 2011/05/29 21:22:18 1.38 @@ -1,4 +1,4 @@ -/* $Id: man_html.c,v 1.37 2011/04/21 22:59:54 schwarze Exp $ */ +/* $Id: man_html.c,v 1.38 2011/05/29 21:22:18 schwarze Exp $ */ /* * Copyright (c) 2008, 2009, 2010, 2011 Kristaps Dzonsons * @@ -63,7 +63,7 @@ static int man_in_pre(MAN_ARGS); static int man_literal_pre(MAN_ARGS); static void man_root_post(MAN_ARGS); -static int man_root_pre(MAN_ARGS); +static void man_root_pre(MAN_ARGS); static int man_B_pre(MAN_ARGS); static int man_HP_pre(MAN_ARGS); static int man_I_pre(MAN_ARGS); @@ -153,9 +153,7 @@ { print_gen_head(h); - bufinit(h); - buffmt(h, "%s(%s)", m->title, m->msec); - + bufcat_fmt(h, "%s(%s)", m->title, m->msec); print_otag(h, TAG_TITLE, 0, NULL); print_text(h, h->buf); } @@ -181,13 +179,16 @@ child = 1; t = h->tags.head; - bufinit(h); - switch (n->type) { case (MAN_ROOT): - child = man_root_pre(m, n, mh, h); + man_root_pre(m, n, mh, h); break; case (MAN_TEXT): + /* + * If we have a blank line, output a vertical space. + * If we have a space as the first character, break + * before printing the line's data. + */ if ('\0' == *n->string) { print_otag(h, TAG_P, 0, NULL); return; @@ -196,6 +197,13 @@ print_text(h, n->string); + /* + * If we're in a literal context, make sure that words + * togehter on the same line stay together. This is a + * POST-printing call, so we check the NEXT word. Since + * -man doesn't have nested macros, we don't need to be + * more specific than this. + */ if (MANH_LITERAL & mh->fl && (NULL == n->next || n->next->line > n->line)) @@ -244,8 +252,6 @@ /* This will automatically close out any font scope. */ print_stagq(h, t); - bufinit(h); - switch (n->type) { case (MAN_ROOT): man_root_post(m, n, mh, h); @@ -274,7 +280,7 @@ /* ARGSUSED */ -static int +static void man_root_pre(MAN_ARGS) { struct htmlpair tag[3]; @@ -328,7 +334,6 @@ print_text(h, title); print_tagq(h, t); - return(1); } @@ -387,6 +392,7 @@ } else su.scale = 0; + bufinit(h); bufcat_su(h, "height", &su); PAIR_STYLE_INIT(&tag, h); print_otag(h, TAG_DIV, 1, &tag); @@ -555,6 +561,7 @@ if (MAN_BLOCK == n->type) { print_otag(h, TAG_P, 0, NULL); print_otag(h, TAG_TABLE, 0, NULL); + bufinit(h); bufcat_su(h, "width", &su); PAIR_STYLE_INIT(&tag, h); print_otag(h, TAG_COL, 1, &tag); @@ -590,6 +597,8 @@ struct roffsu su; const struct man_node *np; + bufinit(h); + np = MAN_BLOCK == n->type ? n->head->child : n->parent->head->child; @@ -690,6 +699,7 @@ if (n->head->child) a2width(n->head->child, &su); + bufinit(h); bufcat_su(h, "margin-left", &su); PAIR_STYLE_INIT(&tag, h); print_otag(h, TAG_DIV, 1, &tag);