diff options
Diffstat (limited to 'src/sdp/output_xmls.d')
-rw-r--r-- | src/sdp/output_xmls.d | 112 |
1 files changed, 61 insertions, 51 deletions
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"¶<!DOCTYPE html> <html> @@ -105,19 +102,17 @@ template outputXHTMLs() { <link href="../../css/html.css" rel="stylesheet" /> <link href="../../../css/html.css" rel="stylesheet" /> </head> - <body lang="en"> + <body lang="%s"> <a name="top" id="top"></a>¶", - 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"¶<!DOCTYPE html> <html> @@ -145,57 +140,69 @@ template outputXHTMLs() { <link href="../../css/html.css" rel="stylesheet" /> <link href="../../../css/html.css" rel="stylesheet" /> </head> - <body lang="en"> + <body lang="%s"> <a name="top" id="top"></a>¶", - 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"¶<!DOCTYPE html> + string html_base = format(q"¶<!DOCTYPE html> <html>¶", ); + string html_simple = format(q"¶<!DOCTYPE html> + <html + xmlns="http://www.w3.org/1999/xhtml" + xmlns:epub="http://www.idpf.org/2007/ops" + lang="%s" xml:lang="%s">¶", + doc_matters.language, + doc_matters.language, + ); string html_strict = format(q"¶<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> - <html xmlns="http://www.w3.org/1999/xhtml" lang="en" xml:lang="en">¶", - ); + <html xmlns="http://www.w3.org/1999/xhtml" + xmlns:epub="http://www.idpf.org/2007/ops" + lang="%s" xml:lang="%s">¶", + doc_matters.language, + doc_matters.language, + ); string o; o = format(q"¶%s <head> - <meta charset="utf-8"> - <title> - %s%s - </title> - <meta http-equiv="Content-Type" content="text/html;charset=utf-8" /> - <meta name="dc.title" content="Title" /> - <meta name="dc.author" content="Author" /> - <meta name="dc.publisher" content="SiSU http://www.jus.uio.no/sisu (this copy)" /> - <meta name="dc.date" content="year" /> - <meta name="dc.date.created" content="year" /> - <meta name="dc.date.issued" content="year" /> - <meta name="dc.date.available" content="year" /> - <meta name="dc.date.valid" content="year" /> - <meta name="dc.date.modified" content="year" /> - <meta name="dc.language" content="US" /> - <meta name="dc.rights" content="Copyright: Copyright (C) year holder" /> - <meta name="generator" content="sdp [SiSU 7.1.8 of 2016w08/5 (2016-02-26)] (n*x and D)" /> - </meta> + <title> + %s%s + </title> + <meta http-equiv="Content-Type" content="text/html;charset=utf-8" /> + <meta name="dc.title" content="%s" /> + <meta name="dc.author" content="%s" /> + <meta name="dc.publisher" content="SiSU http://www.jus.uio.no/sisu (this copy)" /> + <meta name="dc.date" content="year" /> + <meta name="dc.date.created" content="year" /> + <meta name="dc.date.issued" content="year" /> + <meta name="dc.date.available" content="year" /> + <meta name="dc.date.valid" content="year" /> + <meta name="dc.date.modified" content="year" /> + <meta name="dc.language" content="US" /> + <meta name="dc.rights" content="Copyright: Copyright (C) year holder" /> + <meta name="generator" content="sdp [SiSU 7.1.8 of 2016w08/5 (2016-02-26)] (n*x and D)" /> <link rel="generator" href="http://www.sisudoc.org/" /> <link rel="shortcut icon" href="../_sisu/image/rb7.ico" /> <link rel="stylesheet" href="css/epub.css" type="text/css" id="main-css" /> </head> - <body lang="en"> + <body lang="%s"> <a name="top" id="top"></a>¶", - 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 = "<hr />"; - 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, |