=================================================================== RCS file: /cvs/mandoc/mdoc_term.c,v retrieving revision 1.109 retrieving revision 1.113 diff -u -p -r1.109 -r1.113 --- mandoc/mdoc_term.c 2010/01/01 18:33:51 1.109 +++ mandoc/mdoc_term.c 2010/04/03 14:25:12 1.113 @@ -1,4 +1,4 @@ -/* $Id: mdoc_term.c,v 1.109 2010/01/01 18:33:51 kristaps Exp $ */ +/* $Id: mdoc_term.c,v 1.113 2010/04/03 14:25:12 kristaps Exp $ */ /* * Copyright (c) 2008, 2009 Kristaps Dzonsons * @@ -132,6 +132,7 @@ static int termp_sq_pre(DECL_ARGS); static int termp_ss_pre(DECL_ARGS); static int termp_under_pre(DECL_ARGS); static int termp_ud_pre(DECL_ARGS); +static int termp_vt_pre(DECL_ARGS); static int termp_xr_pre(DECL_ARGS); static int termp_xx_pre(DECL_ARGS); @@ -175,7 +176,7 @@ static const struct termact termacts[MDOC_MAX] = { { termp_rv_pre, NULL }, /* Rv */ { NULL, NULL }, /* St */ { termp_under_pre, NULL }, /* Va */ - { termp_under_pre, termp_vt_post }, /* Vt */ + { termp_vt_pre, termp_vt_post }, /* Vt */ { termp_xr_pre, NULL }, /* Xr */ { NULL, termp____post }, /* %A */ { termp_under_pre, termp____post }, /* %B */ @@ -202,7 +203,7 @@ static const struct termact termacts[MDOC_MAX] = { { NULL, NULL }, /* Dc */ { termp_dq_pre, termp_dq_post }, /* Do */ { termp_dq_pre, termp_dq_post }, /* Dq */ - { NULL, NULL }, /* Ec */ + { NULL, NULL }, /* Ec */ /* FIXME: no space */ { NULL, NULL }, /* Ef */ { termp_under_pre, NULL }, /* Em */ { NULL, NULL }, /* Eo */ @@ -269,6 +270,9 @@ terminal_mdoc(void *arg, const struct mdoc *mdoc) p = (struct termp *)arg; + p->overstep = 0; + p->maxrmargin = 78; + if (NULL == p->symtab) switch (p->enc) { case (TERMENC_ASCII): @@ -1273,7 +1277,10 @@ termp_xr_pre(DECL_ARGS) { const struct mdoc_node *nn; - assert(n->child && MDOC_TEXT == n->child->type); + if (NULL == n->child) + return(0); + + assert(MDOC_TEXT == n->child->type); nn = n->child; term_word(p, nn->string); @@ -1290,12 +1297,27 @@ termp_xr_pre(DECL_ARGS) } +static int +termp_vt_pre(DECL_ARGS) +{ + + if (MDOC_ELEM == n->type) + return(termp_under_pre(p, pair, m, n)); + else if (MDOC_HEAD == n->type) + return(0); + else if (MDOC_BLOCK == n->type) + return(1); + + return(termp_under_pre(p, pair, m, n)); +} + + /* ARGSUSED */ static void termp_vt_post(DECL_ARGS) { - if (n->sec != SEC_SYNOPSIS) + if (MDOC_BLOCK != n->type) return; if (n->next && MDOC_Vt == n->next->tok) term_newln(p);