diff options
author | Ralph Amissah <ralph.amissah@gmail.com> | 2025-02-19 15:25:45 -0500 |
---|---|---|
committer | Ralph Amissah <ralph.amissah@gmail.com> | 2025-02-19 15:25:48 -0500 |
commit | 1b311d6f2246d29c3a99da5c40f1558bc83049a9 (patch) | |
tree | 96510bdbc971609ba0c11da9f588fb43c2322860 /org/out_xmls.org | |
parent | document (metadata & abstraction) struct (diff) |
doc (metadata & abstraction) struct follow through
Diffstat (limited to 'org/out_xmls.org')
-rw-r--r-- | org/out_xmls.org | 273 |
1 files changed, 130 insertions, 143 deletions
diff --git a/org/out_xmls.org b/org/out_xmls.org index b3b16d7..8d0b475 100644 --- a/org/out_xmls.org +++ b/org/out_xmls.org @@ -1766,10 +1766,7 @@ module sisudoc.io_out.html; template outputHTML() { <<output_imports_xml>> mixin outputXHTMLs; - void scroll(D,M)( - const D doc_abstraction, - M doc_matters, - ) { + void scroll(D)(D doc) { <<output_html_scroll_0>> <<output_html_scroll_loop_parts>> <<output_html_scroll_is_frontmatter>> @@ -1778,10 +1775,7 @@ template outputHTML() { <<output_html_scroll_close_is_case>> } <<output_html_scroll_scroll_write_output>> - void seg(D,M)( - const D doc_abstraction, - M doc_matters, - ) { + void seg(D)(D doc) { <<output_html_seg_0>> <<output_html_seg_loop_parts>> <<output_html_seg_is_heading>> @@ -1808,7 +1802,7 @@ auto xhtml_format = outputXHTMLs(); static auto rgx = RgxO(); static auto rgx_xhtml = RgxXHTML(); string[] doc_html; -string[] doc; +string[] doc_out; string suffix = ".html"; string previous_section = ""; string delimit = ""; @@ -1818,8 +1812,8 @@ string delimit = ""; #+NAME: output_html_scroll_loop_parts #+BEGIN_SRC d -foreach (section; doc_matters.has.keys_seq.scroll) { - foreach (obj; doc_abstraction[section]) { +foreach (section; doc.matters.has.keys_seq.scroll) { + foreach (obj; doc.abstraction[section]) { delimit = xhtml_format.div_delimit(section, previous_section); string _txt = xhtml_format.special_characters_breaks_indents_bullets(obj); switch (obj.metainfo.is_of_part) { @@ -1834,14 +1828,14 @@ case "frontmatter": assert(section == "head" || "toc"); case "para": switch (obj.metainfo.is_a) { case "heading": - doc_html ~= delimit ~ xhtml_format.heading_scroll(_txt, obj, doc_matters, suffix); + doc_html ~= delimit ~ xhtml_format.heading_scroll(_txt, obj, doc.matters, suffix); break; case "toc": - doc_html ~= xhtml_format.para_scroll(_txt, obj, doc_matters, suffix); + doc_html ~= xhtml_format.para_scroll(_txt, obj, doc.matters, suffix); break; default: { /+ debug +/ - if (doc_matters.opt.action.debug_do_html) { + if (doc.matters.opt.action.debug_do_html) { writeln(__FILE__, ":", __LINE__, ": ", obj.metainfo.is_a); } } @@ -1850,7 +1844,7 @@ case "frontmatter": assert(section == "head" || "toc"); break; default: { /+ debug +/ - if (doc_matters.opt.action.debug_do_html) { + if (doc.matters.opt.action.debug_do_html) { writeln(__FILE__, ":", __LINE__, ": ", obj.metainfo.is_of_type); } } @@ -1868,14 +1862,14 @@ case "body": assert(section == "body" || "head"); case "para": switch (obj.metainfo.is_a) { case "heading": - doc_html ~= delimit ~ xhtml_format.heading_scroll(_txt, obj, doc_matters, suffix); + doc_html ~= delimit ~ xhtml_format.heading_scroll(_txt, obj, doc.matters, suffix); break; case "para": - doc_html ~= xhtml_format.para_scroll(_txt, obj, doc_matters, suffix); + doc_html ~= xhtml_format.para_scroll(_txt, obj, doc.matters, suffix); break; default: { /+ debug +/ - if (doc_matters.opt.action.debug_do_html) { + if (doc.matters.opt.action.debug_do_html) { writeln(__FILE__, ":", __LINE__, ": ", obj.metainfo.is_a); } } @@ -1885,28 +1879,28 @@ case "body": assert(section == "body" || "head"); case "block": switch (obj.metainfo.is_a) { case "quote": - doc_html ~= xhtml_format.quote_scroll(_txt, obj, doc_matters); + doc_html ~= xhtml_format.quote_scroll(_txt, obj, doc.matters); break; case "group": - doc_html ~= xhtml_format.group_scroll(_txt, obj, doc_matters); + doc_html ~= xhtml_format.group_scroll(_txt, obj, doc.matters); break; case "block": - doc_html ~= xhtml_format.block_scroll(_txt, obj, doc_matters); + doc_html ~= xhtml_format.block_scroll(_txt, obj, doc.matters); break; case "poem": break; case "verse": - doc_html ~= xhtml_format.verse_scroll(_txt, obj, doc_matters, suffix); + doc_html ~= xhtml_format.verse_scroll(_txt, obj, doc.matters, suffix); break; case "code": - doc_html ~= xhtml_format.code(_txt, obj, doc_matters); + doc_html ~= xhtml_format.code(_txt, obj, doc.matters); break; case "table": - doc_html ~= xhtml_format.table(_txt, obj, doc_matters); + doc_html ~= xhtml_format.table(_txt, obj, doc.matters); break; default: { /+ debug +/ - if (doc_matters.opt.action.debug_do_html) { + if (doc.matters.opt.action.debug_do_html) { writeln(__FILE__, ":", __LINE__, ": ", obj.metainfo.is_a); } } @@ -1915,7 +1909,7 @@ case "body": assert(section == "body" || "head"); break; default: { /+ debug +/ - if (doc_matters.opt.action.debug_do_html) { + if (doc.matters.opt.action.debug_do_html) { writeln(__FILE__, ":", __LINE__, ": ", obj.metainfo.is_of_type); } } @@ -1934,29 +1928,29 @@ case "backmatter": case "para": switch (obj.metainfo.is_a) { case "heading": - doc_html ~= delimit ~ xhtml_format.heading_scroll(_txt, obj, doc_matters, suffix); + doc_html ~= delimit ~ xhtml_format.heading_scroll(_txt, obj, doc.matters, suffix); break; case "endnote": assert(section == "endnotes"); - doc_html ~= xhtml_format.para_scroll(_txt, obj, doc_matters, suffix); + doc_html ~= xhtml_format.para_scroll(_txt, obj, doc.matters, suffix); break; case "glossary": assert(section == "glossary"); - doc_html ~= xhtml_format.para_scroll(_txt, obj, doc_matters, suffix); + doc_html ~= xhtml_format.para_scroll(_txt, obj, doc.matters, suffix); break; case "bibliography": assert(section == "bibliography"); - doc_html ~= xhtml_format.para_scroll(_txt, obj, doc_matters, suffix); + doc_html ~= xhtml_format.para_scroll(_txt, obj, doc.matters, suffix); break; case "bookindex": assert(section == "bookindex"); - doc_html ~= xhtml_format.para_scroll(_txt, obj, doc_matters, suffix); + doc_html ~= xhtml_format.para_scroll(_txt, obj, doc.matters, suffix); break; case "blurb": assert(section == "blurb"); - doc_html ~= xhtml_format.para_scroll(_txt, obj, doc_matters, suffix); + doc_html ~= xhtml_format.para_scroll(_txt, obj, doc.matters, suffix); break; case "tail": assert(section == "tail"); - doc_html ~= xhtml_format.para_scroll(_txt, obj, doc_matters, suffix); + doc_html ~= xhtml_format.para_scroll(_txt, obj, doc.matters, suffix); break; default: { /+ debug +/ - if (doc_matters.opt.action.debug_do_html) { + if (doc.matters.opt.action.debug_do_html) { writeln(__FILE__, ":", __LINE__, ": ", obj.metainfo.is_a); } } @@ -1965,7 +1959,7 @@ case "backmatter": break; default: { /+ debug +/ - if (doc_matters.opt.action.debug_do_html) { + if (doc.matters.opt.action.debug_do_html) { writeln(__FILE__, ":", __LINE__, ": ", obj.metainfo.is_of_type); } } @@ -1976,7 +1970,7 @@ case "comment": break; default: { /+ debug +/ - if (doc_matters.opt.action.debug_do_html) { + if (doc.matters.opt.action.debug_do_html) { writeln(__FILE__, ":", __LINE__, ": ", obj.metainfo.is_of_part); writeln(__FILE__, ":", __LINE__, ": ", obj.metainfo.is_a); writeln(__FILE__, ":", __LINE__, ": ", obj.text); @@ -1992,23 +1986,23 @@ default: } } } -doc = xhtml_format.html_head(doc_matters, "scroll") +doc_out = xhtml_format.html_head(doc.matters, "scroll") ~ doc_html ~ xhtml_format.dom_close -~ xhtml_format.tail(doc_matters); -scroll_write_output(doc, doc_matters); +~ xhtml_format.tail(doc.matters); +scroll_write_output(doc_out, doc.matters); #+END_SRC *** write output file #+NAME: output_html_scroll_scroll_write_output #+BEGIN_SRC d -@trusted void scroll_write_output(D,M)( - D doc, +@trusted void scroll_write_output(O,M)( + O doc_out, M doc_matters, ) { debug(asserts) { - static assert(is(typeof(doc) == string[])); + static assert(is(typeof(doc_out) == string[])); } auto pth_html = spinePathsHTML!()(doc_matters.output_path, doc_matters.src.language); try { @@ -2017,7 +2011,7 @@ scroll_write_output(doc, doc_matters); } { auto f = File(pth_html.fn_scroll(doc_matters.src.filename), "w"); - foreach (o; doc) { + foreach (o; doc_out) { f.writeln(o); } } @@ -2054,7 +2048,6 @@ static auto rgx_xhtml = RgxXHTML(); auto xhtml_format = outputXHTMLs(); string[][string] doc_html; string[][string] doc_html_endnotes; -string[] doc; string segment_filename; string[] top_level_headings = ["","","",""]; string previous_seg_filename = ""; @@ -2067,8 +2060,8 @@ string delimit = ""; #+NAME: output_html_seg_loop_parts #+BEGIN_SRC d -foreach (section; doc_matters.has.keys_seq.seg) { - foreach (obj; doc_abstraction[section]) { +foreach (section; doc.matters.has.keys_seq.seg) { + foreach (obj; doc.abstraction[section]) { delimit = xhtml_format.div_delimit(section, previous_section); string _txt = xhtml_format.special_characters_breaks_indents_bullets(obj); #+END_SRC @@ -2102,33 +2095,33 @@ if (obj.metainfo.is_a == "heading") { top_level_headings[3] = ""; goto default; default: - Tuple!(string, string[]) t = xhtml_format.heading_seg(_txt, obj, doc_matters, suffix, "seg"); + Tuple!(string, string[]) t = xhtml_format.heading_seg(_txt, obj, doc.matters, suffix, "seg"); top_level_headings[obj.metainfo.heading_lev_markup] = t[0]; break; } break; case 4: segment_filename = obj.tags.segment_anchor_tag_epub; - doc_html[segment_filename] ~= xhtml_format.html_head(doc_matters, "seg"); - auto navigation_bar = xhtml_format.nav_pre_next_svg(obj, doc_matters); + doc_html[segment_filename] ~= xhtml_format.html_head(doc.matters, "seg"); + auto navigation_bar = xhtml_format.nav_pre_next_svg(obj, doc.matters); doc_html[segment_filename] ~= navigation_bar.toc_pre_next; previous_seg_filename = segment_filename; foreach (top_level_heading; top_level_headings) { doc_html[segment_filename] ~= top_level_heading; } - Tuple!(string, string[]) t = xhtml_format.heading_seg(_txt, obj, doc_matters, suffix, "seg"); + Tuple!(string, string[]) t = xhtml_format.heading_seg(_txt, obj, doc.matters, suffix, "seg"); doc_html[segment_filename] ~= t[0].to!string; - doc_html[segment_filename] ~= xhtml_format.lev4_heading_subtoc(obj, doc_matters); + doc_html[segment_filename] ~= xhtml_format.lev4_heading_subtoc(obj, doc.matters); doc_html_endnotes[segment_filename] ~= t[1]; break; case 5: .. case 7: - Tuple!(string, string[]) t = xhtml_format.heading_seg(_txt, obj, doc_matters, suffix, "seg"); + Tuple!(string, string[]) t = xhtml_format.heading_seg(_txt, obj, doc.matters, suffix, "seg"); doc_html[segment_filename] ~= t[0].to!string; doc_html_endnotes[segment_filename] ~= t[1]; break; case 8: .. case 9: { /+ debug +/ - if (doc_matters.opt.action.debug_do_html) { + if (doc.matters.opt.action.debug_do_html) { writeln(__FILE__, ":", __LINE__, ": ", obj.metainfo.is_a, ": ", obj.metainfo.heading_lev_markup); writeln(__FILE__, ":", __LINE__, ": ", obj.text); } @@ -2136,7 +2129,7 @@ if (obj.metainfo.is_a == "heading") { break; default: { /+ debug +/ - if (doc_matters.opt.action.debug_do_html) { + if (doc.matters.opt.action.debug_do_html) { writeln(__FILE__, ":", __LINE__, ": ", obj.metainfo.is_a, ": ", obj.metainfo.heading_lev_markup); } } @@ -2163,12 +2156,12 @@ case "frontmatter": assert(section == "head" || "toc"); case "para": switch (obj.metainfo.is_a) { case "toc": - t = xhtml_format.para_seg(_txt, obj, doc_matters, suffix, "seg"); + t = xhtml_format.para_seg(_txt, obj, doc.matters, suffix, "seg"); doc_html[segment_filename] ~= t[0].to!string; break; default: { /+ debug +/ - if (doc_matters.opt.action.debug_do_html) { + if (doc.matters.opt.action.debug_do_html) { writeln(__FILE__, ":", __LINE__, ": ", obj.metainfo.is_a); } } @@ -2177,7 +2170,7 @@ case "frontmatter": assert(section == "head" || "toc"); break; default: { /+ debug +/ - if (doc_matters.opt.action.debug_do_html) { + if (doc.matters.opt.action.debug_do_html) { writeln(__FILE__, ":", __LINE__, ": ", obj.metainfo.is_a); } } @@ -2195,13 +2188,13 @@ case "body": assert(section == "body"); case "para": switch (obj.metainfo.is_a) { case "para": - t = xhtml_format.para_seg(_txt, obj, doc_matters, suffix, "seg"); + t = xhtml_format.para_seg(_txt, obj, doc.matters, suffix, "seg"); doc_html[segment_filename] ~= t[0].to!string; doc_html_endnotes[segment_filename] ~= t[1]; break; default: { /+ debug +/ - if (doc_matters.opt.action.debug_do_html) { + if (doc.matters.opt.action.debug_do_html) { writeln(__FILE__, ":", __LINE__, ": ", obj.metainfo.is_a); } } @@ -2211,24 +2204,24 @@ case "body": assert(section == "body"); case "block": switch (obj.metainfo.is_a) { case "quote": - t = xhtml_format.quote_seg(_txt, obj, doc_matters, suffix, "seg"); + t = xhtml_format.quote_seg(_txt, obj, doc.matters, suffix, "seg"); goto default; case "group": - t = xhtml_format.group_seg(_txt, obj, doc_matters, suffix, "seg"); + t = xhtml_format.group_seg(_txt, obj, doc.matters, suffix, "seg"); goto default; case "block": - t = xhtml_format.block_seg(_txt, obj, doc_matters, suffix, "seg"); + t = xhtml_format.block_seg(_txt, obj, doc.matters, suffix, "seg"); goto default; case "poem": break; case "verse": - t = xhtml_format.verse_seg(_txt, obj, doc_matters, suffix, "seg"); + t = xhtml_format.verse_seg(_txt, obj, doc.matters, suffix, "seg"); goto default; case "code": - doc_html[segment_filename] ~= xhtml_format.code(_txt, obj, doc_matters); + doc_html[segment_filename] ~= xhtml_format.code(_txt, obj, doc.matters); break; case "table": - doc_html[segment_filename] ~= xhtml_format.table(_txt, obj, doc_matters); + doc_html[segment_filename] ~= xhtml_format.table(_txt, obj, doc.matters); doc_html_endnotes[segment_filename] ~= ""; break; default: @@ -2240,7 +2233,7 @@ case "body": assert(section == "body"); doc_html[segment_filename] ~= t[0].to!string; doc_html_endnotes[segment_filename] ~= t[1]; } else { /+ debug +/ - if (doc_matters.opt.action.debug_do_html) { + if (doc.matters.opt.action.debug_do_html) { writeln(__FILE__, ":", __LINE__, ": ", obj.metainfo.is_a); } } @@ -2249,7 +2242,7 @@ case "body": assert(section == "body"); break; default: { /+ debug +/ - if (doc_matters.opt.action.debug_do_html) { + if (doc.matters.opt.action.debug_do_html) { writeln(__FILE__, ":", __LINE__, ": ", obj.metainfo.is_of_type); } } @@ -2268,37 +2261,37 @@ case "backmatter": case "para": switch (obj.metainfo.is_a) { case "endnote": assert(section == "endnotes"); - t = xhtml_format.para_seg(_txt, obj, doc_matters, suffix, "seg"); + t = xhtml_format.para_seg(_txt, obj, doc.matters, suffix, "seg"); doc_html[segment_filename] ~= t[0]; break; case "glossary": assert(section == "glossary"); - t = xhtml_format.para_seg(_txt, obj, doc_matters, suffix, "seg"); + t = xhtml_format.para_seg(_txt, obj, doc.matters, suffix, "seg"); doc_html[segment_filename] ~= t[0]; doc_html_endnotes[segment_filename] ~= t[1]; break; case "bibliography": assert(section == "bibliography"); - t = xhtml_format.para_seg(_txt, obj, doc_matters, suffix, "seg"); + t = xhtml_format.para_seg(_txt, obj, doc.matters, suffix, "seg"); doc_html[segment_filename] ~= t[0]; doc_html_endnotes[segment_filename] ~= t[1]; break; case "bookindex": assert(section == "bookindex"); - t = xhtml_format.para_seg(_txt, obj, doc_matters, suffix, "seg"); + t = xhtml_format.para_seg(_txt, obj, doc.matters, suffix, "seg"); doc_html[segment_filename] ~= t[0]; doc_html_endnotes[segment_filename] ~= t[1]; break; case "blurb": assert(section == "blurb"); - t = xhtml_format.para_seg(_txt, obj, doc_matters, suffix, "seg"); + t = xhtml_format.para_seg(_txt, obj, doc.matters, suffix, "seg"); doc_html[segment_filename] ~= t[0]; doc_html_endnotes[segment_filename] ~= t[1]; break; case "tail": assert(section == "tail"); - t = xhtml_format.para_seg(_txt, obj, doc_matters, suffix, "seg"); + t = xhtml_format.para_seg(_txt, obj, doc.matters, suffix, "seg"); doc_html[segment_filename] ~= t[0]; doc_html_endnotes[segment_filename] ~= t[1]; break; default: { /+ debug +/ - if (doc_matters.opt.action.debug_do_html) { + if (doc.matters.opt.action.debug_do_html) { writeln(__FILE__, ":", __LINE__, ": ", obj.metainfo.is_a); } } @@ -2307,7 +2300,7 @@ case "backmatter": break; default: { /+ debug +/ - if (doc_matters.opt.action.debug_do_html) { + if (doc.matters.opt.action.debug_do_html) { writeln(__FILE__, ":", __LINE__, ": ", obj.metainfo.is_of_type); } } @@ -2318,7 +2311,7 @@ case "comment": break; default: { /+ debug +/ - if (doc_matters.opt.action.debug_do_html) { + if (doc.matters.opt.action.debug_do_html) { writeln(__FILE__, ":", __LINE__, ": ", obj.metainfo.is_of_part); } } @@ -2333,7 +2326,7 @@ default: } } } -seg_write_output(doc_html, doc_html_endnotes, doc_matters); +seg_write_output(doc_html, doc_html_endnotes, doc.matters); #+END_SRC *** write output files @@ -2418,9 +2411,7 @@ void css(M)(M doc_matters) { #+NAME: copy_html_images #+BEGIN_SRC d -@trusted void images_cp(M)( // @system - M doc_matters, -) { +@trusted void images_cp(M)(M doc_matters) { // @system { /+ (copy html images) +/ auto pth_html = spinePathsHTML!()(doc_matters.output_path, doc_matters.src.language); if (!exists(pth_html.image)) { @@ -2562,10 +2553,10 @@ xmlns="urn:oasis:names:tc:opendocument:xmlns:container"> #+NAME: output_epub3_constructs_oebps_content #+HEADER: :noweb yes #+BEGIN_SRC d -string epub3_oebps_content(D,M,P)(D doc_abstraction, M doc_matters, P parts) { +string epub3_oebps_content(D,P)(D doc, P parts) { auto xhtml_format = outputXHTMLs(); - auto pth_epub3 = spinePathsEPUB!()(doc_matters.output_path, doc_matters.src.language); - string _uuid = "18275d951861c77f78acd05672c9906924c59f18a2e0ba06dad95959693e9bd8"; // TODO sort uuid in doc_matters! + auto pth_epub3 = spinePathsEPUB!()(doc.matters.output_path, doc.matters.src.language); + string _uuid = "18275d951861c77f78acd05672c9906924c59f18a2e0ba06dad95959693e9bd8"; // TODO sort uuid in doc.matters! string content = format(q"┃<?xml version="1.0" encoding="utf-8"?> <<epub3_package_version>> <metadata @@ -2589,25 +2580,25 @@ string epub3_oebps_content(D,M,P)(D doc_abstraction, M doc_matters, P parts) { <item id="nav" href="toc_nav.xhtml" media-type="application/xhtml+xml" properties="nav" /> ┃", _uuid, - xhtml_format.special_characters_text(doc_matters.conf_make_meta.meta.title_main), - (doc_matters.conf_make_meta.meta.title_sub.empty) - ? "" : xhtml_format.special_characters_text(doc_matters.conf_make_meta.meta.title_sub), - (doc_matters.conf_make_meta.meta.creator_author.empty) - ? "" : xhtml_format.special_characters_text(doc_matters.conf_make_meta.meta.creator_author), - (doc_matters.conf_make_meta.meta.creator_author.empty) - ? "" : xhtml_format.special_characters_text(doc_matters.conf_make_meta.meta.creator_author), - doc_matters.src.language, // language, fix (needed in dochead metadata) - (doc_matters.conf_make_meta.meta.date_published.empty) - ? "" : xhtml_format.special_characters_date(doc_matters.conf_make_meta.meta.date_published), - (doc_matters.conf_make_meta.meta.rights_copyright.empty) - ? "" : xhtml_format.special_characters_text(doc_matters.conf_make_meta.meta.rights_copyright), + xhtml_format.special_characters_text(doc.matters.conf_make_meta.meta.title_main), + (doc.matters.conf_make_meta.meta.title_sub.empty) + ? "" : xhtml_format.special_characters_text(doc.matters.conf_make_meta.meta.title_sub), + (doc.matters.conf_make_meta.meta.creator_author.empty) + ? "" : xhtml_format.special_characters_text(doc.matters.conf_make_meta.meta.creator_author), + (doc.matters.conf_make_meta.meta.creator_author.empty) + ? "" : xhtml_format.special_characters_text(doc.matters.conf_make_meta.meta.creator_author), + doc.matters.src.language, // language, fix (needed in dochead metadata) + (doc.matters.conf_make_meta.meta.date_published.empty) + ? "" : xhtml_format.special_characters_date(doc.matters.conf_make_meta.meta.date_published), + (doc.matters.conf_make_meta.meta.rights_copyright.empty) + ? "" : xhtml_format.special_characters_text(doc.matters.conf_make_meta.meta.rights_copyright), _uuid, _uuid, (pth_epub3.fn_oebps_css).chompPrefix("OEBPS/"), ); content ~= parts["manifest_documents"]; // TODO sort jpg & png - foreach (image; doc_matters.srcs.image_list) { + foreach (image; doc.matters.srcs.image_list) { content ~= format(q"┃ <item id="%s" href="%s/%s" media-type="image/%s" /> ┃", image.baseName.stripExtension, @@ -2625,8 +2616,8 @@ string epub3_oebps_content(D,M,P)(D doc_abstraction, M doc_matters, P parts) { content ~= " " ~ "</guide>" ~ "\n "; content ~= "" ~ "</package>"; debug(epubmanifest) { - foreach (section; doc_matters.has.keys_seq.seg) { // TODO - foreach (obj; doc_abstraction[section]) { + foreach (section; doc.matters.has.keys_seq.seg) { // TODO + foreach (obj; doc.abstraction[section]) { if (obj.metainfo.is_a == "heading") { if (obj.metainfo.heading_lev_markup == 4) { writefln( @@ -2658,7 +2649,7 @@ string epub3_oebps_content(D,M,P)(D doc_abstraction, M doc_matters, P parts) { #+NAME: output_epub3_constructs_oebps_toc_nav_xhtml #+BEGIN_SRC d -string epub3_oebps_toc_nav_xhtml(D,I)(D doc_abstraction, I doc_matters) { +string epub3_oebps_toc_nav_xhtml(D)(D doc) { enum DomTags { none, open, close, close_and_open, open_still, } auto markup = InlineMarkup(); static auto rgx = RgxO(); @@ -2677,12 +2668,12 @@ string epub3_oebps_toc_nav_xhtml(D,I)(D doc_abstraction, I doc_matters) { </header> <nav epub:type="toc" id="toc"> ┃", - (doc_matters.conf_make_meta.meta.title_full).special_characters_text, + (doc.matters.conf_make_meta.meta.title_full).special_characters_text, ); string _toc_nav_tail = ""; - // writeln(doc_matters.has.keys_seq.seg); // DEBUG line - foreach (sect; doc_matters.has.keys_seq.seg) { - foreach (obj; doc_abstraction[sect]) { + // writeln(doc.matters.has.keys_seq.seg); // DEBUG line + foreach (sect; doc.matters.has.keys_seq.seg) { + foreach (obj; doc.abstraction[sect]) { if ((sect == "head") && (obj.metainfo.is_a == "heading")) { toc = toc_head; } @@ -2738,7 +2729,7 @@ string epub3_oebps_toc_nav_xhtml(D,I)(D doc_abstraction, I doc_matters) { } break; } - if (doc_matters.has.keys_seq.seg[doc_matters.has.keys_seq.seg.length - 2] == sect) { + if (doc.matters.has.keys_seq.seg[doc.matters.has.keys_seq.seg.length - 2] == sect) { // writeln(n, ": ", sect, ": ", _txt, " - ", obj.metainfo.dom_structure_collapsed_tags_status); // DEBUG // read last heading (heading prior to closing) and determine what those instructions imply still need to be done // CLOSE // DomTags { 0 none, 1 open, 2 close, 3 close_and_open, 4 open_still, } @@ -2778,16 +2769,12 @@ string epub3_oebps_toc_nav_xhtml(D,I)(D doc_abstraction, I doc_matters) { #+NAME: output_epub3_xhtml_seg_output #+BEGIN_SRC d -@system void outputEPub3(D,I)( - const D doc_abstraction, - I doc_matters, -) { +@system void outputEPub3(D)(D doc) { mixin spineRgxOut; mixin spineRgxXHTML; auto xhtml_format = outputXHTMLs(); static auto rgx = RgxO(); static auto rgx_xhtml = RgxXHTML(); - string[] doc; string segment_filename; string[] top_level_headings = ["","","",""]; string[string] oepbs_content_parts; @@ -2810,8 +2797,8 @@ string epub3_oebps_toc_nav_xhtml(D,I)(D doc_abstraction, I doc_matters) { #+NAME: output_epub3_xhtml_seg_output_loop #+BEGIN_SRC d -foreach (section; doc_matters.has.keys_seq.seg) { - foreach (obj; doc_abstraction[section]) { +foreach (section; doc.matters.has.keys_seq.seg) { + foreach (obj; doc.abstraction[section]) { string _txt = xhtml_format.special_characters_breaks_indents_bullets(obj); #+END_SRC @@ -2845,8 +2832,8 @@ if (obj.metainfo.is_a == "heading") { goto default; default: epubWrite.doc_parts ~= obj.tags.segment_anchor_tag_epub; - epubWrite.doc_epub3[obj.tags.segment_anchor_tag_epub] ~= xhtml_format.epub3_seg_head(doc_matters); - Tuple!(string, string[]) t = xhtml_format.heading_seg(_txt, obj, doc_matters, suffix, "epub"); + epubWrite.doc_epub3[obj.tags.segment_anchor_tag_epub] ~= xhtml_format.epub3_seg_head(doc.matters); + Tuple!(string, string[]) t = xhtml_format.heading_seg(_txt, obj, doc.matters, suffix, "epub"); epubWrite.doc_epub3[obj.tags.segment_anchor_tag_epub] ~= t[0]; epubWrite.doc_epub3_endnotes[obj.tags.segment_anchor_tag_epub] ~= t[1]; break; @@ -2854,19 +2841,19 @@ if (obj.metainfo.is_a == "heading") { break; case 4: segment_filename = obj.tags.segment_anchor_tag_epub; - epubWrite.doc_epub3[segment_filename] ~= xhtml_format.epub3_seg_head(doc_matters); - Tuple!(string, string[]) t = xhtml_format.heading_seg(_txt, obj, doc_matters, suffix, "epub"); + epubWrite.doc_epub3[segment_filename] ~= xhtml_format.epub3_seg_head(doc.matters); + Tuple!(string, string[]) t = xhtml_format.heading_seg(_txt, obj, doc.matters, suffix, "epub"); epubWrite.doc_epub3[segment_filename] ~= t[0]; epubWrite.doc_epub3_endnotes[segment_filename] ~= t[1]; break; case 5: .. case 7: - Tuple!(string, string[]) t = xhtml_format.heading_seg(_txt, obj, doc_matters, suffix, "epub"); + Tuple!(string, string[]) t = xhtml_format.heading_seg(_txt, obj, doc.matters, suffix, "epub"); epubWrite.doc_epub3[segment_filename] ~= t[0]; epubWrite.doc_epub3_endnotes[segment_filename] ~= t[1]; break; case 8: .. case 9: { /+ debug +/ - if (doc_matters.opt.action.debug_do_epub) { + if (doc.matters.opt.action.debug_do_epub) { writeln(__FILE__, ":", __LINE__, ": ", obj.metainfo.is_a, ": ", obj.metainfo.heading_lev_markup); writeln(__FILE__, ":", __LINE__, ": ", obj.text); } @@ -2874,7 +2861,7 @@ if (obj.metainfo.is_a == "heading") { break; default: { /+ debug +/ - if (doc_matters.opt.action.debug_do_epub) { + if (doc.matters.opt.action.debug_do_epub) { writeln(__FILE__, ":", __LINE__, ": ", obj.metainfo.is_a, ": ", obj.metainfo.heading_lev_markup); } } @@ -2901,13 +2888,13 @@ case "frontmatter": assert(section == "head" || "toc"); case "para": switch (obj.metainfo.is_a) { case "toc": - t = xhtml_format.para_seg(_txt, obj, doc_matters, suffix, "epub"); + t = xhtml_format.para_seg(_txt, obj, doc.matters, suffix, "epub"); epubWrite.doc_epub3[segment_filename] ~= t[0]; epubWrite.doc_epub3_endnotes[segment_filename] ~= t[1]; break; default: { /+ debug +/ - if (doc_matters.opt.action.debug_do_epub) { + if (doc.matters.opt.action.debug_do_epub) { writeln(__FILE__, ":", __LINE__, ": ", obj.metainfo.is_a); } } @@ -2916,7 +2903,7 @@ case "frontmatter": assert(section == "head" || "toc"); break; default: { /+ debug +/ - if (doc_matters.opt.action.debug_do_epub) { + if (doc.matters.opt.action.debug_do_epub) { writeln(__FILE__, ":", __LINE__, ": ", obj.metainfo.is_of_type); } } @@ -2934,13 +2921,13 @@ case "body": assert(section == "body"); case "para": switch (obj.metainfo.is_a) { case "para": - t = xhtml_format.para_seg(_txt, obj, doc_matters, suffix, "epub"); + t = xhtml_format.para_seg(_txt, obj, doc.matters, suffix, "epub"); epubWrite.doc_epub3[segment_filename] ~= t[0]; epubWrite.doc_epub3_endnotes[segment_filename] ~= t[1]; break; default: { /+ debug +/ - if (doc_matters.opt.action.debug_do_epub) { + if (doc.matters.opt.action.debug_do_epub) { writeln(__FILE__, ":", __LINE__, ": ", obj.metainfo.is_a); } } @@ -2950,37 +2937,37 @@ case "body": assert(section == "body"); case "block": switch (obj.metainfo.is_a) { case "quote": - t = xhtml_format.quote_seg(_txt, obj, doc_matters, suffix, "epub"); + t = xhtml_format.quote_seg(_txt, obj, doc.matters, suffix, "epub"); epubWrite.doc_epub3[segment_filename] ~= t[0].to!string; epubWrite.doc_epub3_endnotes[segment_filename] ~= t[1]; break; case "group": - t = xhtml_format.group_seg(_txt, obj, doc_matters, suffix, "epub"); + t = xhtml_format.group_seg(_txt, obj, doc.matters, suffix, "epub"); epubWrite.doc_epub3[segment_filename] ~= t[0].to!string; epubWrite.doc_epub3_endnotes[segment_filename] ~= t[1]; break; case "block": - t = xhtml_format.block_seg(_txt, obj, doc_matters, suffix, "epub"); + t = xhtml_format.block_seg(_txt, obj, doc.matters, suffix, "epub"); epubWrite.doc_epub3[segment_filename] ~= t[0].to!string; epubWrite.doc_epub3_endnotes[segment_filename] ~= t[1]; break; case "poem": break; case "verse": - t = xhtml_format.verse_seg(_txt, obj, doc_matters, suffix, "epub"); + t = xhtml_format.verse_seg(_txt, obj, doc.matters, suffix, "epub"); epubWrite.doc_epub3[segment_filename] ~= t[0].to!string; epubWrite.doc_epub3_endnotes[segment_filename] ~= t[1]; break; case "code": - epubWrite.doc_epub3[segment_filename] ~= xhtml_format.code(_txt, obj, doc_matters); + epubWrite.doc_epub3[segment_filename] ~= xhtml_format.code(_txt, obj, doc.matters); break; case "table": - epubWrite.doc_epub3[segment_filename] ~= xhtml_format.table(_txt, obj, doc_matters); + epubWrite.doc_epub3[segment_filename] ~= xhtml_format.table(_txt, obj, doc.matters); epubWrite.doc_epub3_endnotes[segment_filename] ~= ""; break; default: { /+ debug +/ - if (doc_matters.opt.action.debug_do_epub) { + if (doc.matters.opt.action.debug_do_epub) { writeln(__FILE__, ":", __LINE__, ": ", obj.metainfo.is_a); } } @@ -2989,7 +2976,7 @@ case "body": assert(section == "body"); break; default: { /+ debug +/ - if (doc_matters.opt.action.debug_do_epub) { + if (doc.matters.opt.action.debug_do_epub) { writeln(__FILE__, ":", __LINE__, ": ", obj.metainfo.is_of_type); } } @@ -3008,37 +2995,37 @@ case "backmatter": case "para": switch (obj.metainfo.is_a) { case "endnote": assert(section == "endnotes"); - t = xhtml_format.para_seg(_txt, obj, doc_matters, suffix, "epub"); + t = xhtml_format.para_seg(_txt, obj, doc.matters, suffix, "epub"); epubWrite.doc_epub3[segment_filename] ~= t[0]; break; case "glossary": assert(section == "glossary"); - t = xhtml_format.para_seg(_txt, obj, doc_matters, suffix, "epub"); + t = xhtml_format.para_seg(_txt, obj, doc.matters, suffix, "epub"); epubWrite.doc_epub3[segment_filename] ~= t[0]; epubWrite.doc_epub3_endnotes[segment_filename] ~= t[1]; break; case "bibliography": assert(section == "bibliography"); - t = xhtml_format.para_seg(_txt, obj, doc_matters, suffix, "epub"); + t = xhtml_format.para_seg(_txt, obj, doc.matters, suffix, "epub"); epubWrite.doc_epub3[segment_filename] ~= t[0]; epubWrite.doc_epub3_endnotes[segment_filename] ~= t[1]; break; case "bookindex": assert(section == "bookindex"); - t = xhtml_format.para_seg(_txt, obj, doc_matters, suffix, "epub"); + t = xhtml_format.para_seg(_txt, obj, doc.matters, suffix, "epub"); epubWrite.doc_epub3[segment_filename] ~= t[0]; epubWrite.doc_epub3_endnotes[segment_filename] ~= t[1]; break; case "blurb": assert(section == "blurb"); - t = xhtml_format.para_seg(_txt, obj, doc_matters, suffix, "epub"); + t = xhtml_format.para_seg(_txt, obj, doc.matters, suffix, "epub"); epubWrite.doc_epub3[segment_filename] ~= t[0]; epubWrite.doc_epub3_endnotes[segment_filename] ~= t[1]; break; case "tail": assert(section == "tail"); - t = xhtml_format.para_seg(_txt, obj, doc_matters, suffix, "epub"); + t = xhtml_format.para_seg(_txt, obj, doc.matters, suffix, "epub"); epubWrite.doc_epub3[segment_filename] ~= t[0]; epubWrite.doc_epub3_endnotes[segment_filename] ~= t[1]; break; default: { /+ debug +/ - if (doc_matters.opt.action.debug_do_epub) { + if (doc.matters.opt.action.debug_do_epub) { writeln(__FILE__, ":", __LINE__, ": ", obj.metainfo.is_a); } } @@ -3047,7 +3034,7 @@ case "backmatter": break; default: { /+ debug +/ - if (doc_matters.opt.action.debug_do_epub) { + if (doc.matters.opt.action.debug_do_epub) { writeln(__FILE__, ":", __LINE__, ": ", obj.metainfo.is_of_type); } } @@ -3064,7 +3051,7 @@ case "backmatter": break; default: { /+ debug +/ - if (doc_matters.opt.action.debug_do_epub) { + if (doc.matters.opt.action.debug_do_epub) { writeln(__FILE__, ":", __LINE__, ": ", obj.metainfo.is_of_part); } } @@ -3133,9 +3120,9 @@ if (obj.metainfo.is_a == "heading") { /+ epub specific documents +/ epubWrite.mimetypes = epub3_mimetypes; epubWrite.meta_inf_container_xml = epub3_container_xml; - epubWrite.oebps_toc_nav_xhtml = doc_abstraction.epub3_oebps_toc_nav_xhtml(doc_matters); - epubWrite.oebps_content_opf = doc_abstraction.epub3_oebps_content(doc_matters, oepbs_content_parts); - epubWrite.epub3_write_output_files(doc_matters); + epubWrite.oebps_toc_nav_xhtml = doc.epub3_oebps_toc_nav_xhtml; + epubWrite.oebps_content_opf = doc.epub3_oebps_content(oepbs_content_parts); + epubWrite.epub3_write_output_files(doc.matters); } #+END_SRC |