diff options
-rw-r--r-- | usr.bin/mandoc/html.c | 9 |
1 files changed, 6 insertions, 3 deletions
diff --git a/usr.bin/mandoc/html.c b/usr.bin/mandoc/html.c index 68db54b54e5..20588aadb56 100644 --- a/usr.bin/mandoc/html.c +++ b/usr.bin/mandoc/html.c @@ -1,4 +1,4 @@ -/* $OpenBSD: html.c,v 1.149 2022/07/06 14:27:55 schwarze Exp $ */ +/* $OpenBSD: html.c,v 1.150 2022/08/09 11:21:50 schwarze Exp $ */ /* * Copyright (c) 2008-2011, 2014 Kristaps Dzonsons <kristaps@bsd.lv> * Copyright (c) 2011-2015, 2017-2021 Ingo Schwarze <schwarze@openbsd.org> @@ -401,10 +401,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; |