aboutsummaryrefslogtreecommitdiffstatshomepage
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
commit80da5c33753e6423f0c705cd021a073af20577a9 (patch)
tree86853f332a4ac8f07b3d088aeccb48fc5611ebc6 /man_term.c
parentde451aaf7a927d2994d3e526df07235dee8005af (diff)
downloadmandoc-80da5c33753e6423f0c705cd021a073af20577a9.tar.gz
mandoc-80da5c33753e6423f0c705cd021a073af20577a9.tar.zst
mandoc-80da5c33753e6423f0c705cd021a073af20577a9.zip
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.c32
1 files changed, 31 insertions, 1 deletions
diff --git a/man_term.c b/man_term.c
index db5719ce..4dc6d8bd 100644
--- a/man_term.c
+++ b/man_term.c
@@ -1,4 +1,4 @@
-/* $Id: man_term.c,v 1.136 2013/01/05 22:19:12 schwarze Exp $ */
+/* $Id: man_term.c,v 1.137 2013/10/17 20:54:58 schwarze Exp $ */
/*
* Copyright (c) 2008-2012 Kristaps Dzonsons <kristaps@bsd.lv>
* Copyright (c) 2010, 2011, 2012, 2013 Ingo Schwarze <schwarze@openbsd.org>
@@ -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)
{