=================================================================== RCS file: /cvs/mandoc/mdoc_term.c,v retrieving revision 1.321 retrieving revision 1.327 diff -u -p -r1.321 -r1.327 --- mandoc/mdoc_term.c 2015/07/25 14:02:06 1.321 +++ mandoc/mdoc_term.c 2015/09/26 00:54:04 1.327 @@ -1,4 +1,4 @@ -/* $Id: mdoc_term.c,v 1.321 2015/07/25 14:02:06 schwarze Exp $ */ +/* $Id: mdoc_term.c,v 1.327 2015/09/26 00:54:04 schwarze Exp $ */ /* * Copyright (c) 2008, 2009, 2010, 2011 Kristaps Dzonsons * Copyright (c) 2010, 2012-2015 Ingo Schwarze @@ -95,6 +95,7 @@ static int termp_bx_pre(DECL_ARGS); static int termp_cd_pre(DECL_ARGS); static int termp_d1_pre(DECL_ARGS); static int termp_eo_pre(DECL_ARGS); +static int termp_er_pre(DECL_ARGS); static int termp_ex_pre(DECL_ARGS); static int termp_fa_pre(DECL_ARGS); static int termp_fd_pre(DECL_ARGS); @@ -145,8 +146,8 @@ static const struct termact termacts[MDOC_MAX] = { { termp_under_pre, NULL }, /* Ar */ { termp_cd_pre, NULL }, /* Cd */ { termp_bold_pre, NULL }, /* Cm */ - { NULL, NULL }, /* Dv */ - { NULL, NULL }, /* Er */ + { termp_li_pre, NULL }, /* Dv */ + { termp_er_pre, NULL }, /* Er */ { termp_tag_pre, NULL }, /* Ev */ { termp_ex_pre, NULL }, /* Ex */ { termp_fa_pre, NULL }, /* Fa */ @@ -251,6 +252,7 @@ static const struct termact termacts[MDOC_MAX] = { { termp_ll_pre, NULL }, /* ll */ }; +static int fn_prio; void terminal_mdoc(void *arg, const struct roff_man *mdoc) @@ -800,7 +802,7 @@ termp_it_pre(DECL_ARGS) if (n->type != ROFFT_HEAD) break; - p->flags |= TERMP_NOBREAK | TERMP_BRIND; + p->flags |= TERMP_NOBREAK | TERMP_BRTRSP | TERMP_BRIND; p->trailspace = 2; if (NULL == n->next || NULL == n->next->child) @@ -972,7 +974,7 @@ termp_it_post(DECL_ARGS) * has munged them in the meanwhile. */ - p->flags &= ~(TERMP_NOBREAK | TERMP_BRIND | + p->flags &= ~(TERMP_NOBREAK | TERMP_BRTRSP | TERMP_BRIND | TERMP_DANGLE | TERMP_HANG); p->trailspace = 0; } @@ -1364,7 +1366,7 @@ termp_sh_pre(DECL_ARGS) * when the previous section was empty. */ if (n->prev == NULL || - MDOC_Sh != n->prev->tok || + n->prev->tok != MDOC_Sh || (n->prev->body != NULL && n->prev->body->child != NULL)) term_vspace(p); @@ -1374,8 +1376,16 @@ termp_sh_pre(DECL_ARGS) break; case ROFFT_BODY: p->offset = term_len(p, p->defindent); - if (SEC_AUTHORS == n->sec) + switch (n->sec) { + case SEC_DESCRIPTION: + fn_prio = 0; + break; + case SEC_AUTHORS: p->flags &= ~(TERMP_SPLIT|TERMP_NOSPLIT); + break; + default: + break; + } break; default: break; @@ -1471,6 +1481,9 @@ termp_fn_pre(DECL_ARGS) term_word(p, n->string); term_fontpop(p); + if (n->sec == SEC_DESCRIPTION) + tag_put(n->string, ++fn_prio, p->line); + if (pretty) { term_flushln(p); p->flags &= ~(TERMP_NOBREAK | TERMP_BRIND | TERMP_HANG); @@ -1708,7 +1721,6 @@ termp_xx_pre(DECL_ARGS) break; default: abort(); - /* NOTREACHED */ } term_word(p, pp); @@ -1823,6 +1835,7 @@ termp_sp_pre(DECL_ARGS) break; default: len = 1; + fn_prio = 0; break; } @@ -1904,7 +1917,6 @@ termp_quote_pre(DECL_ARGS) break; default: abort(); - /* NOTREACHED */ } p->flags |= TERMP_NOSPACE; @@ -1975,7 +1987,6 @@ termp_quote_post(DECL_ARGS) break; default: abort(); - /* NOTREACHED */ } } @@ -2204,7 +2215,6 @@ termp_bk_pre(DECL_ARGS) break; default: abort(); - /* NOTREACHED */ } return(1); @@ -2258,6 +2268,18 @@ termp_under_pre(DECL_ARGS) } static int +termp_er_pre(DECL_ARGS) +{ + + if (n->sec == SEC_ERRORS && + (n->parent->tok == MDOC_It || + (n->parent->tok == MDOC_Bq && + n->parent->parent->parent->tok == MDOC_It))) + tag_put(n->child->string, 1, p->line); + return(1); +} + +static int termp_tag_pre(DECL_ARGS) { @@ -2267,8 +2289,7 @@ termp_tag_pre(DECL_ARGS) (n->parent->tok == MDOC_It || (n->parent->tok == MDOC_Xo && n->parent->parent->prev == NULL && - n->parent->parent->parent->tok == MDOC_It)) && - ! tag_get(n->child->string, 0, 1)) - tag_put(n->child->string, 0, 1, p->line); + n->parent->parent->parent->tok == MDOC_It))) + tag_put(n->child->string, 1, p->line); return(1); }