From 4ee381e7bf5e05beda919be00d162d31ae86f4b8 Mon Sep 17 00:00:00 2001 From: Ingo Schwarze Date: Sun, 19 Apr 2020 15:16:56 +0000 Subject: Correctly handle non-unique tags even when NODE_ID and NODE_HREF fall apart, NODE_ID occurring earlier than NODE_HREF. --- mdoc_html.c | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) (limited to 'mdoc_html.c') 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 * Copyright (c) 2008-2011, 2014 Kristaps Dzonsons @@ -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; } -- cgit v1.2.3