summaryrefslogtreecommitdiffstats
path: root/man_term.c
diff options
context:
space:
mode:
authorIngo Schwarze <schwarze@openbsd.org>2013-10-17 20:54:58 +0000
committerIngo Schwarze <schwarze@openbsd.org>2013-10-17 20:54:58 +0000
commita24894c279cda3d965668a3548d070489a8aceed (patch)
tree802cd2c3ea9060f30b957ad4a052608a76fe9b4a /man_term.c
parent9680b7282e62aa4b1c49f8ee927df097cbe37246 (diff)
downloadmandoc-a24894c279cda3d965668a3548d070489a8aceed.tar.gz
Implement the .UR/.UE block (uniform resource identifier) introduced in the
man-ext macros by Eric S. Raymond, enabled by default in groff_man(7). Usual disclaimer: You don't write new man(7) code, so you are not going to use these, either. Improves e.g. the bzr(1) and etherape(1) manuals. Thanks to naddy@ for bringing these to my attention.
Diffstat (limited to 'man_term.c')
-rw-r--r--man_term.c30
1 files changed, 30 insertions, 0 deletions
diff --git a/man_term.c b/man_term.c
index 7ec86802..d02d3729 100644
--- a/man_term.c
+++ b/man_term.c
@@ -78,6 +78,7 @@ 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_UR(DECL_ARGS);
static int pre_alternate(DECL_ARGS);
static int pre_ft(DECL_ARGS);
static int pre_ign(DECL_ARGS);
@@ -91,6 +92,7 @@ static void post_RS(DECL_ARGS);
static void post_SH(DECL_ARGS);
static void post_SS(DECL_ARGS);
static void post_TP(DECL_ARGS);
+static void post_UR(DECL_ARGS);
static const struct termact termacts[MAN_MAX] = {
{ pre_sp, NULL, MAN_NOTEXT }, /* br */
@@ -129,6 +131,8 @@ static const struct termact termacts[MAN_MAX] = {
{ pre_OP, NULL, 0 }, /* OP */
{ pre_literal, NULL, 0 }, /* EX */
{ pre_literal, NULL, 0 }, /* EE */
+ { pre_UR, post_UR, 0 }, /* UR */
+ { NULL, NULL, 0 }, /* UE */
};
@@ -939,6 +943,32 @@ post_RS(DECL_ARGS)
mt->lmargincur = mt->lmarginsz;
}
+/* ARGSUSED */
+static int
+pre_UR(DECL_ARGS)
+{
+
+ return (MAN_HEAD != n->type);
+}
+
+/* ARGSUSED */
+static void
+post_UR(DECL_ARGS)
+{
+
+ if (MAN_BLOCK != n->type)
+ return;
+
+ term_word(p, "<");
+ p->flags |= TERMP_NOSPACE;
+
+ if (NULL != n->child->child)
+ print_man_node(p, mt, n->child->child, meta);
+
+ p->flags |= TERMP_NOSPACE;
+ term_word(p, ">");
+}
+
static void
print_man_node(DECL_ARGS)
{