diff options
author | Ingo Schwarze <schwarze@openbsd.org> | 2022-08-09 11:23:11 +0000 |
---|---|---|
committer | Ingo Schwarze <schwarze@openbsd.org> | 2022-08-09 11:23:11 +0000 |
commit | d14c945231d916872b00d6bcc5945519970a000b (patch) | |
tree | cd8102e2f53342c225515ac169c7f52ae1072005 /html.c | |
parent | c332f16bffc4915a779c809257e24622ad110f28 (diff) | |
download | mandoc-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.c | 7 |
1 files changed, 5 insertions, 2 deletions
@@ -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; |