=================================================================== RCS file: /cvs/mandoc/mdoc_term.c,v retrieving revision 1.320 retrieving revision 1.323 diff -u -p -r1.320 -r1.323 --- mandoc/mdoc_term.c 2015/07/17 22:38:29 1.320 +++ mandoc/mdoc_term.c 2015/07/25 14:23:08 1.323 @@ -1,4 +1,4 @@ -/* $Id: mdoc_term.c,v 1.320 2015/07/17 22:38:29 schwarze Exp $ */ +/* $Id: mdoc_term.c,v 1.323 2015/07/25 14:23:08 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); @@ -146,7 +147,7 @@ static const struct termact termacts[MDOC_MAX] = { { termp_cd_pre, NULL }, /* Cd */ { termp_bold_pre, NULL }, /* Cm */ { NULL, NULL }, /* Dv */ - { NULL, NULL }, /* Er */ + { 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) @@ -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,11 @@ termp_fn_pre(DECL_ARGS) term_word(p, n->string); term_fontpop(p); + if (n->sec == SEC_DESCRIPTION) { + if ( ! tag_get(n->string, 0, ++fn_prio)) + tag_put(n->string, 0, fn_prio, p->line); + } + if (pretty) { term_flushln(p); p->flags &= ~(TERMP_NOBREAK | TERMP_BRIND | TERMP_HANG); @@ -1823,6 +1838,7 @@ termp_sp_pre(DECL_ARGS) break; default: len = 1; + fn_prio = 0; break; } @@ -2258,6 +2274,19 @@ 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_get(n->child->string, 0, 1)) + tag_put(n->child->string, 0, 1, p->line); + return(1); +} + +static int termp_tag_pre(DECL_ARGS) { @@ -2268,7 +2297,7 @@ termp_tag_pre(DECL_ARGS) (n->parent->tok == MDOC_Xo && n->parent->parent->prev == NULL && n->parent->parent->parent->tok == MDOC_It)) && - ! tag_get(n->child->string, 0)) - tag_put(n->child->string, 0, p->line); + ! tag_get(n->child->string, 0, 1)) + tag_put(n->child->string, 0, 1, p->line); return(1); }