From 6983e38050a063c02f6d8b440ebb479271d4c17e Mon Sep 17 00:00:00 2001 From: Ingo Schwarze Date: Thu, 14 Aug 2014 00:31:43 +0000 Subject: Revert previous, as requested by kristaps@. The .Bf block can contain subblocks, so it has to render as an element that can contain flow content. But cannot contain flow content, only phrasing content. Rendering .Em and .Bf differently would by unfortunate, and closing out .Bf before subblocks and re-opening it afterwards would merely complicate both the C code of the program and the generated HTML code. Besides, converting .Em to semantic HTML markup would require some content to be put into and some into , but we cannot automatically distinguish which is which, so strictly speaking, we can't use semantic HTML here but have to fall back to physical markup. Wonders of HTML... --- example.style.css | 2 +- html.c | 1 - html.h | 1 - mdoc_html.c | 10 ++++++---- style.css | 2 +- 5 files changed, 8 insertions(+), 8 deletions(-) diff --git a/example.style.css b/example.style.css index 2cb2b632..08cccd2e 100644 --- a/example.style.css +++ b/example.style.css @@ -30,7 +30,7 @@ div.mandoc .list { } /* All Bl. */ div.mandoc i { } /* Italic: BI, IB, I, (implicit). */ div.mandoc b { } /* Bold: SB, BI, IB, BR, RB, B, (implicit). */ div.mandoc small { } /* Small: SB, SM. */ -div.mandoc em { font-style: italic; font-weight: normal; } /* Emphasis: Em, Bl -emphasis. */ +div.mandoc .emph { font-style: italic; font-weight: normal; } /* Emphasis: Em, Bl -emphasis. */ div.mandoc .symb { font-style: normal; font-weight: bold; } /* Symbolic: Sy, Ms, Bf -symbolic. */ div.mandoc .lit { font-style: normal; font-weight: normal; font-family: monospace; } /* Literal: Dl, Li, Ql, Bf -literal, Bl -literal, Bl -unfilled. */ div.mandoc i.addr { font-weight: normal; } /* Address (Ad). */ diff --git a/html.c b/html.c index d5021860..dca66686 100644 --- a/html.c +++ b/html.c @@ -74,7 +74,6 @@ static const struct htmldata htmltags[TAG_MAX] = { {"i", 0 }, /* TAG_I */ {"code", 0 }, /* TAG_CODE */ {"small", 0 }, /* TAG_SMALL */ - {"em", 0 }, /* TAG_EM */ }; static const char *const htmlattrs[ATTR_MAX] = { diff --git a/html.h b/html.h index 456084ed..0547c597 100644 --- a/html.h +++ b/html.h @@ -50,7 +50,6 @@ enum htmltag { TAG_I, TAG_CODE, TAG_SMALL, - TAG_EM, TAG_MAX }; diff --git a/mdoc_html.c b/mdoc_html.c index 86c48b24..5c26f7ea 100644 --- a/mdoc_html.c +++ b/mdoc_html.c @@ -1083,8 +1083,10 @@ mdoc_ex_pre(MDOC_ARGS) static int mdoc_em_pre(MDOC_ARGS) { + struct htmlpair tag; - print_otag(h, TAG_EM, 0, NULL); + PAIR_CLASS_INIT(&tag, "emph"); + print_otag(h, TAG_SPAN, 1, &tag); return(1); } @@ -1820,7 +1822,9 @@ mdoc_bf_pre(MDOC_ARGS) else if (MDOC_BODY != n->type) return(1); - if (FONT_Sy == n->norm->Bf.font) + if (FONT_Em == n->norm->Bf.font) + PAIR_CLASS_INIT(&tag[0], "emph"); + else if (FONT_Sy == n->norm->Bf.font) PAIR_CLASS_INIT(&tag[0], "symb"); else if (FONT_Li == n->norm->Bf.font) PAIR_CLASS_INIT(&tag[0], "lit"); @@ -1838,8 +1842,6 @@ mdoc_bf_pre(MDOC_ARGS) bufcat_su(h, "margin-left", &su); PAIR_STYLE_INIT(&tag[1], h); print_otag(h, TAG_DIV, 2, tag); - if (FONT_Em == n->norm->Bf.font) - print_otag(h, TAG_EM, 0, NULL); return(1); } diff --git a/style.css b/style.css index 79114ac9..dcc49a7c 100644 --- a/style.css +++ b/style.css @@ -34,7 +34,7 @@ td.head-rtitle { width: 10%; text-align: right; } /* Document header: right-titl /* General font modes. */ i { } /* Italic: BI, IB, I, (implicit). */ -em { font-style: italic; font-weight: normal; } /* Emphasis: Em, Bl -emphasis. */ +.emph { font-style: italic; font-weight: normal; } /* Emphasis: Em, Bl -emphasis. */ b { } /* Bold: SB, BI, IB, BR, RB, B, (implicit). */ .symb { font-style: normal; font-weight: bold; } /* Symbolic: Sy, Ms, Bf -symbolic. */ small { } /* Small: SB, SM. */ -- cgit