From bdcb9189e4cf221bec1efaf2e6e612b127e51f25 Mon Sep 17 00:00:00 2001 From: Ralph Amissah Date: Sat, 6 Jan 2018 20:34:42 -0500 Subject: 0.23.3 work on source & target file paths/locations --- org/output_xmls.org | 177 ++++++++++++++++++++++++++-------------------------- 1 file changed, 89 insertions(+), 88 deletions(-) (limited to 'org/output_xmls.org') diff --git a/org/output_xmls.org b/org/output_xmls.org index c73b42c..19f8552 100644 --- a/org/output_xmls.org +++ b/org/output_xmls.org @@ -16,6 +16,7 @@ [[./sdp.org][sdp]] [[./][org/]] [[./output_hub.org][output_hub]] + * xml offspring (xhtml html epub) :module:sdp:output_xmls: ** format xhtml objects :format: *** 0. module template @@ -332,7 +333,7 @@ auto html_head(Dm)( ((type == "seg") ? "../../../css/html_seg.css" : "../../css/html_scroll.css"), - doc_matters.language, + doc_matters.src.language, site_info_button(doc_matters), inline_search_form(doc_matters), ((type == "seg") ? "" : "\n"), @@ -356,16 +357,16 @@ auto epub3_seg_head(Dm)( 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, + doc_matters.src.language, + doc_matters.src.language, ); string html_strict = format(q"¶ ¶", - doc_matters.language, - doc_matters.language, + doc_matters.src.language, + doc_matters.src.language, ); string o; o = format(q"¶%s @@ -399,7 +400,7 @@ auto epub3_seg_head(Dm)( doc_matters.conf_make_meta.meta.title_full, (doc_matters.conf_make_meta.meta.creator_author.empty) ? "" : ", " ~ doc_matters.conf_make_meta.meta.creator_author, - doc_matters.language, + doc_matters.src.language, ); return o; } @@ -1327,7 +1328,7 @@ void scroll(D,I)( string suffix = ".html"; string previous_part = ""; string delimit = ""; - foreach (part; doc_matters.keys_seq.scroll) { + foreach (part; doc_matters.xml.keys_seq.scroll) { foreach (obj; doc_abstraction[part]) { delimit = xhtml_format.div_delimit(part, previous_part); string _txt = xhtml_format.special_characters(obj, obj.text); @@ -1343,14 +1344,14 @@ void scroll(D,I)( doc_html ~= xhtml_format.para_scroll(obj, _txt, suffix); break; default: - if ((doc_matters.opt_action.debug_do)) { + if ((doc_matters.opt.action.debug_do)) { writeln(__FILE__, ":", __LINE__, ": ", obj.is_a); } break; } break; default: - if ((doc_matters.opt_action.debug_do)) { + if ((doc_matters.opt.action.debug_do)) { writeln(__FILE__, ":", __LINE__, ": ", obj.is_of); } break; @@ -1367,7 +1368,7 @@ void scroll(D,I)( doc_html ~= xhtml_format.para_scroll(obj, _txt, suffix); break; default: - if ((doc_matters.opt_action.debug_do)) { + if ((doc_matters.opt.action.debug_do)) { writeln(__FILE__, ":", __LINE__, ": ", obj.is_a); } break; @@ -1396,14 +1397,14 @@ void scroll(D,I)( doc_html ~= xhtml_format.table(obj, _txt); break; default: - if ((doc_matters.opt_action.debug_do)) { + if ((doc_matters.opt.action.debug_do)) { writeln(__FILE__, ":", __LINE__, ": ", obj.is_a); } break; } break; default: - if ((doc_matters.opt_action.debug_do)) { + if ((doc_matters.opt.action.debug_do)) { writeln(__FILE__, ":", __LINE__, ": ", obj.is_of); } break; @@ -1433,14 +1434,14 @@ void scroll(D,I)( doc_html ~= xhtml_format.para_scroll(obj, _txt, suffix); break; default: - if ((doc_matters.opt_action.debug_do)) { + if ((doc_matters.opt.action.debug_do)) { writeln(__FILE__, ":", __LINE__, ": ", obj.is_a); } break; } break; default: - if ((doc_matters.opt_action.debug_do)) { + if ((doc_matters.opt.action.debug_do)) { writeln(__FILE__, ":", __LINE__, ": ", obj.is_of); } break; @@ -1449,7 +1450,7 @@ void scroll(D,I)( case "comment": break; default: - if ((doc_matters.opt_action.debug_do)) { + if ((doc_matters.opt.action.debug_do)) { writeln(__FILE__, ":", __LINE__, ": ", obj.of_part); writeln(__FILE__, ":", __LINE__, ": ", obj.is_a); writeln(__FILE__, ":", __LINE__, ": ", obj.text); @@ -1474,12 +1475,12 @@ void scroll_write_output(M,C)( debug(asserts) { static assert(is(typeof(doc) == string[])); } - auto pth_html = SiSUpathsHTML!()(doc_matters.output_path, doc_matters.language); + auto pth_html = SiSUpathsHTML!()(doc_matters.output_path, doc_matters.src.language); try { if (!exists(pth_html.base)) { pth_html.base.mkdirRecurse; } - auto f = File(pth_html.fn_scroll(doc_matters.source_filename), "w"); + auto f = File(pth_html.fn_scroll(doc_matters.src.filename), "w"); foreach (o; doc) { f.writeln(o); } @@ -1487,7 +1488,7 @@ void scroll_write_output(M,C)( catch (ErrnoException ex) { // Handle error } - writeln(" ", pth_html.fn_scroll(doc_matters.source_filename)); + writeln(" ", pth_html.fn_scroll(doc_matters.src.filename)); } #+END_SRC @@ -1512,7 +1513,7 @@ void seg(D,I)( string suffix = ".html"; string previous_part = ""; string delimit = ""; - foreach (part; doc_matters.keys_seq.seg) { + foreach (part; doc_matters.xml.keys_seq.seg) { foreach (obj; doc_abstraction[part]) { delimit = xhtml_format.div_delimit(part, previous_part); string _txt = xhtml_format.special_characters(obj, obj.text); @@ -1567,13 +1568,13 @@ void seg(D,I)( doc_html_endnotes[segment_filename] ~= t[1]; break; case 8: .. case 9: - if ((doc_matters.opt_action.debug_do)) { + if ((doc_matters.opt.action.debug_do)) { writeln(__FILE__, ":", __LINE__, ": ", obj.is_a, ": ", obj.heading_lev_markup); writeln(__FILE__, ":", __LINE__, ": ", obj.text); } break; default: - if ((doc_matters.opt_action.debug_do)) { + if ((doc_matters.opt.action.debug_do)) { writeln(__FILE__, ":", __LINE__, ": ", obj.is_a, ": ", obj.heading_lev_markup); } break; @@ -1590,14 +1591,14 @@ void seg(D,I)( doc_html[segment_filename] ~= to!string(t[0]); break; default: - if ((doc_matters.opt_action.debug_do)) { + if ((doc_matters.opt.action.debug_do)) { writeln(__FILE__, ":", __LINE__, ": ", obj.is_a); } break; } break; default: - if ((doc_matters.opt_action.debug_do)) { + if ((doc_matters.opt.action.debug_do)) { writeln(__FILE__, ":", __LINE__, ": ", obj.is_a); } break; @@ -1613,7 +1614,7 @@ void seg(D,I)( doc_html_endnotes[segment_filename] ~= t[1]; break; default: - if ((doc_matters.opt_action.debug_do)) { + if ((doc_matters.opt.action.debug_do)) { writeln(__FILE__, ":", __LINE__, ": ", obj.is_a); } break; @@ -1651,14 +1652,14 @@ void seg(D,I)( doc_html_endnotes[segment_filename] ~= ""; break; default: - if ((doc_matters.opt_action.debug_do)) { + if ((doc_matters.opt.action.debug_do)) { writeln(__FILE__, ":", __LINE__, ": ", obj.is_a); } break; } break; default: - if ((doc_matters.opt_action.debug_do)) { + if ((doc_matters.opt.action.debug_do)) { writeln(__FILE__, ":", __LINE__, ": ", obj.is_of); } break; @@ -1694,14 +1695,14 @@ void seg(D,I)( doc_html_endnotes[segment_filename] ~= t[1]; break; default: - if ((doc_matters.opt_action.debug_do)) { + if ((doc_matters.opt.action.debug_do)) { writeln(__FILE__, ":", __LINE__, ": ", obj.is_a); } break; } break; default: - if ((doc_matters.opt_action.debug_do)) { + if ((doc_matters.opt.action.debug_do)) { writeln(__FILE__, ":", __LINE__, ": ", obj.is_of); } break; @@ -1710,7 +1711,7 @@ void seg(D,I)( case "comment": break; default: - if ((doc_matters.opt_action.debug_do)) { + if ((doc_matters.opt.action.debug_do)) { writeln(__FILE__, ":", __LINE__, ": ", obj.of_part); } break; @@ -1736,15 +1737,15 @@ void seg_write_output(M,D,E)( } mixin SiSUoutputRgxInit; auto rgx = Rgx(); - auto pth_html = SiSUpathsHTML!()(doc_matters.output_path, doc_matters.language); + auto pth_html = SiSUpathsHTML!()(doc_matters.output_path, doc_matters.src.language); auto xhtml_format = outputXHTMLs(); - auto m = doc_matters.source_filename.matchFirst(rgx.src_fn); + auto m = doc_matters.src.filename.matchFirst(rgx.src_fn); try { - if (!exists(pth_html.seg(doc_matters.source_filename))) { - pth_html.seg(doc_matters.source_filename).mkdirRecurse; + if (!exists(pth_html.seg(doc_matters.src.filename))) { + pth_html.seg(doc_matters.src.filename).mkdirRecurse; } - foreach (seg_filename; doc_matters.segnames) { - auto f = File(pth_html.fn_seg(doc_matters.source_filename, seg_filename), "w"); + foreach (seg_filename; doc_matters.xml.segnames) { + auto f = File(pth_html.fn_seg(doc_matters.src.filename, seg_filename), "w"); foreach (docseg; doc_html[seg_filename]) { f.writeln(docseg); } @@ -1757,7 +1758,7 @@ void seg_write_output(M,D,E)( catch (ErrnoException ex) { // handle error } - writeln(" ", pth_html.fn_seg(doc_matters.source_filename, "toc")); + writeln(" ", pth_html.fn_seg(doc_matters.src.filename, "toc")); } #+END_SRC @@ -1769,7 +1770,7 @@ void css(M)( auto return ref M doc_matters, ) { auto css = SiSUcss(); - auto pth_html = SiSUpathsHTML!()(doc_matters.output_path, doc_matters.language); + auto pth_html = SiSUpathsHTML!()(doc_matters.output_path, doc_matters.src.language); try { if (!exists(pth_html.css)) { (pth_html.css).mkdirRecurse; @@ -1864,7 +1865,7 @@ xmlns="urn:oasis:names:tc:opendocument:xmlns:container"> #+BEGIN_SRC d string epub3_oebps_content(D,I,P)(D doc_abstraction, I doc_matters, P parts) { auto xhtml_format = outputXHTMLs(); - auto pth_epub3 = SiSUpathsEPUB!()(doc_matters.output_path, doc_matters.language); + auto pth_epub3 = SiSUpathsEPUB!()(doc_matters.output_path, doc_matters.src.language); string uuid = "18275d951861c77f78acd05672c9906924c59f18a2e0ba06dad95959693e9bd8"; // TODO sort uuid in doc_matters! string content = format(q"¶ @@ -1903,7 +1904,7 @@ string epub3_oebps_content(D,I,P)(D doc_abstraction, I doc_matters, P parts) { ? "" : 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.language, // language, fix (needed in dochead metadata) + doc_matters.src.language, // language, fix (needed in dochead metadata) (doc_matters.conf_make_meta.meta.date_published.empty) ? "" : xhtml_format.special_characters_text(doc_matters.conf_make_meta.meta.date_published), (doc_matters.conf_make_meta.meta.rights_copyright.empty) @@ -1911,17 +1912,17 @@ string epub3_oebps_content(D,I,P)(D doc_abstraction, I doc_matters, P parts) { uuid, uuid, uuid, - (pth_epub3.fn_oebps_css(doc_matters.source_filename)).chompPrefix("OEBPS/"), + (pth_epub3.fn_oebps_css(doc_matters.src.filename)).chompPrefix("OEBPS/"), ); content ~= " " ~ "" ~ "\n "; content ~= parts["manifest_documents"]; // TODO sort jpg & png content ~= " " ~ "" ~ "\n "; - foreach (image; doc_matters.image_list) { + foreach (image; doc_matters.src.image_list) { content ~= format(q"¶ ¶", image.baseName.stripExtension, - (pth_epub3.doc_oebps_image(doc_matters.source_filename)).chompPrefix("OEBPS/"), + (pth_epub3.doc_oebps_image(doc_matters.src.filename)).chompPrefix("OEBPS/"), image, image.extension.chompPrefix("."), ); @@ -1935,7 +1936,7 @@ string epub3_oebps_content(D,I,P)(D doc_abstraction, I doc_matters, P parts) { content ~= " " ~ "" ~ "\n "; content ~= "" ~ ""; debug(epubmanifest) { - foreach (s; doc_matters.keys_seq.seg) { + foreach (s; doc_matters.xml.keys_seq.seg) { foreach (obj; doc_abstraction[s]) { if (obj.is_a == "heading") { if (obj.heading_lev_markup == 4) { @@ -1985,7 +1986,7 @@ string epub3_oebps_toc_nav_xhtml(D,I)(D doc_abstraction, I doc_matters) {