diff options
author | Ingo Schwarze <schwarze@openbsd.org> | 2018-05-09 00:46:10 +0000 |
---|---|---|
committer | Ingo Schwarze <schwarze@openbsd.org> | 2018-05-09 00:46:10 +0000 |
commit | 89fd4377ad43e25cfc8c8a1209a6a755e31f396c (patch) | |
tree | ca4a5a4056e029683a75904e9fa3e7feabb217cb /mdoc_html.c | |
parent | 11a29592a98a34719ad7bda3dcb43f50af04d6a5 (diff) | |
download | mandoc-89fd4377ad43e25cfc8c8a1209a6a755e31f396c.tar.gz |
Fix a long-standing issue:
Some macros (Nd, Oo) can contain blocks but rendered as elements that
can only contain phrasing content, resulting in invalid HTML nesting.
Switch them to <div>.
Also move the related "display: inline" style from the HTML to the CSS.
Reminded during a conversation with John Gardner.
Diffstat (limited to 'mdoc_html.c')
-rw-r--r-- | mdoc_html.c | 24 |
1 files changed, 10 insertions, 14 deletions
diff --git a/mdoc_html.c b/mdoc_html.c index e0cf7416..3a78913e 100644 --- a/mdoc_html.c +++ b/mdoc_html.c @@ -583,10 +583,9 @@ mdoc_nd_pre(MDOC_ARGS) if (n->type != ROFFT_BODY) return 1; - /* XXX: this tag in theory can contain block elements. */ - print_text(h, "\\(em"); - print_otag(h, TAG_SPAN, "cT", "Nd"); + /* Cannot use TAG_SPAN because it may contain blocks. */ + print_otag(h, TAG_DIV, "cT", "Nd"); return 1; } @@ -1444,20 +1443,16 @@ mdoc_bf_pre(MDOC_ARGS) return 1; if (FONT_Em == n->norm->Bf.font) - cattr = "Em"; + cattr = "Bf Em"; else if (FONT_Sy == n->norm->Bf.font) - cattr = "Sy"; + cattr = "Bf Sy"; else if (FONT_Li == n->norm->Bf.font) - cattr = "Li"; + cattr = "Bf Li"; else - cattr = "No"; - - /* - * We want this to be inline-formatted, but needs to be div to - * accept block children. - */ + cattr = "Bf No"; - print_otag(h, TAG_DIV, "css?hl", cattr, "display", "inline", 1); + /* Cannot use TAG_SPAN because it may contain blocks. */ + print_otag(h, TAG_DIV, "cshl", cattr, 1); return 1; } @@ -1678,7 +1673,8 @@ mdoc_quote_pre(MDOC_ARGS) case MDOC_Op: print_text(h, "\\(lB"); h->flags |= HTML_NOSPACE; - print_otag(h, TAG_SPAN, "c", "Op"); + /* Cannot use TAG_SPAN because it may contain blocks. */ + print_otag(h, TAG_IDIV, "c", "Op"); break; case MDOC_En: if (NULL == n->norm->Es || |