diff options
author | Ralph Amissah <ralph@amissah.com> | 2017-04-12 15:23:23 -0400 |
---|---|---|
committer | Ralph Amissah <ralph@amissah.com> | 2019-04-10 15:14:14 -0400 |
commit | da0f051e1aced4fa1fd5cd13c0548279bf04b2a0 (patch) | |
tree | 3c74421c4ce35e28e93512eb01606219e37e0dfb /src/sdp/output_xhtmls.d | |
parent | start work on block outputs (diff) |
0.13.9 sisupod & epub3, zipped output
Diffstat (limited to 'src/sdp/output_xhtmls.d')
-rw-r--r-- | src/sdp/output_xhtmls.d | 120 |
1 files changed, 62 insertions, 58 deletions
diff --git a/src/sdp/output_xhtmls.d b/src/sdp/output_xhtmls.d index 2a86d4c..804b82f 100644 --- a/src/sdp/output_xhtmls.d +++ b/src/sdp/output_xhtmls.d @@ -3,22 +3,26 @@ template outputXHTMLs() { std.algorithm, std.array, std.container, + std.digest.sha, std.exception, std.file, std.getopt, std.json, - std.process, - std.stdio, + std.outbuffer, std.path, + std.process, std.range, std.regex, + std.stdio, std.string, std.traits, std.typecons, std.uni, std.utf, + std.zip, std.conv : to; import + create_zip_file, defaults, output_rgx, output_xhtmls; @@ -30,7 +34,7 @@ template outputXHTMLs() { .replaceAll(rgx.xhtml_ampersand, "&") .replaceAll(rgx.xhtml_less_than, "<") .replaceAll(rgx.xhtml_greater_than, ">") - .replaceAll(rgx.xhtml_line_break, "<br>"); + .replaceAll(rgx.xhtml_line_break, "<br />"); return _txt; } string font_face(string _txt){ @@ -61,7 +65,7 @@ template outputXHTMLs() { auto scroll_head(Me)( Me dochead_meta, ) { - debug(asserts){ + debug(asserts) { static assert(is(typeof(dochead_meta) == string[string][string])); } string o; @@ -69,26 +73,27 @@ template outputXHTMLs() { <html> <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)" /> - <link rel="generator" href="http://www.sisudoc.org/" /> + <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> + <link rel="generator" href="http://www.sisudoc.org/" /> <link rel="shortcut icon" href="../_sisu/image/rb7.ico" /> - <link href="../../_sisu/css/html.css" rel="stylesheet"> - <link href="../../../_sisu/css/html.css" rel="stylesheet"> + <link href="../../_sisu/css/html.css" rel="stylesheet" /> + <link href="../../../_sisu/css/html.css" rel="stylesheet" /> </head> <body lang="en"> <a name="top" id="top"></a>¶", @@ -100,7 +105,7 @@ template outputXHTMLs() { auto seg_head(Me)( Me dochead_meta, ) { - debug(asserts){ + debug(asserts) { static assert(is(typeof(dochead_meta) == string[string][string])); } string o; @@ -108,26 +113,27 @@ template outputXHTMLs() { <html> <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)" /> - <link rel="generator" href="http://www.sisudoc.org/" /> + <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> + <link rel="generator" href="http://www.sisudoc.org/" /> <link rel="shortcut icon" href="../_sisu/image/rb7.ico" /> - <link href="../../_sisu/css/html.css" rel="stylesheet"> - <link href="../../../_sisu/css/html.css" rel="stylesheet"> + <link href="../../_sisu/css/html.css" rel="stylesheet" /> + <link href="../../../_sisu/css/html.css" rel="stylesheet" /> </head> <body lang="en"> <a name="top" id="top"></a>¶", @@ -192,13 +198,13 @@ template outputXHTMLs() { return _txt; } auto inline_notes_scroll(O)( - auto return ref const O obj, - string _txt, + auto return ref const O obj, + string _txt, ) { if (obj.inline_notes_reg) { _txt = (_txt).replaceAll( rgx.inline_notes_delimiter_al_regular_number_note, - ("<a href=\"#note_$1\"><note id=\"noteref_$1\"> <sup>$1</sup> </note></a>") + ("<a href=\"#note_$1\"><note id=\"noteref_$1\"> <sup>$1</sup> </note></a>") ); } debug(markup_endnotes) { @@ -236,7 +242,7 @@ template outputXHTMLs() { "\">", "<note id=\"note_", m.captures[1], - "\"> <sup>", + "\"> <sup>", m.captures[1], ".</sup></note></a>", m.captures[2], @@ -245,7 +251,7 @@ template outputXHTMLs() { } _txt = (_txt).replaceAll( rgx.inline_notes_delimiter_al_regular_number_note, - ("<a href=\"#note_$1\"><note id=\"noteref_$1\"> <sup>$1</sup> </note></a>") + ("<a href=\"#note_$1\"><note id=\"noteref_$1\"> <sup>$1</sup> </note></a>") ); } else if (_txt.match(rgx.inline_notes_delimiter_al_regular_number_note)) { debug(markup) { @@ -301,7 +307,7 @@ template outputXHTMLs() { auto tags = _xhtml_anchor_tags(obj.anchor_tags); string o; if (obj.obj_cite_number.empty) { - o = format(q"¶<br><hr /><br> + o = format(q"¶<br /><hr /><br /> <div class="substance"> <h%s class="%s">%s %s @@ -314,7 +320,7 @@ template outputXHTMLs() { obj.heading_lev_markup, ); } else { - o = format(q"¶<br><hr /><br> + o = format(q"¶<br /><hr /><br /> <div class="substance"> <label class="ocn"><a href="#%s" class="lnkocn">%s</a></label> <h%s class="%s" id="%s"><a name="%s"></a>%s @@ -364,7 +370,7 @@ template outputXHTMLs() { auto tags = _xhtml_anchor_tags(obj.anchor_tags); _txt = font_face(_txt); string o; - _txt = (obj.bullet) ? ("●  " ~ _txt) : _txt; + _txt = (obj.bullet) ? ("●  " ~ _txt) : _txt; if (obj.obj_cite_number.empty) { o = format(q"¶ <div class="substance"> <p class="%s" indent="h%si%s">%s @@ -541,7 +547,6 @@ template outputXHTMLs() { </div>¶", obj.is_a, _txt - // obj.text ); } else { o = format(q"¶ <div class="substance"> @@ -555,7 +560,6 @@ template outputXHTMLs() { obj.is_a, obj.obj_cite_number, _txt - // obj.text ); } return o; @@ -589,9 +593,9 @@ template outputXHTMLs() { ) { _txt = font_face(_txt); _txt = (_txt) - .replaceAll(rgx.newline, "<br>\n") - .replaceAll(rgx.two_spaces, " " ~ " " ~ " " ~ " ") - .replaceAll(rgx.nbsp_and_space, " " ~ " ") + .replaceAll(rgx.newline, "<br />\n") + .replaceAll(rgx.two_spaces, " " ~ " " ~ " " ~ " ") + .replaceAll(rgx.nbsp_and_space, " " ~ " ") .replaceAll(rgx.strip_br, ""); string o; if (obj.obj_cite_number.empty) { @@ -723,8 +727,8 @@ template outputXHTMLs() { ) { string _txt = obj.text; _txt = (_txt) - .replaceAll(rgx.newline, "<br>\n") - .replaceAll(rgx.nbsp_char, " "); + .replaceAll(rgx.newline, "<br />\n") + .replaceAll(rgx.nbsp_char, " "); string o; if (obj.obj_cite_number.empty) { o = format(q"¶ <div class="substance"> |