summaryrefslogtreecommitdiffstats
path: root/html.c
diff options
context:
space:
mode:
authorIngo Schwarze <schwarze@openbsd.org>2022-08-09 11:23:11 +0000
committerIngo Schwarze <schwarze@openbsd.org>2022-08-09 11:23:11 +0000
commitd14c945231d916872b00d6bcc5945519970a000b (patch)
treecd8102e2f53342c225515ac169c7f52ae1072005 /html.c
parentc332f16bffc4915a779c809257e24622ad110f28 (diff)
downloadmandoc-d14c945231d916872b00d6bcc5945519970a000b.tar.gz
prevent breakable hyphens in segment identifiers
from being turned into underscores; bug reported by <Eldred dot fr> Habert
Diffstat (limited to 'html.c')
-rw-r--r--html.c7
1 files changed, 5 insertions, 2 deletions
diff --git a/html.c b/html.c
index a4a91925..1526c17e 100644
--- a/html.c
+++ b/html.c
@@ -403,10 +403,13 @@ html_make_id(const struct roff_node *n, int unique)
* In addition, reserve '~' for ordinal suffixes.
*/
- for (cp = buf; *cp != '\0'; cp++)
- if (isalnum((unsigned char)*cp) == 0 &&
+ for (cp = buf; *cp != '\0'; cp++) {
+ if (*cp == ASCII_HYPH)
+ *cp = '-';
+ else if (isalnum((unsigned char)*cp) == 0 &&
strchr("!$&'()*+,-./:;=?@_", *cp) == NULL)
*cp = '_';
+ }
if (unique == 0)
return buf;