=================================================================== RCS file: /cvsrepo/anoncvs/cvs/src/usr.bin/mandoc/man_html.c,v retrieving revision 1.37 retrieving revision 1.38 diff -c -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 **** ! /* $Id: man_html.c,v 1.37 2011/04/21 22:59:54 schwarze Exp $ */ /* * Copyright (c) 2008, 2009, 2010, 2011 Kristaps Dzonsons * --- 1,4 ---- ! /* $Id: man_html.c,v 1.38 2011/05/29 21:22:18 schwarze Exp $ */ /* * Copyright (c) 2008, 2009, 2010, 2011 Kristaps Dzonsons * *************** *** 63,69 **** 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 int man_B_pre(MAN_ARGS); static int man_HP_pre(MAN_ARGS); static int man_I_pre(MAN_ARGS); --- 63,69 ---- static int man_in_pre(MAN_ARGS); static int man_literal_pre(MAN_ARGS); static void man_root_post(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,161 **** { print_gen_head(h); ! bufinit(h); ! buffmt(h, "%s(%s)", m->title, m->msec); ! print_otag(h, TAG_TITLE, 0, NULL); print_text(h, h->buf); } --- 153,159 ---- { print_gen_head(h); ! bufcat_fmt(h, "%s(%s)", m->title, m->msec); print_otag(h, TAG_TITLE, 0, NULL); print_text(h, h->buf); } *************** *** 181,193 **** child = 1; t = h->tags.head; - bufinit(h); - switch (n->type) { case (MAN_ROOT): ! child = man_root_pre(m, n, mh, h); break; case (MAN_TEXT): if ('\0' == *n->string) { print_otag(h, TAG_P, 0, NULL); return; --- 179,194 ---- child = 1; t = h->tags.head; switch (n->type) { case (MAN_ROOT): ! 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,201 **** --- 197,209 ---- 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,251 **** /* 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); --- 252,257 ---- *************** *** 274,280 **** /* ARGSUSED */ ! static int man_root_pre(MAN_ARGS) { struct htmlpair tag[3]; --- 280,286 ---- /* ARGSUSED */ ! static void man_root_pre(MAN_ARGS) { struct htmlpair tag[3]; *************** *** 328,334 **** print_text(h, title); print_tagq(h, t); - return(1); } --- 334,339 ---- *************** *** 387,392 **** --- 392,398 ---- } else su.scale = 0; + bufinit(h); bufcat_su(h, "height", &su); PAIR_STYLE_INIT(&tag, h); print_otag(h, TAG_DIV, 1, &tag); *************** *** 555,560 **** --- 561,567 ---- 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,595 **** --- 597,604 ---- struct roffsu su; const struct man_node *np; + bufinit(h); + np = MAN_BLOCK == n->type ? n->head->child : n->parent->head->child; *************** *** 690,695 **** --- 699,705 ---- 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);