summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--main.c1
-rw-r--r--man.77
-rw-r--r--man.c2
-rw-r--r--man.h1
-rw-r--r--man_html.c1
-rw-r--r--man_macro.c1
-rw-r--r--man_term.c43
-rw-r--r--man_validate.c55
-rw-r--r--mandoc.h1
9 files changed, 110 insertions, 2 deletions
diff --git a/main.c b/main.c
index 96179acb..8d477ed2 100644
--- a/main.c
+++ b/main.c
@@ -144,6 +144,7 @@ static const char * const mandocerrs[MANDOCERR_MAX] = {
"NAME section must come first",
"bad Boolean value",
+ "unknown font",
"child violates parent syntax",
"displays may not be nested",
"bad AT&T symbol",
diff --git a/man.7 b/man.7
index ab53e802..13dd0c32 100644
--- a/man.7
+++ b/man.7
@@ -414,7 +414,6 @@ The syntax is as follows:
.It Sx \&I Ta n Ta next-line Ta \&
.It Sx \&IB Ta n Ta current Ta \&
.It Sx \&IR Ta n Ta current Ta \&
-.\" .It Sx \&PD Ta n Ta current Ta compat
.It Sx \&R Ta n Ta next-line Ta \&
.It Sx \&RB Ta n Ta current Ta \&
.It Sx \&RI Ta n Ta current Ta \&
@@ -424,6 +423,7 @@ The syntax is as follows:
.It Sx \&UC Ta <=1 Ta current Ta \&
.It Sx \&br Ta 0 Ta current Ta compat
.It Sx \&fi Ta 0 Ta current Ta compat
+.It Sx \&ft Ta 1 Ta current Ta compat
.It Sx \&i Ta n Ta current Ta compat
.It Sx \&in Ta 1 Ta current Ta compat
.It Sx \&na Ta 0 Ta current Ta compat
@@ -831,6 +831,11 @@ See also
.Ss \&fi
End literal mode begun by
.Sx \&nf .
+.Ss \&ft
+Change the current font mode.
+See
+.Sx Text Decoration
+for a listing of available font modes.
.Ss \&i
Italicise arguments.
Synonym for
diff --git a/man.c b/man.c
index 029337f6..8a9fbb7f 100644
--- a/man.c
+++ b/man.c
@@ -39,7 +39,7 @@ const char *const __man_macronames[MAN_MAX] = {
"RI", "na", "i", "sp",
"nf", "fi", "r", "RE",
"RS", "DT", "UC", "PD",
- "AT", "in"
+ "AT", "in", "ft"
};
const char * const *man_macronames = __man_macronames;
diff --git a/man.h b/man.h
index 0f8279cc..4d26a437 100644
--- a/man.h
+++ b/man.h
@@ -55,6 +55,7 @@ enum mant {
MAN_PD,
MAN_AT,
MAN_in,
+ MAN_ft,
MAN_MAX
};
diff --git a/man_html.c b/man_html.c
index c4b24ad4..50e13c9a 100644
--- a/man_html.c
+++ b/man_html.c
@@ -114,6 +114,7 @@ static const struct htmlman mans[MAN_MAX] = {
{ man_ign_pre, NULL }, /* PD */
{ man_ign_pre, NULL }, /* AT */
{ man_in_pre, NULL }, /* in */
+ { man_in_pre, NULL }, /* ft */
};
diff --git a/man_macro.c b/man_macro.c
index 43a4940c..63ba5b84 100644
--- a/man_macro.c
+++ b/man_macro.c
@@ -81,6 +81,7 @@ const struct man_macro __man_macros[MAN_MAX] = {
{ in_line_eoln, 0 }, /* PD */
{ in_line_eoln, 0 }, /* AT */
{ in_line_eoln, 0 }, /* in */
+ { in_line_eoln, 0 }, /* ft */
};
const struct man_macro * const man_macros = __man_macros;
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;
diff --git a/man_validate.c b/man_validate.c
index 66e1795b..d14ea464 100644
--- a/man_validate.c
+++ b/man_validate.c
@@ -44,6 +44,7 @@ struct man_valid {
static int check_bline(CHKARGS);
static int check_eq0(CHKARGS);
+static int check_ft(CHKARGS);
static int check_le1(CHKARGS);
static int check_ge2(CHKARGS);
static int check_le5(CHKARGS);
@@ -64,6 +65,7 @@ static v_check posts_at[] = { post_AT, NULL };
static v_check posts_eq0[] = { check_eq0, NULL };
static v_check posts_fi[] = { check_eq0, post_fi, NULL };
static v_check posts_le1[] = { check_le1, NULL };
+static v_check posts_ft[] = { check_ft, NULL };
static v_check posts_nf[] = { check_eq0, post_nf, NULL };
static v_check posts_par[] = { check_par, NULL };
static v_check posts_part[] = { check_part, NULL };
@@ -108,6 +110,7 @@ static const struct man_valid man_valids[MAN_MAX] = {
{ NULL, NULL }, /* PD */
{ NULL, posts_at }, /* AT */
{ NULL, NULL }, /* in */
+ { NULL, posts_ft }, /* ft */
};
@@ -268,6 +271,58 @@ INEQ_DEFINE(1, <=, le1)
INEQ_DEFINE(2, >=, ge2)
INEQ_DEFINE(5, <=, le5)
+static int
+check_ft(CHKARGS)
+{
+ char *cp;
+ int ok;
+
+ if (0 == n->nchild)
+ return(1);
+
+ ok = 0;
+ cp = n->child->string;
+ switch (*cp) {
+ case ('1'):
+ /* FALLTHROUGH */
+ case ('2'):
+ /* FALLTHROUGH */
+ case ('3'):
+ /* FALLTHROUGH */
+ case ('4'):
+ /* FALLTHROUGH */
+ case ('I'):
+ /* FALLTHROUGH */
+ case ('P'):
+ /* FALLTHROUGH */
+ case ('R'):
+ if ('\0' == cp[1])
+ ok = 1;
+ break;
+ case ('B'):
+ if ('\0' == cp[1] || ('I' == cp[1] && '\0' == cp[2]))
+ ok = 1;
+ break;
+ case ('C'):
+ if ('W' == cp[1] && '\0' == cp[2])
+ ok = 1;
+ break;
+ default:
+ break;
+ }
+
+ if (0 == ok) {
+ man_vmsg(m, MANDOCERR_BADFONT,
+ n->line, n->pos, "%s", cp);
+ *cp = '\0';
+ }
+
+ if (1 < n->nchild)
+ man_vmsg(m, MANDOCERR_ARGCOUNT, n->line, n->pos,
+ "want one child (have %d)", n->nchild);
+
+ return(1);
+}
static int
check_sec(CHKARGS)
diff --git a/mandoc.h b/mandoc.h
index ffaaa46a..43b6ece8 100644
--- a/mandoc.h
+++ b/mandoc.h
@@ -66,6 +66,7 @@ enum mandocerr {
MANDOCERR_ERROR, /* ===== start of errors ===== */
MANDOCERR_NAMESECFIRST, /* NAME section must come first */
MANDOCERR_BADBOOL, /* bad Boolean value */
+ MANDOCERR_BADFONT, /* unknown font */
MANDOCERR_CHILD, /* child violates parent syntax */
MANDOCERR_NESTEDDISP, /* displays may not be nested */
MANDOCERR_BADATT, /* bad AT&T symbol */