diff options
author | Ingo Schwarze <schwarze@openbsd.org> | 2020-04-19 15:16:56 +0000 |
---|---|---|
committer | Ingo Schwarze <schwarze@openbsd.org> | 2020-04-19 15:16:56 +0000 |
commit | a7eb58f8be5552047bb2594077d548bec819a6d5 (patch) | |
tree | 286956bd2ac70f046fcef611c107c79336e270fa /mdoc_html.c | |
parent | 5b933cc0ef58641ed3423aeb65ce14d99ebcc89e (diff) | |
download | mandoc-a7eb58f8be5552047bb2594077d548bec819a6d5.tar.gz |
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.c | 11 |
1 files changed, 8 insertions, 3 deletions
diff --git a/mdoc_html.c b/mdoc_html.c index 4750dd29..5b7bfc85 100644 --- a/mdoc_html.c +++ b/mdoc_html.c @@ -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; } |