diff options
Diffstat (limited to 'src/sdp/output_html.d')
-rw-r--r-- | src/sdp/output_html.d | 289 |
1 files changed, 159 insertions, 130 deletions
diff --git a/src/sdp/output_html.d b/src/sdp/output_html.d index 9b8fc86..d356ee5 100644 --- a/src/sdp/output_html.d +++ b/src/sdp/output_html.d @@ -17,9 +17,10 @@ template outputHTML() { std.typecons, std.uni, std.utf, - defaults; + std.conv : to; import - ao_rgx, + defaults, + output_rgx, output_xhtmls; mixin outputXHTMLs; @@ -27,11 +28,12 @@ template outputHTML() { auto return ref const D doc_abstraction, auto return ref I doc_matters, ) { - mixin SiSUrgxInit; + mixin SiSUoutputRgxInit; auto xhtml_format = outputXHTMLs(); auto rgx = Rgx(); string[] doc_html; string[] doc; + string suffix = ".html"; foreach (part; doc_matters.keys_seq_scroll) { foreach (obj; doc_abstraction[part]) { switch (obj.use) { @@ -40,10 +42,10 @@ template outputHTML() { case "para": switch (obj.is_a) { case "heading": - doc_html ~= xhtml_format.heading(obj); + doc_html ~= xhtml_format.heading_scroll(obj, suffix); break; case "toc": - doc_html ~= xhtml_format.toc(obj); + doc_html ~= xhtml_format.para_scroll(obj, suffix); break; default: if ((doc_matters.opt_action_bool["debug"])) { @@ -64,10 +66,10 @@ template outputHTML() { case "para": switch (obj.is_a) { case "heading": - doc_html ~= xhtml_format.heading(obj); + doc_html ~= xhtml_format.heading_scroll(obj, suffix); break; case "para": - doc_html ~= xhtml_format.para(obj); + doc_html ~= xhtml_format.para_scroll(obj, suffix); break; default: if ((doc_matters.opt_action_bool["debug"])) { @@ -93,7 +95,7 @@ template outputHTML() { doc_html ~= xhtml_format.nugget(obj); break; case "table": - doc_html ~= xhtml_format.para(obj); // + doc_html ~= xhtml_format.para_scroll(obj, suffix); break; case "code": doc_html ~= xhtml_format.code(obj); @@ -117,22 +119,22 @@ template outputHTML() { case "para": switch (obj.is_a) { case "heading": - doc_html ~= xhtml_format.heading(obj); + doc_html ~= xhtml_format.heading_scroll(obj, suffix); break; case "endnote": - doc_html ~= xhtml_format.endnote(obj); + doc_html ~= xhtml_format.para_scroll(obj, suffix); break; case "glossary": - doc_html ~= xhtml_format.para(obj); + doc_html ~= xhtml_format.para_scroll(obj, suffix); break; case "bibliography": - doc_html ~= xhtml_format.para(obj); + doc_html ~= xhtml_format.para_scroll(obj, suffix); break; case "bookindex": - doc_html ~= xhtml_format.para(obj); + doc_html ~= xhtml_format.para_scroll(obj, suffix); break; case "blurb": - doc_html ~= xhtml_format.para(obj); + doc_html ~= xhtml_format.para_scroll(obj, suffix); break; default: if ((doc_matters.opt_action_bool["debug"])) { @@ -153,6 +155,8 @@ template outputHTML() { default: if ((doc_matters.opt_action_bool["debug"])) { writeln(__FILE__, ":", __LINE__, ": ", obj.use); + writeln(__FILE__, ":", __LINE__, ": ", obj.is_a); + writeln(__FILE__, ":", __LINE__, ": ", obj.text); } break; } @@ -188,13 +192,15 @@ template outputHTML() { auto return ref const D doc_abstraction, auto return ref I doc_matters, ) { - mixin SiSUrgxInit; + mixin SiSUoutputRgxInit; auto rgx = Rgx(); auto xhtml_format = outputXHTMLs(); string[][string] doc_html; + string[][string] doc_html_endnotes; string[] doc; string segment_filename; string[] top_level_headings = ["","","",""]; + string suffix = ".html"; foreach (part; doc_matters.keys_seq_seg) { foreach (obj; doc_abstraction[part]) { if (obj.is_a == "heading") { // all headings: frontmatter, body & backmatter @@ -221,7 +227,8 @@ template outputHTML() { top_level_headings[3] = ""; goto default; default: - top_level_headings[obj.heading_lev_markup] = xhtml_format.heading(obj); + auto t = xhtml_format.heading_seg(obj, suffix); + top_level_headings[obj.heading_lev_markup] = t[0]; break; } break; @@ -231,10 +238,14 @@ template outputHTML() { foreach (top_level_heading; top_level_headings) { doc_html[segment_filename] ~= top_level_heading; } - doc_html[segment_filename] ~= xhtml_format.heading(obj); + auto t = xhtml_format.heading_seg(obj, suffix); + doc_html[segment_filename] ~= to!string(t[0]); + doc_html_endnotes[segment_filename] ~= t[1]; break; case 5: .. case 7: - doc_html[segment_filename] ~= xhtml_format.heading(obj); + auto t = xhtml_format.heading_seg(obj, suffix); + doc_html[segment_filename] ~= to!string(t[0]); + doc_html_endnotes[segment_filename] ~= t[1]; break; case 8: .. case 9: // unused numbers, if remain check if ((doc_matters.opt_action_bool["debug"])) { @@ -255,7 +266,8 @@ template outputHTML() { case "para": switch (obj.is_a) { case "toc": - doc_html[segment_filename] ~= xhtml_format.toc(obj); + auto t = xhtml_format.para_seg(obj, suffix); + doc_html[segment_filename] ~= to!string(t[0]); break; default: if ((doc_matters.opt_action_bool["debug"])) { @@ -276,7 +288,9 @@ template outputHTML() { case "para": switch (obj.is_a) { case "para": - doc_html[segment_filename] ~= xhtml_format.para(obj); + auto t = xhtml_format.para_seg(obj, suffix); + doc_html[segment_filename] ~= to!string(t[0]); + doc_html_endnotes[segment_filename] ~= t[1]; break; default: if ((doc_matters.opt_action_bool["debug"])) { @@ -302,7 +316,9 @@ template outputHTML() { doc_html[segment_filename] ~= xhtml_format.nugget(obj); break; case "table": - doc_html[segment_filename] ~= xhtml_format.para(obj); + auto t = xhtml_format.para_seg(obj, suffix); + doc_html[segment_filename] ~= t[0]; + doc_html_endnotes[segment_filename] ~= t[1]; break; case "code": doc_html[segment_filename] ~= xhtml_format.code(obj); @@ -326,19 +342,28 @@ template outputHTML() { case "para": switch (obj.is_a) { case "endnote": - doc_html[segment_filename] ~= xhtml_format.endnote(obj); + auto t = xhtml_format.para_seg(obj, suffix); + doc_html[segment_filename] ~= t[0]; break; case "glossary": - doc_html[segment_filename] ~= xhtml_format.para(obj); + auto t = xhtml_format.para_seg(obj, suffix); + doc_html[segment_filename] ~= t[0]; + doc_html_endnotes[segment_filename] ~= t[1]; break; case "bibliography": - doc_html[segment_filename] ~= xhtml_format.para(obj); + auto t = xhtml_format.para_seg(obj, suffix); + doc_html[segment_filename] ~= t[0]; + doc_html_endnotes[segment_filename] ~= t[1]; break; case "bookindex": - doc_html[segment_filename] ~= xhtml_format.para(obj); + auto t = xhtml_format.para_seg(obj, suffix); + doc_html[segment_filename] ~= t[0]; + doc_html_endnotes[segment_filename] ~= t[1]; break; case "blurb": - doc_html[segment_filename] ~= xhtml_format.para(obj); + auto t = xhtml_format.para_seg(obj, suffix); + doc_html[segment_filename] ~= t[0]; + doc_html_endnotes[segment_filename] ~= t[1]; break; default: if ((doc_matters.opt_action_bool["debug"])) { @@ -365,16 +390,17 @@ template outputHTML() { } } } - seg_write_output(doc_matters, doc_html); + seg_write_output(doc_matters, doc_html, doc_html_endnotes); } - void seg_write_output(M,C)( + void seg_write_output(M,D,E)( M doc_matters, - C doc_html, + D doc_html, + E doc_html_endnotes, ) { debug(asserts){ static assert(is(typeof(doc_html) == string[][string])); } - mixin SiSUrgxInit; + mixin SiSUoutputRgxInit; auto rgx = Rgx(); mixin SiSUpaths; auto pth_html = HtmlPaths(); @@ -389,6 +415,9 @@ template outputHTML() { foreach (docseg; doc_html[seg_filename]) { f.writeln(docseg); } + foreach (docseg; doc_html_endnotes[seg_filename]) { + f.writeln(docseg); + } f.writeln(xhtml_format.tail); // needed for each lev4 } } @@ -517,403 +546,403 @@ template outputHTML() { p.i8 {padding-left: 8em;} p.i9 {padding-left: 9em;} /* hanging indent */ - p.h0i0 { + p[indent=\"h0i0\"] { padding-left: 0em; text-indent: 0em; } - p.h0i1 { + p[indent=\"h0i1\"] { padding-left: 1em; text-indent: -1em; } - p.h0i2 { + p[indent=\"h0i2\"] { padding-left: 2em; text-indent: -2em; } - p.h0i3 { + p[indent=\"h0i3\"] { padding-left: 3em; text-indent: -3em; } - p.h0i4 { + p[indent=\"h0i4\"] { padding-left: 4em; text-indent: -4em; } - p.h0i5 { + p[indent=\"h0i5\"] { padding-left: 5em; text-indent: -5em; } - p.h0i6 { + p[indent=\"h0i6\"] { padding-left: 6em; text-indent: -6em; } - p.h0i7 { + p[indent=\"h0i7\"] { padding-left: 7em; text-indent: -7em; } - p.h0i8 { + p[indent=\"h0i8\"] { padding-left: 8em; text-indent: -8em; } - p.h0i9 { + p[indent=\"h0i9\"] { padding-left: 9em; text-indent: -9em; } - p.h1i0 { + p[indent=\"h1i0\"] { padding-left: 0em; text-indent: 1em; } - p.h1i1 { + p[indent=\"h1i1\"] { padding-left: 1em; text-indent: 0em; } - p.h1i2 { + p[indent=\"h1i2\"] { padding-left: 2em; text-indent: -1em; } - p.h1i3 { + p[indent=\"h1i3\"] { padding-left: 3em; text-indent: -2em; } - p.h1i4 { + p[indent=\"h1i4\"] { padding-left: 4em; text-indent: -3em; } - p.h1i5 { + p[indent=\"h1i5\"] { padding-left: 5em; text-indent: -4em; } - p.h1i6 { + p[indent=\"h1i6\"] { padding-left: 6em; text-indent: -5em; } - p.h1i7 { + p[indent=\"h1i7\"] { padding-left: 7em; text-indent: -6em; } - p.h1i8 { + p[indent=\"h1i8\"] { padding-left: 8em; text-indent: -7em; } - p.h1i9 { + p[indent=\"h1i9\"] { padding-left: 9em; text-indent: -8em; } - p.h2i0 { + p[indent=\"h2i0\"] { padding-left: 0em; text-indent: 2em; } - p.h2i1 { + p[indent=\"h2i1\"] { padding-left: 1em; text-indent: 1em; } - p.h2i2 { + p[indent=\"h2i2\"] { padding-left: 2em; text-indent: 0em; } - p.h2i3 { + p[indent=\"h2i3\"] { padding-left: 3em; text-indent: -1em; } - p.h2i4 { + p[indent=\"h2i4\"] { padding-left: 4em; text-indent: -2em; } - p.h2i5 { + p[indent=\"h2i5\"] { padding-left: 5em; text-indent: -3em; } - p.h2i6 { + p[indent=\"h2i6\"] { padding-left: 6em; text-indent: -4em; } - p.h2i7 { + p[indent=\"h2i7\"] { padding-left: 7em; text-indent: -5em; } - p.h2i8 { + p[indent=\"h2i8\"] { padding-left: 8em; text-indent: -6em; } - p.h2i9 { + p[indent=\"h2i9\"] { padding-left: 9em; text-indent: -7em; } - p.h3i0 { + p[indent=\"h3i0\"] { padding-left: 0em; text-indent: 3em; } - p.h3i1 { + p[indent=\"h3i1\"] { padding-left: 1em; text-indent: 2em; } - p.h3i2 { + p[indent=\"h3i2\"] { padding-left: 2em; text-indent: 1em; } - p.h3i3 { + p[indent=\"h3i3\"] { padding-left: 3em; text-indent: 0em; } - p.h3i4 { + p[indent=\"h3i4\"] { padding-left: 4em; text-indent: -1em; } - p.h3i5 { + p[indent=\"h3i5\"] { padding-left: 5em; text-indent: -2em; } - p.h3i6 { + p[indent=\"h3i6\"] { padding-left: 6em; text-indent: -3em; } - p.h3i7 { + p[indent=\"h3i7\"] { padding-left: 7em; text-indent: -4em; } - p.h3i8 { + p[indent=\"h3i8\"] { padding-left: 8em; text-indent: -5em; } - p.h3i9 { + p[indent=\"h3i9\"] { padding-left: 9em; text-indent: -6em; } - p.h4i0 { + p[indent=\"h4i0\"] { padding-left: 0em; text-indent: 4em; } - p.h4i1 { + p[indent=\"h4i1\"] { padding-left: 1em; text-indent: 3em; } - p.h4i2 { + p[indent=\"h4i2\"] { padding-left: 2em; text-indent: 2em; } - p.h4i3 { + p[indent=\"h4i3\"] { padding-left: 3em; text-indent: 1em; } - p.h4i4 { + p[indent=\"h4i4\"] { padding-left: 4em; text-indent: 0em; } - p.h4i5 { + p[indent=\"h4i5\"] { padding-left: 5em; text-indent: -1em; } - p.h4i6 { + p[indent=\"h4i6\"] { padding-left: 6em; text-indent: -2em; } - p.h4i7 { + p[indent=\"h4i7\"] { padding-left: 7em; text-indent: -3em; } - p.h4i8 { + p[indent=\"h4i8\"] { padding-left: 8em; text-indent: -4em; } - p.h4i9 { + p[indent=\"h4i9\"] { padding-left: 9em; text-indent: -5em; } - p.h5i0 { + p[indent=\"h5i0\"] { padding-left: 0em; text-indent: 5em; } - p.h5i1 { + p[indent=\"h5i1\"] { padding-left: 1em; text-indent: 4em; } - p.h5i2 { + p[indent=\"h5i2\"] { padding-left: 2em; text-indent: 3em; } - p.h5i3 { + p[indent=\"h5i3\"] { padding-left: 3em; text-indent: 2em; } - p.h5i4 { + p[indent=\"h5i4\"] { padding-left: 4em; text-indent: 1em; } - p.h5i5 { + p[indent=\"h5i5\"] { padding-left: 5em; text-indent: 0em; } - p.h5i6 { + p[indent=\"h5i6\"] { padding-left: 6em; text-indent: -1em; } - p.h5i7 { + p[indent=\"h5i7\"] { padding-left: 7em; text-indent: -2em; } - p.h5i8 { + p[indent=\"h5i8\"] { padding-left: 8em; text-indent: -3em; } - p.h5i9 { + p[indent=\"h5i9\"] { padding-left: 9em; text-indent: -4em; } - p.h6i0 { + p[indent=\"h6i0\"] { padding-left: 0em; text-indent: 6em; } - p.h6i1 { + p[indent=\"h6i1\"] { padding-left: 1em; text-indent: 5em; } - p.h6i2 { + p[indent=\"h6i2\"] { padding-left: 2em; text-indent: 4em; } - p.h6i3 { + p[indent=\"h6i3\"] { padding-left: 3em; text-indent: 3em; } - p.h6i4 { + p[indent=\"h6i4\"] { padding-left: 4em; text-indent: 2em; } - p.h6i5 { + p[indent=\"h6i5\"] { padding-left: 5em; text-indent: 1em; } - p.h6i6 { + p[indent=\"h6i6\"] { padding-left: 6em; text-indent: 0em; } - p.h6i7 { + p[indent=\"h6i7\"] { padding-left: 7em; text-indent: -1em; } - p.h6i8 { + p[indent=\"h6i8\"] { padding-left: 8em; text-indent: -2em; } - p.h6i9 { + p[indent=\"h6i9\"] { padding-left: 9em; text-indent: -3em; } - p.h7i0 { + p[indent=\"h7i0\"] { padding-left: 0em; text-indent: 7em; } - p.h7i1 { + p[indent=\"h7i1\"] { padding-left: 1em; text-indent: 6em; } - p.h7i2 { + p[indent=\"h7i2\"] { padding-left: 2em; text-indent: 5em; } - p.h7i3 { + p[indent=\"h7i3\"] { padding-left: 3em; text-indent: 4em; } - p.h7i4 { + p[indent=\"h7i4\"] { padding-left: 4em; text-indent: 3em; } - p.h7i5 { + p[indent=\"h7i5\"] { padding-left: 5em; text-indent: 2em; } - p.h7i6 { + p[indent=\"h7i6\"] { padding-left: 6em; text-indent: 1em; } - p.h7i7 { + p[indent=\"h7i7\"] { padding-left: 7em; text-indent: 0em; } - p.h7i8 { + p[indent=\"h7i8\"] { padding-left: 8em; text-indent: -1em; } - p.h7i9 { + p[indent=\"h7i9\"] { padding-left: 9em; text-indent: -2em; } - p.h8i0 { + p[indent=\"h8i0\"] { padding-left: 0em; text-indent: 8em; } - p.h8i1 { + p[indent=\"h8i1\"] { padding-left: 1em; text-indent: 7em; } - p.h8i2 { + p[indent=\"h8i2\"] { padding-left: 2em; text-indent: 6em; } - p.h8i3 { + p[indent=\"h8i3\"] { padding-left: 3em; text-indent: 5em; } - p.h8i4 { + p[indent=\"h8i4\"] { padding-left: 4em; text-indent: 4em; } - p.h8i5 { + p[indent=\"h8i5\"] { padding-left: 5em; text-indent: 3em; } - p.h8i6 { + p[indent=\"h8i6\"] { padding-left: 6em; text-indent: 2em; } - p.h8i7 { + p[indent=\"h8i7\"] { padding-left: 7em; text-indent: 1em; } - p.h8i8 { + p[indent=\"h8i8\"] { padding-left: 8em; text-indent: 0em; } - p.h8i9 { + p[indent=\"h8i9\"] { padding-left: 9em; text-indent: -1em; } - p.h9i0 { + p[indent=\"h9i0\"] { padding-left: 0em; text-indent: 9em; } - p.h9i1 { + p[indent=\"h9i1\"] { padding-left: 1em; text-indent: 8em; } - p.h9i2 { + p[indent=\"h9i2\"] { padding-left: 2em; text-indent: 7em; } - p.h9i3 { + p[indent=\"h9i3\"] { padding-left: 3em; text-indent: 6em; } - p.h9i4 { + p[indent=\"h9i4\"] { padding-left: 4em; text-indent: 5em; } - p.h9i5 { + p[indent=\"h9i5\"] { padding-left: 5em; text-indent: 4em; } - p.h9i6 { + p[indent=\"h9i6\"] { padding-left: 6em; text-indent: 3em; } - p.h9i7 { + p[indent=\"h9i7\"] { padding-left: 7em; text-indent: 2em; } - p.h9i8 { + p[indent=\"h9i8\"] { padding-left: 8em; text-indent: 1em; } - p.h9i9 { + p[indent=\"h9i9\"] { padding-left: 9em; text-indent: 0em; } |