=================================================================== RCS file: /cvs/mandoc/man_html.c,v retrieving revision 1.77 retrieving revision 1.81 diff -u -p -r1.77 -r1.81 --- mandoc/man_html.c 2011/07/07 13:26:25 1.77 +++ mandoc/man_html.c 2011/08/18 09:16:01 1.81 @@ -1,4 +1,4 @@ -/* $Id: man_html.c,v 1.77 2011/07/07 13:26:25 kristaps Exp $ */ +/* $Id: man_html.c,v 1.81 2011/08/18 09:16:01 kristaps Exp $ */ /* * Copyright (c) 2008, 2009, 2010, 2011 Kristaps Dzonsons * @@ -36,7 +36,6 @@ /* FIXME: have PD set the default vspace width. */ #define INDENT 5 -#define HALFINDENT 3 #define MAN_ARGS const struct man_meta *m, \ const struct man_node *n, \ @@ -201,7 +200,6 @@ print_man_node(MAN_ARGS) { int child; struct tag *t; - struct htmlpair tag; child = 1; t = h->tags.head; @@ -219,27 +217,17 @@ print_man_node(MAN_ARGS) if ('\0' == *n->string) { print_otag(h, TAG_P, 0, NULL); return; - } else if (' ' == *n->string && MAN_LINE & n->flags) + } + + if (' ' == *n->string && MAN_LINE & n->flags) print_otag(h, TAG_BR, 0, NULL); + else if (MANH_LITERAL & mh->fl && n->prev) + print_otag(h, TAG_BR, 0, NULL); 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)) - print_otag(h, TAG_BR, 0, NULL); return; case (MAN_EQN): - PAIR_CLASS_INIT(&tag, "eqn"); - print_otag(h, TAG_SPAN, 1, &tag); - print_text(h, n->eqn->data); + print_eqn(h, n->eqn); break; case (MAN_TBL): /* @@ -453,10 +441,15 @@ static int man_alt_pre(MAN_ARGS) { const struct man_node *nn; - int i; + int i, savelit; enum htmltag fp; struct tag *t; + if ((savelit = mh->fl & MANH_LITERAL)) + print_otag(h, TAG_BR, 0, NULL); + + mh->fl &= ~MANH_LITERAL; + for (i = 0, nn = n->child; nn; nn = nn->next, i++) { t = NULL; switch (n->tok) { @@ -495,6 +488,9 @@ man_alt_pre(MAN_ARGS) print_tagq(h, t); } + if (savelit) + mh->fl |= MANH_LITERAL; + return(0); } @@ -554,6 +550,8 @@ man_IP_pre(MAN_ARGS) return(1); } + /* FIXME: width specification. */ + print_otag(h, TAG_DT, 0, NULL); /* For IP, only print the first header element. */ @@ -623,11 +621,11 @@ static int man_literal_pre(MAN_ARGS) { - if (MAN_nf == n->tok) { + if (MAN_nf != n->tok) { print_otag(h, TAG_BR, 0, NULL); - mh->fl |= MANH_LITERAL; - } else mh->fl &= ~MANH_LITERAL; + } else + mh->fl |= MANH_LITERAL; return(0); }