aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/mdoc_term.c
diff options
context:
space:
mode:
authorIngo Schwarze <schwarze@openbsd.org>2016-11-08 16:23:58 +0000
committerIngo Schwarze <schwarze@openbsd.org>2016-11-08 16:23:58 +0000
commit93a372a4463b0756ab50791669b2d6f695ab7220 (patch)
treee8df9cd9f58afc59caecafb1916d88c505f93608 /mdoc_term.c
parentd5e61d83359928d22ab111a76a9ff8e828e6a855 (diff)
downloadmandoc-93a372a4463b0756ab50791669b2d6f695ab7220.tar.gz
mandoc-93a372a4463b0756ab50791669b2d6f695ab7220.tar.zst
mandoc-93a372a4463b0756ab50791669b2d6f695ab7220.zip
implement tag priority 0, which will tag only keys that appear as
tag candidates exactly once, and use it for .Em and .Sy; written on the TGV Toulouse-Paris
Diffstat (limited to 'mdoc_term.c')
-rw-r--r--mdoc_term.c28
1 files changed, 25 insertions, 3 deletions
diff --git a/mdoc_term.c b/mdoc_term.c
index a05e3859..429dca6a 100644
--- a/mdoc_term.c
+++ b/mdoc_term.c
@@ -1,4 +1,4 @@
-/* $Id: mdoc_term.c,v 1.333 2016/11/08 16:04:57 schwarze Exp $ */
+/* $Id: mdoc_term.c,v 1.334 2016/11/08 16:23:58 schwarze Exp $ */
/*
* Copyright (c) 2008, 2009, 2010, 2011 Kristaps Dzonsons <kristaps@bsd.lv>
* Copyright (c) 2010, 2012-2016 Ingo Schwarze <schwarze@openbsd.org>
@@ -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_em_pre(DECL_ARGS);
static int termp_er_pre(DECL_ARGS);
static int termp_ex_pre(DECL_ARGS);
static int termp_fa_pre(DECL_ARGS);
@@ -119,6 +120,7 @@ static int termp_skip_pre(DECL_ARGS);
static int termp_sm_pre(DECL_ARGS);
static int termp_sp_pre(DECL_ARGS);
static int termp_ss_pre(DECL_ARGS);
+static int termp_sy_pre(DECL_ARGS);
static int termp_tag_pre(DECL_ARGS);
static int termp_under_pre(DECL_ARGS);
static int termp_ud_pre(DECL_ARGS);
@@ -195,7 +197,7 @@ static const struct termact termacts[MDOC_MAX] = {
{ termp_quote_pre, termp_quote_post }, /* Dq */
{ NULL, NULL }, /* Ec */ /* FIXME: no space */
{ NULL, NULL }, /* Ef */
- { termp_under_pre, NULL }, /* Em */
+ { termp_em_pre, NULL }, /* Em */
{ termp_eo_pre, termp_eo_post }, /* Eo */
{ termp_xx_pre, NULL }, /* Fx */
{ termp_bold_pre, NULL }, /* Ms */
@@ -218,7 +220,7 @@ static const struct termact termacts[MDOC_MAX] = {
{ termp_quote_pre, termp_quote_post }, /* Sq */
{ termp_sm_pre, NULL }, /* Sm */
{ termp_under_pre, NULL }, /* Sx */
- { termp_bold_pre, NULL }, /* Sy */
+ { termp_sy_pre, NULL }, /* Sy */
{ NULL, NULL }, /* Tn */
{ termp_xx_pre, NULL }, /* Ux */
{ NULL, NULL }, /* Xc */
@@ -2218,6 +2220,26 @@ termp_under_pre(DECL_ARGS)
}
static int
+termp_em_pre(DECL_ARGS)
+{
+ if (n->child != NULL &&
+ n->child->type == ROFFT_TEXT)
+ tag_put(n->child->string, 0, p->line);
+ term_fontpush(p, TERMFONT_UNDER);
+ return 1;
+}
+
+static int
+termp_sy_pre(DECL_ARGS)
+{
+ if (n->child != NULL &&
+ n->child->type == ROFFT_TEXT)
+ tag_put(n->child->string, 0, p->line);
+ term_fontpush(p, TERMFONT_BOLD);
+ return 1;
+}
+
+static int
termp_er_pre(DECL_ARGS)
{