aboutsummaryrefslogtreecommitdiffstatshomepage
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
commit8824599579c15c29a52a6ec127ec1b2a35719e2c (patch)
treef539cfc87104909847b10dcdfe2a9610a7a177c1 /man_term.c
parent6da78159c4f30e5cbfe60fe6a244c73321edcb1c (diff)
downloadmandoc-8824599579c15c29a52a6ec127ec1b2a35719e2c.tar.gz
mandoc-8824599579c15c29a52a6ec127ec1b2a35719e2c.tar.zst
mandoc-8824599579c15c29a52a6ec127ec1b2a35719e2c.zip
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.c45
1 files changed, 44 insertions, 1 deletions
diff --git a/man_term.c b/man_term.c
index 6cd40e39..d07028a2 100644
--- a/man_term.c
+++ b/man_term.c
@@ -1,4 +1,4 @@
-/* $Id: man_term.c,v 1.88 2010/12/06 14:04:11 kristaps Exp $ */
+/* $Id: man_term.c,v 1.89 2010/12/06 15:31:19 kristaps Exp $ */
/*
* Copyright (c) 2008, 2009, 2010 Kristaps Dzonsons <kristaps@bsd.lv>
*
@@ -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;