-/* $Id: mdoc_term.c,v 1.202 2010/12/24 14:00:40 kristaps Exp $ */
+/* $Id: mdoc_term.c,v 1.203 2010/12/25 13:50:37 kristaps Exp $ */
/*
* Copyright (c) 2008, 2009, 2010 Kristaps Dzonsons <kristaps@bsd.lv>
* Copyright (c) 2010 Ingo Schwarze <schwarze@openbsd.org>
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);
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);
{ 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 */
termp_quote_pre(DECL_ARGS)
{
- if (MDOC_BODY != n->type)
+ if (MDOC_BODY != n->type && MDOC_ELEM != n->type)
return(1);
switch (n->tok) {
case (MDOC_Bq):
term_word(p, "[");
break;
+ case (MDOC__T):
+ /* FALLTHROUGH */
case (MDOC_Do):
/* FALLTHROUGH */
case (MDOC_Dq):
termp_quote_post(DECL_ARGS)
{
- if (MDOC_BODY != n->type)
+ if (MDOC_BODY != n->type && MDOC_ELEM != n->type)
return;
p->flags |= TERMP_NOSPACE;
case (MDOC_Bq):
term_word(p, "]");
break;
+ case (MDOC__T):
+ /* FALLTHROUGH */
case (MDOC_Do):
/* FALLTHROUGH */
case (MDOC_Dq):
p->flags &= ~(TERMP_KEEP | TERMP_PREKEEP);
}
+/* 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)