summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorschwarze <schwarze@openbsd.org>2020-03-21 00:17:01 +0000
committerschwarze <schwarze@openbsd.org>2020-03-21 00:17:01 +0000
commitd55e8c17941c476a125a31a3c723da7fbe78f3d3 (patch)
tree3b9e01653bb9ca69269ec89689281ee1b07e4764
parentpatrick points out that i missed axppmic and rkpmic... (diff)
downloadwireguard-openbsd-d55e8c17941c476a125a31a3c723da7fbe78f3d3.tar.xz
wireguard-openbsd-d55e8c17941c476a125a31a3c723da7fbe78f3d3.zip
When setting automatic tags, skip initial hyphens and minus signs,
bringing the behaviour for mdoc(7) closer to what is already done for man(7). Triggered by the observation of kn@ that automatic tagging didn't work very well for find(1) primaries. OK kn@
-rw-r--r--usr.bin/mandoc/tag.c22
1 files changed, 19 insertions, 3 deletions
diff --git a/usr.bin/mandoc/tag.c b/usr.bin/mandoc/tag.c
index 7d4790d873a..d8ea190e79f 100644
--- a/usr.bin/mandoc/tag.c
+++ b/usr.bin/mandoc/tag.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: tag.c,v 1.29 2020/03/13 16:14:14 schwarze Exp $ */
+/* $OpenBSD: tag.c,v 1.30 2020/03/21 00:17:01 schwarze Exp $ */
/*
* Copyright (c) 2015,2016,2018,2019,2020 Ingo Schwarze <schwarze@openbsd.org>
*
@@ -87,8 +87,24 @@ tag_put(const char *s, int prio, struct roff_node *n)
if (n->child == NULL || n->child->type != ROFFT_TEXT)
return;
s = n->child->string;
- if (s[0] == '\\' && (s[1] == '&' || s[1] == 'e'))
- s += 2;
+ switch (s[0]) {
+ case '-':
+ s++;
+ break;
+ case '\\':
+ switch (s[1]) {
+ case '&':
+ case '-':
+ case 'e':
+ s += 2;
+ break;
+ default:
+ break;
+ }
+ break;
+ default:
+ break;
+ }
}
/*