summaryrefslogtreecommitdiffstats
path: root/usr.bin/mandoc/mdoc_html.c
diff options
context:
space:
mode:
authorschwarze <schwarze@openbsd.org>2020-04-19 15:15:54 +0000
committerschwarze <schwarze@openbsd.org>2020-04-19 15:15:54 +0000
commit6e69d8cf52107b54f90bc25904229e73dff8c47a (patch)
treea0ec1ae40cc7defb22d7428825b12359fdb66df5 /usr.bin/mandoc/mdoc_html.c
parentMove logic to change brightness level in reasonable steps from acpivout(4) (diff)
downloadwireguard-openbsd-6e69d8cf52107b54f90bc25904229e73dff8c47a.tar.xz
wireguard-openbsd-6e69d8cf52107b54f90bc25904229e73dff8c47a.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 'usr.bin/mandoc/mdoc_html.c')
-rw-r--r--usr.bin/mandoc/mdoc_html.c13
1 files changed, 9 insertions, 4 deletions
diff --git a/usr.bin/mandoc/mdoc_html.c b/usr.bin/mandoc/mdoc_html.c
index 4a277cbc72a..fcff005883b 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.214 2020/04/18 20:28:46 schwarze Exp $ */
+/* $OpenBSD: mdoc_html.c,v 1.215 2020/04/19 15:15:54 schwarze Exp $ */
/*
* Copyright (c) 2014-2020 Ingo Schwarze <schwarze@openbsd.org>
* Copyright (c) 2008-2011, 2014 Kristaps Dzonsons <kristaps@bsd.lv>
@@ -693,8 +693,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;
}
@@ -1209,6 +1211,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)
@@ -1219,8 +1223,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;
}