From 07c1644edfdda2ebcefab420884109702b609f88 Mon Sep 17 00:00:00 2001 From: "Anthony J. Bentley" Date: Fri, 25 Dec 2015 20:43:05 +0000 Subject: 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@ --- usr.bin/mandoc/html.c | 8 ++++---- usr.bin/mandoc/mdoc_html.c | 6 ++---- 2 files changed, 6 insertions(+), 8 deletions(-) (limited to 'usr.bin') 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 * Copyright (c) 2011-2015 Ingo Schwarze @@ -718,8 +718,8 @@ void bufcat_id(struct html *h, const char *src) { - /* Cf. . */ + /* Cf. . */ - 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 * Copyright (c) 2014, 2015 Ingo Schwarze @@ -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); -- cgit v1.2.3