summaryrefslogtreecommitdiffstats
path: root/tag.c
diff options
context:
space:
mode:
authorIngo Schwarze <schwarze@openbsd.org>2020-03-21 00:17:31 +0000
committerIngo Schwarze <schwarze@openbsd.org>2020-03-21 00:17:31 +0000
commitadf661d0e6a266fb863f2b05859244eaae613344 (patch)
treedf0a92612683aed0781280af8e89d2052701f6ed /tag.c
parentadfe861feea336544648d5ca761511a928c2d564 (diff)
downloadmandoc-adf661d0e6a266fb863f2b05859244eaae613344.tar.gz
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 'tag.c')
-rw-r--r--tag.c20
1 files changed, 18 insertions, 2 deletions
diff --git a/tag.c b/tag.c
index 50502e58..9bf67480 100644
--- a/tag.c
+++ b/tag.c
@@ -89,8 +89,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;
+ }
}
/*