source@mandoc.bsd.lv
 help / color / mirror / Atom feed
* mandoc: URL-fragment strings can only contain certain characters.
@ 2018-05-28 14:14 schwarze
  0 siblings, 0 replies; only message in thread
From: schwarze @ 2018-05-28 14:14 UTC (permalink / raw)
  To: source

Log Message:
-----------
URL-fragment strings can only contain certain characters.
Fixing HTML syntax violations e.g. in pf.conf(5) and ifconfig(8)
reported by Anton Lazarov <lists at wrant dot com>.

Modified Files:
--------------
    mandoc:
        html.c

Revision Data
-------------
Index: html.c
===================================================================
RCS file: /home/cvs/mandoc/mandoc/html.c,v
retrieving revision 1.229
retrieving revision 1.230
diff -Lhtml.c -Lhtml.c -u -p -r1.229 -r1.230
--- html.c
+++ html.c
@@ -287,10 +287,16 @@ html_make_id(const struct roff_node *n, 
 	if (buf == 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++)
-		if (*cp == ' ')
+		if (isalnum((unsigned char)*cp) == 0 &&
+		    strchr("!$&'()*+,-./:;=?@_~", *cp) == NULL)
 			*cp = '_';
 
 	if (unique == 0)
--
 To unsubscribe send an email to source+unsubscribe@mandoc.bsd.lv

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2018-05-28 14:14 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-05-28 14:14 mandoc: URL-fragment strings can only contain certain characters schwarze

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).