From fc78f53cd921d410f5a0cc2831a9a8791a0a7a8f Mon Sep 17 00:00:00 2001 From: Ingo Schwarze Date: Mon, 4 Jan 2016 12:45:29 +0000 Subject: Generate simpler in-page links: just replace spaces with underscores. Patch from bentley@. --- html.c | 8 ++++---- mdoc_html.c | 6 ++---- 2 files changed, 6 insertions(+), 8 deletions(-) diff --git a/html.c b/html.c index d734f546..adff053c 100644 --- a/html.c +++ b/html.c @@ -1,4 +1,4 @@ -/* $Id: html.c,v 1.191 2015/10/13 22:59:54 schwarze Exp $ */ +/* $Id: html.c,v 1.192 2016/01/04 12:45:29 schwarze Exp $ */ /* * Copyright (c) 2008-2011, 2014 Kristaps Dzonsons * Copyright (c) 2011-2015 Ingo Schwarze @@ -720,8 +720,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/mdoc_html.c b/mdoc_html.c index 82d7ca03..ee986acc 100644 --- a/mdoc_html.c +++ b/mdoc_html.c @@ -1,4 +1,4 @@ -/* $Id: mdoc_html.c,v 1.238 2015/10/12 00:08:15 schwarze Exp $ */ +/* $Id: mdoc_html.c,v 1.239 2016/01/04 12:45:29 schwarze Exp $ */ /* * Copyright (c) 2008-2011, 2014 Kristaps Dzonsons * Copyright (c) 2014, 2015 Ingo Schwarze @@ -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); -- cgit v1.2.3