* mandoc: Fix a long-standing issue: Some macros (Nd, Oo) can contain
@ 2018-05-09 0:46 schwarze
0 siblings, 0 replies; only message in thread
From: schwarze @ 2018-05-09 0:46 UTC (permalink / raw)
To: source
Log Message:
-----------
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.
Modified Files:
--------------
mandoc:
html.c
html.h
mandoc.css
mdoc_html.c
Revision Data
-------------
Index: mdoc_html.c
===================================================================
RCS file: /home/cvs/mandoc/mandoc/mdoc_html.c,v
retrieving revision 1.299
retrieving revision 1.300
diff -Lmdoc_html.c -Lmdoc_html.c -u -p -r1.299 -r1.300
--- mdoc_html.c
+++ 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 ||
Index: html.h
===================================================================
RCS file: /home/cvs/mandoc/mandoc/html.h,v
retrieving revision 1.88
retrieving revision 1.89
diff -Lhtml.h -Lhtml.h -u -p -r1.88 -r1.89
--- html.h
+++ html.h
@@ -23,6 +23,7 @@ enum htmltag {
TAG_META,
TAG_TITLE,
TAG_DIV,
+ TAG_IDIV,
TAG_H1,
TAG_H2,
TAG_SPAN,
Index: html.c
===================================================================
RCS file: /home/cvs/mandoc/mandoc/html.c,v
retrieving revision 1.224
retrieving revision 1.225
diff -Lhtml.c -Lhtml.c -u -p -r1.224 -r1.225
--- html.c
+++ html.c
@@ -59,6 +59,7 @@ static const struct htmldata htmltags[TA
{"meta", HTML_NOSTACK | HTML_AUTOCLOSE | HTML_NLALL},
{"title", HTML_NLAROUND},
{"div", HTML_NLAROUND},
+ {"div", 0},
{"h1", HTML_NLAROUND},
{"h2", HTML_NLAROUND},
{"span", 0},
@@ -186,6 +187,8 @@ print_gen_head(struct html *h)
print_text(h, "td.head-vol { text-align: center; }");
print_endline(h);
print_text(h, "div.Pp { margin: 1ex 0ex; }");
+ print_endline(h);
+ print_text(h, "div.Nd, div.Bf, div.Op { display: inline; }");
print_endline(h);
print_text(h, "dl.Bl-diag ");
print_byte(h, '>');
Index: mandoc.css
===================================================================
RCS file: /home/cvs/mandoc/mandoc/mandoc.css,v
retrieving revision 1.25
retrieving revision 1.26
diff -Lmandoc.css -Lmandoc.css -u -p -r1.25 -r1.26
--- mandoc.css
+++ mandoc.css
@@ -41,7 +41,7 @@ table.head { width: 100%;
td.head-vol { text-align: center; }
td.head-rtitle {
text-align: right; }
-span.Nd { }
+div.Nd { display: inline; }
table.foot { width: 100%;
border-top: 1px dotted #808080;
@@ -164,7 +164,7 @@ code.Cm { font-style: normal;
font-family: inherit; }
var.Ar { font-style: italic;
font-weight: normal; }
-span.Op { }
+div.Op { display: inline; }
code.Ic { font-style: normal;
font-weight: bold;
font-family: inherit; }
@@ -216,6 +216,7 @@ a.Ux { }
/* Physical markup. */
+.Bf { display: inline; }
.No { font-style: normal;
font-weight: normal; }
.Em { font-style: italic;
--
To unsubscribe send an email to source+unsubscribe@mandoc.bsd.lv
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2018-05-09 0:46 UTC | newest]
Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-05-09 0:46 mandoc: Fix a long-standing issue: Some macros (Nd, Oo) can contain schwarze
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).