diff options
author | Kristaps Dzonsons <kristaps@bsd.lv> | 2010-12-25 13:50:37 +0000 |
---|---|---|
committer | Kristaps Dzonsons <kristaps@bsd.lv> | 2010-12-25 13:50:37 +0000 |
commit | 72dde2cbfd108b1a17101a36f17ed4abd72231db (patch) | |
tree | 5ab22c55d9287160446e75081ed4fe2b2a059238 /mdoc_term.c | |
parent | 66602c8db181a50641e1c399880c1cc036d8ecec (diff) | |
download | mandoc-72dde2cbfd108b1a17101a36f17ed4abd72231db.tar.gz |
Specifying both %T and %J in an `Rs' block causes the title to be quoted
instead of underlined. This only happens in -Tascii, as -T[x]html both
underlines and italicises.
Diffstat (limited to 'mdoc_term.c')
-rw-r--r-- | mdoc_term.c | 45 |
1 files changed, 42 insertions, 3 deletions
diff --git a/mdoc_term.c b/mdoc_term.c index 28cdfdbd..7a4a7fa5 100644 --- a/mdoc_term.c +++ b/mdoc_term.c @@ -68,6 +68,7 @@ static void synopsis_pre(struct termp *, const struct mdoc_node *); static void termp____post(DECL_ARGS); +static void termp__t_post(DECL_ARGS); static void termp_an_post(DECL_ARGS); static void termp_bd_post(DECL_ARGS); static void termp_bk_post(DECL_ARGS); @@ -85,6 +86,7 @@ static void termp_sh_post(DECL_ARGS); static void termp_ss_post(DECL_ARGS); static int termp__a_pre(DECL_ARGS); +static int termp__t_pre(DECL_ARGS); static int termp_an_pre(DECL_ARGS); static int termp_ap_pre(DECL_ARGS); static int termp_bd_pre(DECL_ARGS); @@ -174,7 +176,7 @@ static const struct termact termacts[MDOC_MAX] = { { NULL, termp____post }, /* %O */ { NULL, termp____post }, /* %P */ { NULL, termp____post }, /* %R */ - { termp_under_pre, termp____post }, /* %T */ + { termp__t_pre, termp__t_post }, /* %T */ { NULL, termp____post }, /* %V */ { NULL, NULL }, /* Ac */ { termp_quote_pre, termp_quote_post }, /* Ao */ @@ -1830,7 +1832,7 @@ static int termp_quote_pre(DECL_ARGS) { - if (MDOC_BODY != n->type) + if (MDOC_BODY != n->type && MDOC_ELEM != n->type) return(1); switch (n->tok) { @@ -1853,6 +1855,8 @@ termp_quote_pre(DECL_ARGS) case (MDOC_Bq): term_word(p, "["); break; + case (MDOC__T): + /* FALLTHROUGH */ case (MDOC_Do): /* FALLTHROUGH */ case (MDOC_Dq): @@ -1890,7 +1894,7 @@ static void termp_quote_post(DECL_ARGS) { - if (MDOC_BODY != n->type) + if (MDOC_BODY != n->type && MDOC_ELEM != n->type) return; p->flags |= TERMP_NOSPACE; @@ -1915,6 +1919,8 @@ termp_quote_post(DECL_ARGS) case (MDOC_Bq): term_word(p, "]"); break; + case (MDOC__T): + /* FALLTHROUGH */ case (MDOC_Do): /* FALLTHROUGH */ case (MDOC_Dq): @@ -2134,6 +2140,39 @@ termp_bk_post(DECL_ARGS) } /* ARGSUSED */ +static void +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) + termp_quote_post(p, pair, m, n); + + termp____post(p, pair, m, n); +} + +/* ARGSUSED */ +static int +termp__t_pre(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) + return(termp_quote_pre(p, pair, m, n)); + + term_fontpush(p, TERMFONT_UNDER); + return(1); +} + +/* ARGSUSED */ static int termp_under_pre(DECL_ARGS) { |