diff options
author | Ingo Schwarze <schwarze@openbsd.org> | 2020-04-20 13:07:24 +0000 |
---|---|---|
committer | Ingo Schwarze <schwarze@openbsd.org> | 2020-04-20 13:07:24 +0000 |
commit | d75c48416eef7eb48487f6dc9a1bafa2c262b81c (patch) | |
tree | 3120d383a66d7862dd79a02c1cdd3c8150476589 /html.c | |
parent | 53e82aa8ae9cb194d4b8418e8dd4223a4a5097d3 (diff) | |
download | mandoc-d75c48416eef7eb48487f6dc9a1bafa2c262b81c.tar.gz mandoc-d75c48416eef7eb48487f6dc9a1bafa2c262b81c.tar.zst mandoc-d75c48416eef7eb48487f6dc9a1bafa2c262b81c.zip |
In fragment identifiers, use ~%d for ordinal suffixes,
and reserve the character '~' for that purpose.
Bug found by validator.w3.org in openssl(1), which contains both a
tag "tls1_2" and a second instance of a tag "tls1", which also resulted
in "tls1_2", causing a clash. Now, the second instance of "tls1" is
rendered as "tls1~2" instead, employing the newly reserved '~'.
Diffstat (limited to 'html.c')
-rw-r--r-- | html.c | 7 |
1 files changed, 4 insertions, 3 deletions
@@ -1,4 +1,4 @@ -/* $Id: html.c,v 1.269 2020/04/19 15:16:56 schwarze Exp $ */ +/* $Id: html.c,v 1.270 2020/04/20 13:07:24 schwarze Exp $ */ /* * Copyright (c) 2011-2015, 2017-2020 Ingo Schwarze <schwarze@openbsd.org> * Copyright (c) 2008-2011, 2014 Kristaps Dzonsons <kristaps@bsd.lv> @@ -383,11 +383,12 @@ html_make_id(const struct roff_node *n, int unique) * permitted in URL-fragment strings according to the * explicit list at: * https://url.spec.whatwg.org/#url-fragment-string + * In addition, reserve '~' for ordinal suffixes. */ for (cp = buf; *cp != '\0'; cp++) if (isalnum((unsigned char)*cp) == 0 && - strchr("!$&'()*+,-./:;=?@_~", *cp) == NULL) + strchr("!$&'()*+,-./:;=?@_", *cp) == NULL) *cp = '_'; if (unique == 0) @@ -407,7 +408,7 @@ html_make_id(const struct roff_node *n, int unique) if (entry->ord > 1) { cp = buf; - mandoc_asprintf(&buf, "%s_%d", cp, entry->ord); + mandoc_asprintf(&buf, "%s~%d", cp, entry->ord); free(cp); } return buf; |