source@mandoc.bsd.lv
 help / color / mirror / Atom feed
* mdocml: Generate simpler in-page links: just replace spaces with
@ 2016-01-04 12:45 schwarze
  0 siblings, 0 replies; only message in thread
From: schwarze @ 2016-01-04 12:45 UTC (permalink / raw)
  To: source

Log Message:
-----------
Generate simpler in-page links: just replace spaces with underscores.
Patch from bentley@.

Modified Files:
--------------
    mdocml:
        html.c
        mdoc_html.c

Revision Data
-------------
Index: html.c
===================================================================
RCS file: /home/cvs/mdocml/mdocml/html.c,v
retrieving revision 1.191
retrieving revision 1.192
diff -Lhtml.c -Lhtml.c -u -p -r1.191 -r1.192
--- html.c
+++ html.c
@@ -720,8 +720,8 @@ void
 bufcat_id(struct html *h, const char *src)
 {
 
-	/* Cf. <http://www.w3.org/TR/html4/types.html#h-6.2>. */
+	/* Cf. <http://www.w3.org/TR/html5/dom.html#the-id-attribute>. */
 
-	while ('\0' != *src)
-		bufcat_fmt(h, "%.2x", *src++);
+	for (; '\0' != *src; src++)
+		bufncat(h, *src == ' ' ? "_" : src, 1);
 }
Index: mdoc_html.c
===================================================================
RCS file: /home/cvs/mdocml/mdocml/mdoc_html.c,v
retrieving revision 1.238
retrieving revision 1.239
diff -Lmdoc_html.c -Lmdoc_html.c -u -p -r1.238 -r1.239
--- mdoc_html.c
+++ mdoc_html.c
@@ -542,7 +542,6 @@ mdoc_sh_pre(MDOC_ARGS)
 	}
 
 	bufinit(h);
-	bufcat(h, "x");
 
 	for (n = n->child; n != NULL && n->type == ROFFT_TEXT; ) {
 		bufcat_id(h, n->string);
@@ -572,7 +571,6 @@ mdoc_ss_pre(MDOC_ARGS)
 		return 1;
 
 	bufinit(h);
-	bufcat(h, "x");
 
 	for (n = n->child; n != NULL && n->type == ROFFT_TEXT; ) {
 		bufcat_id(h, n->string);
@@ -1063,7 +1061,7 @@ mdoc_sx_pre(MDOC_ARGS)
 	struct htmlpair	 tag[2];
 
 	bufinit(h);
-	bufcat(h, "#x");
+	bufcat(h, "#");
 
 	for (n = n->child; n; ) {
 		bufcat_id(h, n->string);
--
 To unsubscribe send an email to source+unsubscribe@mdocml.bsd.lv

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

only message in thread, other threads:[~2016-01-04 12:45 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-01-04 12:45 mdocml: Generate simpler in-page links: just replace spaces with 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).