diff options
author | Ingo Schwarze <schwarze@openbsd.org> | 2020-03-21 00:17:31 +0000 |
---|---|---|
committer | Ingo Schwarze <schwarze@openbsd.org> | 2020-03-21 00:17:31 +0000 |
commit | adf661d0e6a266fb863f2b05859244eaae613344 (patch) | |
tree | df0a92612683aed0781280af8e89d2052701f6ed | |
parent | adfe861feea336544648d5ca761511a928c2d564 (diff) | |
download | mandoc-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@
-rw-r--r-- | tag.c | 20 |
1 files changed, 18 insertions, 2 deletions
@@ -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; + } } /* |