summaryrefslogtreecommitdiff
path: root/usr.bin
diff options
context:
space:
mode:
authorIngo Schwarze <schwarze@cvs.openbsd.org>2020-03-21 00:17:02 +0000
committerIngo Schwarze <schwarze@cvs.openbsd.org>2020-03-21 00:17:02 +0000
commit552ae67d6bc6f43177819b14352c7e3fb901e8d6 (patch)
treef813e77675cd32bf8406abe86c872af5391e240f /usr.bin
parent8e5fbe502e611b644d8ce29214050d306ed82409 (diff)
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@
Diffstat (limited to 'usr.bin')
-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;
+ }
}
/*