=================================================================== RCS file: /cvs/mandoc/mdoc_term.c,v retrieving revision 1.203 retrieving revision 1.209 diff -u -p -r1.203 -r1.209 --- mandoc/mdoc_term.c 2010/12/25 13:50:37 1.203 +++ mandoc/mdoc_term.c 2011/01/12 10:43:22 1.209 @@ -1,4 +1,4 @@ -/* $Id: mdoc_term.c,v 1.203 2010/12/25 13:50:37 kristaps Exp $ */ +/* $Id: mdoc_term.c,v 1.209 2011/01/12 10:43:22 kristaps Exp $ */ /* * Copyright (c) 2008, 2009, 2010 Kristaps Dzonsons * Copyright (c) 2010 Ingo Schwarze @@ -312,12 +312,23 @@ print_mdoc_node(DECL_ARGS) memset(&npair, 0, sizeof(struct termpair)); npair.ppair = pair; + + switch (n->type) { + case (MDOC_TEXT): + if (' ' == *n->string && MDOC_LINE & n->flags) + term_newln(p); + term_word(p, n->string); + break; + case (MDOC_TBL): + term_tbl(p, n->span); + break; + default: + if (termacts[n->tok].pre && ENDBODY_NOT == n->end) + chld = (*termacts[n->tok].pre) + (p, &npair, m, n); + break; + } - if (MDOC_TEXT == n->type) - term_word(p, n->string); - else if (termacts[n->tok].pre && ENDBODY_NOT == n->end) - chld = (*termacts[n->tok].pre)(p, &npair, m, n); - /* * Keeps only work until the end of a line. If a keep was * invoked in a prior line, revert it to PREKEEP. @@ -353,8 +364,14 @@ print_mdoc_node(DECL_ARGS) term_fontpopq(p, font); - if (MDOC_TEXT != n->type && termacts[n->tok].post && - ! (MDOC_ENDED & n->flags)) { + switch (n->type) { + case (MDOC_TEXT): + break; + case (MDOC_TBL): + break; + default: + if ( ! termacts[n->tok].post || MDOC_ENDED & n->flags) + break; (void)(*termacts[n->tok].post)(p, &npair, m, n); /* @@ -372,6 +389,7 @@ print_mdoc_node(DECL_ARGS) */ if (ENDBODY_NOSPACE == n->end) p->flags |= TERMP_NOSPACE; + break; } if (MDOC_EOS & n->flags) @@ -1583,7 +1601,9 @@ termp_bd_pre(DECL_ARGS) return(1); tabwidth = p->tabwidth; - p->tabwidth = term_len(p, 8); + if (DISP_literal == n->norm->Bd.type) + p->tabwidth = term_len(p, 8); + rm = p->rmargin; rmax = p->maxrmargin; p->rmargin = p->maxrmargin = TERM_MAXMARGIN; @@ -1855,8 +1875,6 @@ termp_quote_pre(DECL_ARGS) case (MDOC_Bq): term_word(p, "["); break; - case (MDOC__T): - /* FALLTHROUGH */ case (MDOC_Do): /* FALLTHROUGH */ case (MDOC_Dq): @@ -1867,6 +1885,8 @@ termp_quote_pre(DECL_ARGS) case (MDOC_Pq): term_word(p, "("); break; + case (MDOC__T): + /* FALLTHROUGH */ case (MDOC_Qo): /* FALLTHROUGH */ case (MDOC_Qq): @@ -1919,8 +1939,6 @@ termp_quote_post(DECL_ARGS) case (MDOC_Bq): term_word(p, "]"); break; - case (MDOC__T): - /* FALLTHROUGH */ case (MDOC_Do): /* FALLTHROUGH */ case (MDOC_Dq): @@ -1931,6 +1949,8 @@ termp_quote_post(DECL_ARGS) case (MDOC_Pq): term_word(p, ")"); break; + case (MDOC__T): + /* FALLTHROUGH */ case (MDOC_Qo): /* FALLTHROUGH */ case (MDOC_Qq): @@ -2148,8 +2168,8 @@ termp__t_post(DECL_ARGS) * If we're in an `Rs' and there's a journal present, then quote * us instead of underlining us (for disambiguation). */ - if (n->parent && MDOC_Rs == n->parent->tok && - n->parent->norm->Rs.titlejournal) + if (n->parent && MDOC_Rs == n->parent->tok && + n->parent->norm->Rs.child_J) termp_quote_post(p, pair, m, n); termp____post(p, pair, m, n); @@ -2165,7 +2185,7 @@ termp__t_pre(DECL_ARGS) * us instead of underlining us (for disambiguation). */ if (n->parent && MDOC_Rs == n->parent->tok && - n->parent->norm->Rs.titlejournal) + n->parent->norm->Rs.child_J) return(termp_quote_pre(p, pair, m, n)); term_fontpush(p, TERMFONT_UNDER);