aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/mdoc_html.c
diff options
context:
space:
mode:
authorIngo Schwarze <schwarze@openbsd.org>2020-04-19 15:16:56 +0000
committerIngo Schwarze <schwarze@openbsd.org>2020-04-19 15:16:56 +0000
commit4ee381e7bf5e05beda919be00d162d31ae86f4b8 (patch)
treeaf3b13beff80c2092bff9798c55d29d6694a5e5a /mdoc_html.c
parent05fe7c8316644cd9fe362b1f561ef55e65e93846 (diff)
downloadmandoc-4ee381e7bf5e05beda919be00d162d31ae86f4b8.tar.gz
mandoc-4ee381e7bf5e05beda919be00d162d31ae86f4b8.tar.zst
mandoc-4ee381e7bf5e05beda919be00d162d31ae86f4b8.zip
Correctly handle non-unique tags even when NODE_ID and NODE_HREF fall
apart, NODE_ID occurring earlier than NODE_HREF.
Diffstat (limited to 'mdoc_html.c')
-rw-r--r--mdoc_html.c13
1 files changed, 9 insertions, 4 deletions
diff --git a/mdoc_html.c b/mdoc_html.c
index bff4757f..d96df6df 100644
--- a/mdoc_html.c
+++ b/mdoc_html.c
@@ -1,4 +1,4 @@
-/* $Id: mdoc_html.c,v 1.339 2020/04/18 20:40:10 schwarze Exp $ */
+/* $Id: mdoc_html.c,v 1.340 2020/04/19 15:16:56 schwarze Exp $ */
/*
* Copyright (c) 2014-2020 Ingo Schwarze <schwarze@openbsd.org>
* Copyright (c) 2008-2011, 2014 Kristaps Dzonsons <kristaps@bsd.lv>
@@ -695,8 +695,10 @@ mdoc_tg_pre(MDOC_ARGS)
{
char *id;
- if ((id = html_make_id(n, 1)) != NULL)
+ if ((id = html_make_id(n, 1)) != NULL) {
print_tagq(h, print_otag(h, TAG_MARK, "i", id));
+ free(id);
+ }
return 0;
}
@@ -1211,6 +1213,8 @@ mdoc_skip_pre(MDOC_ARGS)
static int
mdoc_pp_pre(MDOC_ARGS)
{
+ char *id;
+
if (n->flags & NODE_NOFILL) {
print_endline(h);
if (n->flags & NODE_ID)
@@ -1221,8 +1225,9 @@ mdoc_pp_pre(MDOC_ARGS)
}
} else {
html_close_paragraph(h);
- print_otag(h, TAG_P, "ci", "Pp",
- n->flags & NODE_ID ? html_make_id(n, 1) : NULL);
+ id = n->flags & NODE_ID ? html_make_id(n, 1) : NULL;
+ print_otag(h, TAG_P, "ci", "Pp", id);
+ free(id);
}
return 0;
}