version 1.229, 2018/05/25 20:23:51 |
version 1.230, 2018/05/28 14:13:36 |
Line 287 html_make_id(const struct roff_node *n, int unique) |
|
Line 287 html_make_id(const struct roff_node *n, int unique) |
|
if (buf == NULL) |
if (buf == NULL) |
return NULL; |
return NULL; |
|
|
/* http://www.w3.org/TR/html5/dom.html#the-id-attribute */ |
/* |
|
* In ID attributes, only use ASCII characters that are |
|
* permitted in URL-fragment strings according to the |
|
* explicit list at: |
|
* https://url.spec.whatwg.org/#url-fragment-string |
|
*/ |
|
|
for (cp = buf; *cp != '\0'; cp++) |
for (cp = buf; *cp != '\0'; cp++) |
if (*cp == ' ') |
if (isalnum((unsigned char)*cp) == 0 && |
|
strchr("!$&'()*+,-./:;=?@_~", *cp) == NULL) |
*cp = '_'; |
*cp = '_'; |
|
|
if (unique == 0) |
if (unique == 0) |