From a9a46fca7397aaa357bfdc2b98e181617bb6887b Mon Sep 17 00:00:00 2001 From: Ralph Amissah Date: Mon, 1 May 2017 18:46:11 -0400 Subject: xmls work particularly with epub output --- src/sdp/output_xmls.d | 112 +++++++++++++++++++++++++++----------------------- 1 file changed, 61 insertions(+), 51 deletions(-) (limited to 'src/sdp/output_xmls.d') diff --git a/src/sdp/output_xmls.d b/src/sdp/output_xmls.d index 347409e..78ee414 100644 --- a/src/sdp/output_xmls.d +++ b/src/sdp/output_xmls.d @@ -72,12 +72,9 @@ template outputXHTMLs() { } return tags; } - auto html_scroll_head(Me)( - Me dochead_meta, + auto html_scroll_head(Dm)( + Dm doc_matters, ) { - debug(asserts) { - static assert(is(typeof(dochead_meta) == string[string][string])); - } string o; o = format(q"¶ @@ -105,19 +102,17 @@ template outputXHTMLs() { - + ¶", - dochead_meta["title"]["full"], - (dochead_meta["creator"]["author"].empty) ? "" : ", " ~ dochead_meta["creator"]["author"], - ); + doc_matters.dochead_meta["title"]["full"], + (doc_matters.dochead_meta["creator"]["author"].empty) ? "" : ", " ~ doc_matters.dochead_meta["creator"]["author"], + doc_matters.language, + ); return o; } - auto html_seg_head(Me)( - Me dochead_meta, + auto html_seg_head(Dm)( + Dm doc_matters, ) { - debug(asserts) { - static assert(is(typeof(dochead_meta) == string[string][string])); - } string o; o = format(q"¶ @@ -145,57 +140,69 @@ template outputXHTMLs() { - + ¶", - dochead_meta["title"]["full"], - (dochead_meta["creator"]["author"].empty) ? "" : ", " ~ dochead_meta["creator"]["author"], - ); + doc_matters.dochead_meta["title"]["full"], + (doc_matters.dochead_meta["creator"]["author"].empty) ? "" + : ", " ~ doc_matters.dochead_meta["creator"]["author"], + doc_matters.language, + ); return o; } - auto epub3_seg_head(Me)( - Me dochead_meta, + auto epub3_seg_head(Dm)( + Dm doc_matters, ) { - debug(asserts) { - static assert(is(typeof(dochead_meta) == string[string][string])); - } - string html_simple = format(q"¶ + string html_base = format(q"¶ ¶", ); + string html_simple = format(q"¶ + ¶", + doc_matters.language, + doc_matters.language, + ); string html_strict = format(q"¶ - ¶", - ); + ¶", + doc_matters.language, + doc_matters.language, + ); string o; o = format(q"¶%s - - - %s%s - - - - - - - - - - - - - - - + + %s%s + + + + + + + + + + + + + + - + ¶", - html_strict, - dochead_meta["title"]["full"], - (dochead_meta["creator"]["author"].empty) ? "" : ", " ~ dochead_meta["creator"]["author"], - ); + html_simple, + doc_matters.dochead_meta["title"]["full"], + (doc_matters.dochead_meta["creator"]["author"].empty) ? "" : ", " ~ doc_matters.dochead_meta["creator"]["author"], + doc_matters.dochead_meta["title"]["full"], + (doc_matters.dochead_meta["creator"]["author"].empty) ? "" : ", " ~ doc_matters.dochead_meta["creator"]["author"], + doc_matters.language, + ); return o; } auto tail() { @@ -357,10 +364,12 @@ template outputXHTMLs() { auto heading(O)( auto return ref const O obj, string _txt, + string _type="html", ) { auto tags = _xhtml_anchor_tags(obj.anchor_tags); string _horizontal_rule = "
"; - if (obj.heading_lev_markup == 0) { + if ((_type != "html") + || (obj.heading_lev_markup == 0 || obj.heading_lev_markup > 4)) { _horizontal_rule = ""; } string o; @@ -414,11 +423,12 @@ template outputXHTMLs() { auto return ref const O obj, string _txt, string _suffix = ".html", + string _type = "html", ) { auto t = inline_markup_seg(obj, _txt, _suffix); _txt = t[0]; string[] _endnotes = t[1]; - string o = heading(obj, _txt); + string o = heading(obj, _txt, _type); auto u = tuple( o, _endnotes, -- cgit v1.2.3