summaryrefslogtreecommitdiffstats
path: root/man_term.c
diff options
context:
space:
mode:
authorKristaps Dzonsons <kristaps@bsd.lv>2010-12-06 15:31:19 +0000
committerKristaps Dzonsons <kristaps@bsd.lv>2010-12-06 15:31:19 +0000
commit1049fa2ac2bf54c5e693aa6c004c070673274a0d (patch)
treed1af57d14f409ae73c3b80b1e2f485da1b1078c1 /man_term.c
parentc802814c27476c6d4d81264ca9625b111ea59241 (diff)
downloadmandoc-1049fa2ac2bf54c5e693aa6c004c070673274a0d.tar.gz
Add support for `ft' macro found in groff(7). Based on a patch by
schwarze@, but without the -T[x]html handling, which structurally does not work. Also add man.7 documentation (not in original patch).
Diffstat (limited to 'man_term.c')
-rw-r--r--man_term.c43
1 files changed, 43 insertions, 0 deletions
diff --git a/man_term.c b/man_term.c
index c7b3c8da..cbf5d1e1 100644
--- a/man_term.c
+++ b/man_term.c
@@ -94,6 +94,7 @@ static int pre_ign(DECL_ARGS);
static int pre_in(DECL_ARGS);
static int pre_literal(DECL_ARGS);
static int pre_sp(DECL_ARGS);
+static int pre_ft(DECL_ARGS);
static void post_IP(DECL_ARGS);
static void post_HP(DECL_ARGS);
@@ -137,6 +138,7 @@ static const struct termact termacts[MAN_MAX] = {
{ pre_ign, NULL, 0 }, /* PD */
{ pre_ign, NULL, 0 }, /* AT */
{ pre_in, NULL, MAN_NOTEXT }, /* in */
+ { pre_ft, NULL, MAN_NOTEXT }, /* ft */
};
@@ -320,6 +322,47 @@ pre_B(DECL_ARGS)
/* ARGSUSED */
static int
+pre_ft(DECL_ARGS)
+{
+ const char *cp;
+
+ if (NULL == n->child) {
+ term_fontlast(p);
+ return(0);
+ }
+
+ cp = n->child->string;
+ switch (*cp) {
+ case ('4'):
+ /* FALLTHROUGH */
+ case ('3'):
+ /* FALLTHROUGH */
+ case ('B'):
+ term_fontrepl(p, TERMFONT_BOLD);
+ break;
+ case ('2'):
+ /* FALLTHROUGH */
+ case ('I'):
+ term_fontrepl(p, TERMFONT_UNDER);
+ break;
+ case ('P'):
+ term_fontlast(p);
+ break;
+ case ('1'):
+ /* FALLTHROUGH */
+ case ('C'):
+ /* FALLTHROUGH */
+ case ('R'):
+ term_fontrepl(p, TERMFONT_NONE);
+ break;
+ default:
+ break;
+ }
+ return(0);
+}
+
+/* ARGSUSED */
+static int
pre_in(DECL_ARGS)
{
int len, less;