summaryrefslogtreecommitdiffstats
path: root/usr.bin/mandoc/mdoc_html.c
diff options
context:
space:
mode:
authorschwarze <schwarze@openbsd.org>2018-05-09 00:45:33 +0000
committerschwarze <schwarze@openbsd.org>2018-05-09 00:45:33 +0000
commit2e36b507955d0b84aa7d94510667ff7353018229 (patch)
tree0d45d91b2460d03d2da9d4a781e09abe8a630d91 /usr.bin/mandoc/mdoc_html.c
parentEliminate the class=It-* attributes. (diff)
downloadwireguard-openbsd-2e36b507955d0b84aa7d94510667ff7353018229.tar.xz
wireguard-openbsd-2e36b507955d0b84aa7d94510667ff7353018229.zip
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 'usr.bin/mandoc/mdoc_html.c')
-rw-r--r--usr.bin/mandoc/mdoc_html.c26
1 files changed, 11 insertions, 15 deletions
diff --git a/usr.bin/mandoc/mdoc_html.c b/usr.bin/mandoc/mdoc_html.c
index 6213548f47c..fada6019855 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.174 2018/05/08 21:42:11 schwarze Exp $ */
+/* $OpenBSD: mdoc_html.c,v 1.175 2018/05/09 00:45:33 schwarze Exp $ */
/*
* Copyright (c) 2008-2011, 2014 Kristaps Dzonsons <kristaps@bsd.lv>
* Copyright (c) 2014,2015,2016,2017,2018 Ingo Schwarze <schwarze@openbsd.org>
@@ -581,10 +581,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;
}
@@ -1442,20 +1441,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;
}
@@ -1676,7 +1671,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 ||