aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/man_term.c
diff options
context:
space:
mode:
authorKristaps Dzonsons <kristaps@bsd.lv>2012-01-03 15:16:24 +0000
committerKristaps Dzonsons <kristaps@bsd.lv>2012-01-03 15:16:24 +0000
commitd346448c959f7b9855c02917b358cfb0da2525e8 (patch)
tree1339709d2371873603f713f958f83cc8daa1a231 /man_term.c
parent484b430b59995e6ddf4b84461fdcc0c3a757addb (diff)
downloadmandoc-d346448c959f7b9855c02917b358cfb0da2525e8.tar.gz
mandoc-d346448c959f7b9855c02917b358cfb0da2525e8.tar.zst
mandoc-d346448c959f7b9855c02917b358cfb0da2525e8.zip
Add support for `OP', one of the extended man macros. This also requires
some man(7) changes to accomodate for the an-ext compatibility.
Diffstat (limited to 'man_term.c')
-rw-r--r--man_term.c31
1 files changed, 28 insertions, 3 deletions
diff --git a/man_term.c b/man_term.c
index 180fc677..69c5c95e 100644
--- a/man_term.c
+++ b/man_term.c
@@ -1,4 +1,4 @@
-/* $Id: man_term.c,v 1.126 2011/12/04 23:10:52 schwarze Exp $ */
+/* $Id: man_term.c,v 1.127 2012/01/03 15:16:24 kristaps Exp $ */
/*
* Copyright (c) 2008, 2009, 2010, 2011 Kristaps Dzonsons <kristaps@bsd.lv>
* Copyright (c) 2010, 2011 Ingo Schwarze <schwarze@openbsd.org>
@@ -68,21 +68,22 @@ static void print_man_foot(struct termp *, const void *);
static void print_bvspace(struct termp *,
const struct man_node *);
-static int pre_alternate(DECL_ARGS);
static int pre_B(DECL_ARGS);
static int pre_HP(DECL_ARGS);
static int pre_I(DECL_ARGS);
static int pre_IP(DECL_ARGS);
+static int pre_OP(DECL_ARGS);
static int pre_PP(DECL_ARGS);
static int pre_RS(DECL_ARGS);
static int pre_SH(DECL_ARGS);
static int pre_SS(DECL_ARGS);
static int pre_TP(DECL_ARGS);
+static int pre_alternate(DECL_ARGS);
+static int pre_ft(DECL_ARGS);
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);
@@ -125,6 +126,7 @@ static const struct termact termacts[MAN_MAX] = {
{ pre_ign, NULL, 0 }, /* AT */
{ pre_in, NULL, MAN_NOTEXT }, /* in */
{ pre_ft, NULL, MAN_NOTEXT }, /* ft */
+ { pre_OP, NULL, 0 }, /* OP */
};
@@ -324,6 +326,29 @@ pre_B(DECL_ARGS)
/* ARGSUSED */
static int
+pre_OP(DECL_ARGS)
+{
+
+ term_word(p, "[");
+ p->flags |= TERMP_NOSPACE;
+
+ if (NULL != (n = n->child)) {
+ term_fontrepl(p, TERMFONT_BOLD);
+ term_word(p, n->string);
+ }
+ if (NULL != n && NULL != n->next) {
+ term_fontrepl(p, TERMFONT_UNDER);
+ term_word(p, n->next->string);
+ }
+
+ term_fontrepl(p, TERMFONT_NONE);
+ p->flags |= TERMP_NOSPACE;
+ term_word(p, "]");
+ return(0);
+}
+
+/* ARGSUSED */
+static int
pre_ft(DECL_ARGS)
{
const char *cp;