diff options
author | 2020-04-06 09:55:49 +0000 | |
---|---|---|
committer | 2020-04-06 09:55:49 +0000 | |
commit | e053e0fdfba331a8d17a51c5dc98690ed97b4287 (patch) | |
tree | 6c1894bc0078201e9df9a8f882d7f988d717f648 /usr.bin/mandoc/mdoc_html.c | |
parent | Add utf8.c for asmprintf used by krl.c (diff) | |
download | wireguard-openbsd-e053e0fdfba331a8d17a51c5dc98690ed97b4287.tar.xz wireguard-openbsd-e053e0fdfba331a8d17a51c5dc98690ed97b4287.zip |
Support manual tagging of .Pp, .Bd, .D1, .Dl, .Bl, and .It.
In HTML output, improve the logic for writing inside permalinks:
skip them when there is no child content or when there is a risk
that the children might contain flow content.
Diffstat (limited to 'usr.bin/mandoc/mdoc_html.c')
-rw-r--r-- | usr.bin/mandoc/mdoc_html.c | 35 |
1 files changed, 20 insertions, 15 deletions
diff --git a/usr.bin/mandoc/mdoc_html.c b/usr.bin/mandoc/mdoc_html.c index 5bf9519941f..d55cb75d0ca 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.212 2020/04/01 20:10:17 schwarze Exp $ */ +/* $OpenBSD: mdoc_html.c,v 1.213 2020/04/06 09:55:49 schwarze Exp $ */ /* * Copyright (c) 2014-2020 Ingo Schwarze <schwarze@openbsd.org> * Copyright (c) 2008-2011, 2014 Kristaps Dzonsons <kristaps@bsd.lv> @@ -739,7 +739,7 @@ mdoc_it_pre(MDOC_ARGS) case ROFFT_HEAD: return 0; case ROFFT_BODY: - print_otag(h, TAG_LI, ""); + print_otag_id(h, TAG_LI, NULL, n); break; default: break; @@ -751,7 +751,7 @@ mdoc_it_pre(MDOC_ARGS) case LIST_ohang: switch (n->type) { case ROFFT_HEAD: - print_otag(h, TAG_DT, ""); + print_otag_id(h, TAG_DT, NULL, n); break; case ROFFT_BODY: print_otag(h, TAG_DD, ""); @@ -763,7 +763,7 @@ mdoc_it_pre(MDOC_ARGS) case LIST_tag: switch (n->type) { case ROFFT_HEAD: - print_otag(h, TAG_DT, ""); + print_otag_id(h, TAG_DT, NULL, n); break; case ROFFT_BODY: if (n->child == NULL) { @@ -784,7 +784,7 @@ mdoc_it_pre(MDOC_ARGS) print_otag(h, TAG_TD, ""); break; default: - print_otag(h, TAG_TR, ""); + print_otag_id(h, TAG_TR, NULL, n); } default: break; @@ -850,8 +850,8 @@ mdoc_bl_pre(MDOC_ARGS) case LIST_tag: if (bl->offs) print_otag(h, TAG_DIV, "c", "Bd-indent"); - print_otag(h, TAG_DL, "c", bl->comp ? - "Bl-tag Bl-compact" : "Bl-tag"); + print_otag_id(h, TAG_DL, + bl->comp ? "Bl-tag Bl-compact" : "Bl-tag", n->body); return 1; case LIST_column: elemtype = TAG_TABLE; @@ -864,7 +864,7 @@ mdoc_bl_pre(MDOC_ARGS) (void)strlcat(cattr, " Bd-indent", sizeof(cattr)); if (bl->comp) (void)strlcat(cattr, " Bl-compact", sizeof(cattr)); - print_otag(h, elemtype, "c", cattr); + print_otag_id(h, elemtype, cattr, n->body); return 1; } @@ -896,15 +896,15 @@ mdoc_d1_pre(MDOC_ARGS) switch (n->type) { case ROFFT_BLOCK: html_close_paragraph(h); - break; + return 1; case ROFFT_HEAD: return 0; case ROFFT_BODY: - return 1; + break; default: abort(); } - print_otag(h, TAG_DIV, "c", "Bd Bd-indent"); + print_otag_id(h, TAG_DIV, "Bd Bd-indent", n); if (n->tok == MDOC_Dl) print_otag(h, TAG_CODE, "c", "Li"); return 1; @@ -961,7 +961,7 @@ mdoc_bd_pre(MDOC_ARGS) strcmp(n->norm->Bd.offs, "left") != 0) (void)strlcat(buf, " Bd-indent", sizeof(buf)); - print_otag(h, TAG_DIV, "c", buf); + print_otag_id(h, TAG_DIV, buf, n); return 1; } @@ -1208,11 +1208,16 @@ mdoc_pp_pre(MDOC_ARGS) { if (n->flags & NODE_NOFILL) { print_endline(h); - h->col = 1; - print_endline(h); + if (n->flags & NODE_ID) + mdoc_tg_pre(meta, n, h); + else { + h->col = 1; + print_endline(h); + } } else { html_close_paragraph(h); - print_otag(h, TAG_P, "c", "Pp"); + print_otag(h, TAG_P, "ci", "Pp", + n->flags & NODE_ID ? html_make_id(n, 1) : NULL); } return 0; } |