summaryrefslogtreecommitdiff
path: root/usr.bin
diff options
context:
space:
mode:
authorAnthony J. Bentley <bentley@cvs.openbsd.org>2015-12-25 20:43:05 +0000
committerAnthony J. Bentley <bentley@cvs.openbsd.org>2015-12-25 20:43:05 +0000
commit07c1644edfdda2ebcefab420884109702b609f88 (patch)
tree33bacfa7e1832d13b234e9b98a2c3de499d365f8 /usr.bin
parentb99a0199844bd7df1fff785eca65084e31cf050f (diff)
Generate simpler in-page links: just replace spaces with underscores.
So http://example.com/OpenBSD-current/man1/ls.1#x546865204c6f6e6720466f726d6174 becomes http://example.com/OpenBSD-current/man1/ls.1#The_Long_Format ok schwarze@
Diffstat (limited to 'usr.bin')
-rw-r--r--usr.bin/mandoc/html.c8
-rw-r--r--usr.bin/mandoc/mdoc_html.c6
2 files changed, 6 insertions, 8 deletions
diff --git a/usr.bin/mandoc/html.c b/usr.bin/mandoc/html.c
index 3502ea91c6b..a1bee3ea015 100644
--- a/usr.bin/mandoc/html.c
+++ b/usr.bin/mandoc/html.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: html.c,v 1.61 2015/10/13 22:57:49 schwarze Exp $ */
+/* $OpenBSD: html.c,v 1.62 2015/12/25 20:43:04 bentley Exp $ */
/*
* Copyright (c) 2008-2011, 2014 Kristaps Dzonsons <kristaps@bsd.lv>
* Copyright (c) 2011-2015 Ingo Schwarze <schwarze@openbsd.org>
@@ -718,8 +718,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);
}
diff --git a/usr.bin/mandoc/mdoc_html.c b/usr.bin/mandoc/mdoc_html.c
index b5eba071da0..b61a3a04e65 100644
--- a/usr.bin/mandoc/mdoc_html.c
+++ b/usr.bin/mandoc/mdoc_html.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: mdoc_html.c,v 1.113 2015/10/12 00:07:27 schwarze Exp $ */
+/* $OpenBSD: mdoc_html.c,v 1.114 2015/12/25 20:43:04 bentley Exp $ */
/*
* Copyright (c) 2008-2011, 2014 Kristaps Dzonsons <kristaps@bsd.lv>
* Copyright (c) 2014, 2015 Ingo Schwarze <schwarze@openbsd.org>
@@ -540,7 +540,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);
@@ -570,7 +569,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);
@@ -1061,7 +1059,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);