aboutsummaryrefslogtreecommitdiffhomepage
path: root/org/output_xmls.org
diff options
context:
space:
mode:
Diffstat (limited to 'org/output_xmls.org')
-rw-r--r--org/output_xmls.org375
1 files changed, 239 insertions, 136 deletions
diff --git a/org/output_xmls.org b/org/output_xmls.org
index 060a75c..ef8e15e 100644
--- a/org/output_xmls.org
+++ b/org/output_xmls.org
@@ -66,16 +66,10 @@ string div_delimit(
case "head":
delimit_ ~= "\n<div class=\"doc_title\">\n" ;
break;
- case "toc_seg":
+ case "toc":
delimit_ ~= "\n<div class=\"doc_toc\">\n" ;
break;
- case "toc_scroll":
- delimit_ ~= "\n<div class=\"doc_toc\">\n" ;
- break;
- case "bookindex_seg":
- delimit_ ~= "\n<div class=\"doc_bookindex\">\n" ;
- break;
- case "bookindex_scroll":
+ case "bookindex":
delimit_ ~= "\n<div class=\"doc_bookindex\">\n" ;
break;
default:
@@ -458,6 +452,7 @@ auto inline_links(M,O)(
string _suffix = ".html",
string _xml_type = "seg",
) {
+ string seg_lvs;
if (obj.has.inline_links) {
if ((_txt.match(rgx.mark_internal_site_lnk))
&& (_xml_type == "scroll")) { // conditions reversed to avoid: gdc compiled program run segfault
@@ -466,9 +461,13 @@ auto inline_links(M,O)(
"$1");
}
if (_xml_type == "seg" || _xml_type == "epub") {
+ seg_lvs = (_xml_type == "epub") ? "seg_lv1_to_4" : "seg_lv4";
foreach (m; _txt.match(rgx.inline_link_hash)) {
if (m.captures[3] in doc_matters.xml.tag_associations) {
- if (m.captures[3] == doc_matters.xml.tag_associations[(m.captures[3])][0]) {
+ if (
+ m.captures[3]
+ == doc_matters.xml.tag_associations[(m.captures[3])][seg_lvs]
+ ) {
_txt = _txt.replaceFirst(
rgx.inline_link_hash,
"┥$1┝┤$3" ~ _suffix ~ "├"
@@ -477,7 +476,7 @@ auto inline_links(M,O)(
_txt = _txt.replaceFirst(
rgx.inline_link_hash,
"┥$1┝┤"
- ~ doc_matters.xml.tag_associations[(m.captures[3])][0]
+ ~ doc_matters.xml.tag_associations[(m.captures[3])][seg_lvs]
~ _suffix
~ "#" ~ "$3"
~ "├"
@@ -485,7 +484,9 @@ auto inline_links(M,O)(
}
} else {
writeln(
- "WARNING on internal document links, anchor to link not found in document, "
+ "WARNING on internal document links, anchor to link <<"
+ ~ m.captures[3]
+ ~ ">> not found in document, "
~ "anchor: " ~ m.captures[3]
~ " document: " ~ doc_matters.src.filename
);
@@ -1438,7 +1439,7 @@ void scroll(D,M)(
delimit = xhtml_format.div_delimit(part, previous_part);
string _txt = xhtml_format.special_characters(obj, obj.text);
switch (obj.metainfo.is_of_part) {
- case "frontmatter": assert(part == "head" || "toc_scroll");
+ case "frontmatter": assert(part == "head" || "toc");
switch (obj.metainfo.is_of_type) {
case "para":
switch (obj.metainfo.is_a) {
@@ -1449,15 +1450,21 @@ void scroll(D,M)(
doc_html ~= xhtml_format.para_scroll(doc_matters, obj, _txt, suffix);
break;
default:
- if ((doc_matters.opt.action.debug_do)) {
- writeln(__FILE__, ":", __LINE__, ": ", obj.metainfo.is_a);
+ { /+ debug +/
+ if (doc_matters.opt.action.debug_do
+ && doc_matters.opt.action.verbose) {
+ writeln(__FILE__, ":", __LINE__, ": ", obj.metainfo.is_a);
+ }
}
break;
}
break;
default:
- if ((doc_matters.opt.action.debug_do)) {
- writeln(__FILE__, ":", __LINE__, ": ", obj.metainfo.is_of_type);
+ { /+ debug +/
+ if (doc_matters.opt.action.debug_do
+ && doc_matters.opt.action.verbose) {
+ writeln(__FILE__, ":", __LINE__, ": ", obj.metainfo.is_of_type);
+ }
}
break;
}
@@ -1473,8 +1480,11 @@ void scroll(D,M)(
doc_html ~= xhtml_format.para_scroll(doc_matters, obj, _txt, suffix);
break;
default:
- if ((doc_matters.opt.action.debug_do)) {
- writeln(__FILE__, ":", __LINE__, ": ", obj.metainfo.is_a);
+ { /+ debug +/
+ if (doc_matters.opt.action.debug_do
+ && doc_matters.opt.action.verbose) {
+ writeln(__FILE__, ":", __LINE__, ": ", obj.metainfo.is_a);
+ }
}
break;
}
@@ -1502,21 +1512,27 @@ void scroll(D,M)(
doc_html ~= xhtml_format.table(doc_matters, obj, _txt);
break;
default:
- if ((doc_matters.opt.action.debug_do)) {
- writeln(__FILE__, ":", __LINE__, ": ", obj.metainfo.is_a);
+ { /+ debug +/
+ if (doc_matters.opt.action.debug_do
+ && doc_matters.opt.action.verbose) {
+ writeln(__FILE__, ":", __LINE__, ": ", obj.metainfo.is_a);
+ }
}
break;
}
break;
default:
- if ((doc_matters.opt.action.debug_do)) {
- writeln(__FILE__, ":", __LINE__, ": ", obj.metainfo.is_of_type);
+ { /+ debug +/
+ if (doc_matters.opt.action.debug_do
+ && doc_matters.opt.action.verbose) {
+ writeln(__FILE__, ":", __LINE__, ": ", obj.metainfo.is_of_type);
+ }
}
break;
}
break;
case "backmatter":
- assert(part == "endnotes" || "glossary" || "bibliography" || "bookindex_scroll" || "blurb" || "tail");
+ assert(part == "endnotes" || "glossary" || "bibliography" || "bookindex" || "blurb" || "tail");
switch (obj.metainfo.is_of_type) {
case "para":
switch (obj.metainfo.is_a) {
@@ -1532,22 +1548,28 @@ void scroll(D,M)(
case "bibliography": assert(part == "bibliography");
doc_html ~= xhtml_format.para_scroll(doc_matters, obj, _txt, suffix);
break;
- case "bookindex": assert(part == "bookindex_scroll");
+ case "bookindex": assert(part == "bookindex");
doc_html ~= xhtml_format.para_scroll(doc_matters, obj, _txt, suffix);
break;
case "blurb": assert(part == "blurb");
doc_html ~= xhtml_format.para_scroll(doc_matters, obj, _txt, suffix);
break;
default:
- if ((doc_matters.opt.action.debug_do)) {
- writeln(__FILE__, ":", __LINE__, ": ", obj.metainfo.is_a);
+ { /+ debug +/
+ if (doc_matters.opt.action.debug_do
+ && doc_matters.opt.action.verbose) {
+ writeln(__FILE__, ":", __LINE__, ": ", obj.metainfo.is_a);
+ }
}
break;
}
break;
default:
- if ((doc_matters.opt.action.debug_do)) {
- writeln(__FILE__, ":", __LINE__, ": ", obj.metainfo.is_of_type);
+ { /+ debug +/
+ if (doc_matters.opt.action.debug_do
+ && doc_matters.opt.action.verbose) {
+ writeln(__FILE__, ":", __LINE__, ": ", obj.metainfo.is_of_type);
+ }
}
break;
}
@@ -1555,10 +1577,13 @@ void scroll(D,M)(
case "comment":
break;
default:
- if ((doc_matters.opt.action.debug_do)) {
- writeln(__FILE__, ":", __LINE__, ": ", obj.metainfo.is_of_part);
- writeln(__FILE__, ":", __LINE__, ": ", obj.metainfo.is_a);
- writeln(__FILE__, ":", __LINE__, ": ", obj.text);
+ { /+ debug +/
+ if (doc_matters.opt.action.debug_do
+ && doc_matters.opt.action.verbose) {
+ writeln(__FILE__, ":", __LINE__, ": ", obj.metainfo.is_of_part);
+ writeln(__FILE__, ":", __LINE__, ": ", obj.metainfo.is_a);
+ writeln(__FILE__, ":", __LINE__, ": ", obj.text);
+ }
}
break;
}
@@ -1624,7 +1649,7 @@ void seg(D,M)(
delimit = xhtml_format.div_delimit(part, previous_part);
string _txt = xhtml_format.special_characters(obj, obj.text);
if (obj.metainfo.is_a == "heading") {
- assert(part == "head" || "toc_seg" || "body" || "endnotes" || "glossary" || "bibliography" || "bookindex_seg" || "blurb" || "tail");
+ assert(part == "head" || "toc" || "body" || "endnotes" || "glossary" || "bibliography" || "bookindex" || "blurb" || "tail");
switch (obj.metainfo.heading_lev_markup) {
case 0: .. case 3:
/+ fill buffer, and replace with new levels from 1 to 3 +/
@@ -1673,21 +1698,27 @@ void seg(D,M)(
doc_html_endnotes[segment_filename] ~= t[1];
break;
case 8: .. case 9:
- if ((doc_matters.opt.action.debug_do)) {
- writeln(__FILE__, ":", __LINE__, ": ", obj.metainfo.is_a, ": ", obj.metainfo.heading_lev_markup);
- writeln(__FILE__, ":", __LINE__, ": ", obj.text);
+ { /+ debug +/
+ if (doc_matters.opt.action.debug_do
+ && doc_matters.opt.action.verbose) {
+ writeln(__FILE__, ":", __LINE__, ": ", obj.metainfo.is_a, ": ", obj.metainfo.heading_lev_markup);
+ writeln(__FILE__, ":", __LINE__, ": ", obj.text);
+ }
}
break;
default:
- if ((doc_matters.opt.action.debug_do)) {
- writeln(__FILE__, ":", __LINE__, ": ", obj.metainfo.is_a, ": ", obj.metainfo.heading_lev_markup);
+ { /+ debug +/
+ if (doc_matters.opt.action.debug_do
+ && doc_matters.opt.action.verbose) {
+ writeln(__FILE__, ":", __LINE__, ": ", obj.metainfo.is_a, ": ", obj.metainfo.heading_lev_markup);
+ }
}
break;
}
} else {
- assert(part == "head" || "toc_seg" || "body" || "endnotes" || "glossary" || "bibliography" || "bookindex_seg" || "blurb" || "tail");
+ assert(part == "head" || "toc" || "body" || "endnotes" || "glossary" || "bibliography" || "bookindex" || "blurb" || "tail");
switch (obj.metainfo.is_of_part) {
- case "frontmatter": assert(part == "head" || "toc_seg");
+ case "frontmatter": assert(part == "head" || "toc");
switch (obj.metainfo.is_of_type) {
case "para":
switch (obj.metainfo.is_a) {
@@ -1696,15 +1727,21 @@ void seg(D,M)(
doc_html[segment_filename] ~= t[0].to!string;
break;
default:
- if ((doc_matters.opt.action.debug_do)) {
- writeln(__FILE__, ":", __LINE__, ": ", obj.metainfo.is_a);
+ { /+ debug +/
+ if (doc_matters.opt.action.debug_do
+ && doc_matters.opt.action.verbose) {
+ writeln(__FILE__, ":", __LINE__, ": ", obj.metainfo.is_a);
+ }
}
break;
}
break;
default:
- if ((doc_matters.opt.action.debug_do)) {
- writeln(__FILE__, ":", __LINE__, ": ", obj.metainfo.is_a);
+ { /+ debug +/
+ if (doc_matters.opt.action.debug_do
+ && doc_matters.opt.action.verbose) {
+ writeln(__FILE__, ":", __LINE__, ": ", obj.metainfo.is_a);
+ }
}
break;
}
@@ -1719,8 +1756,11 @@ void seg(D,M)(
doc_html_endnotes[segment_filename] ~= t[1];
break;
default:
- if ((doc_matters.opt.action.debug_do)) {
- writeln(__FILE__, ":", __LINE__, ": ", obj.metainfo.is_a);
+ { /+ debug +/
+ if (doc_matters.opt.action.debug_do
+ && doc_matters.opt.action.verbose) {
+ writeln(__FILE__, ":", __LINE__, ": ", obj.metainfo.is_a);
+ }
}
break;
}
@@ -1757,21 +1797,27 @@ void seg(D,M)(
doc_html_endnotes[segment_filename] ~= "";
break;
default:
- if ((doc_matters.opt.action.debug_do)) {
- writeln(__FILE__, ":", __LINE__, ": ", obj.metainfo.is_a);
+ { /+ debug +/
+ if (doc_matters.opt.action.debug_do
+ && doc_matters.opt.action.verbose) {
+ writeln(__FILE__, ":", __LINE__, ": ", obj.metainfo.is_a);
+ }
}
break;
}
break;
default:
- if ((doc_matters.opt.action.debug_do)) {
- writeln(__FILE__, ":", __LINE__, ": ", obj.metainfo.is_of_type);
+ { /+ debug +/
+ if (doc_matters.opt.action.debug_do
+ && doc_matters.opt.action.verbose) {
+ writeln(__FILE__, ":", __LINE__, ": ", obj.metainfo.is_of_type);
+ }
}
break;
}
break;
case "backmatter":
- assert(part == "endnotes" || "glossary" || "bibliography" || "bookindex_seg" || "blurb" || "tail");
+ assert(part == "endnotes" || "glossary" || "bibliography" || "bookindex" || "blurb" || "tail");
switch (obj.metainfo.is_of_type) {
case "para":
switch (obj.metainfo.is_a) {
@@ -1789,7 +1835,7 @@ void seg(D,M)(
doc_html[segment_filename] ~= t[0];
doc_html_endnotes[segment_filename] ~= t[1];
break;
- case "bookindex": assert(part == "bookindex_seg");
+ case "bookindex": assert(part == "bookindex");
auto t = xhtml_format.para_seg(doc_matters, obj, _txt, suffix, "seg");
doc_html[segment_filename] ~= t[0];
doc_html_endnotes[segment_filename] ~= t[1];
@@ -1800,15 +1846,21 @@ void seg(D,M)(
doc_html_endnotes[segment_filename] ~= t[1];
break;
default:
- if ((doc_matters.opt.action.debug_do)) {
- writeln(__FILE__, ":", __LINE__, ": ", obj.metainfo.is_a);
+ { /+ debug +/
+ if (doc_matters.opt.action.debug_do
+ && doc_matters.opt.action.verbose) {
+ writeln(__FILE__, ":", __LINE__, ": ", obj.metainfo.is_a);
+ }
}
break;
}
break;
default:
- if ((doc_matters.opt.action.debug_do)) {
- writeln(__FILE__, ":", __LINE__, ": ", obj.metainfo.is_of_type);
+ { /+ debug +/
+ if (doc_matters.opt.action.debug_do
+ && doc_matters.opt.action.verbose) {
+ writeln(__FILE__, ":", __LINE__, ": ", obj.metainfo.is_of_type);
+ }
}
break;
}
@@ -1816,8 +1868,11 @@ void seg(D,M)(
case "comment":
break;
default:
- if ((doc_matters.opt.action.debug_do)) {
- writeln(__FILE__, ":", __LINE__, ": ", obj.metainfo.is_of_part);
+ { /+ debug +/
+ if (doc_matters.opt.action.debug_do
+ && doc_matters.opt.action.verbose) {
+ writeln(__FILE__, ":", __LINE__, ": ", obj.metainfo.is_of_part);
+ }
}
break;
}
@@ -2070,8 +2125,8 @@ string epub3_oebps_content(D,M,P)(D doc_abstraction, M doc_matters, P parts) {
content ~= " " ~ "</guide>" ~ "\n ";
content ~= "" ~ "</package>";
debug(epubmanifest) {
- foreach (s; doc_matters.xml.keys_seq.seg) {
- foreach (obj; doc_abstraction[s]) {
+ foreach (part; doc_matters.xml.keys_seq.seg) { // TODO
+ foreach (obj; doc_abstraction[part]) {
if (obj.metainfo.is_a == "heading") {
if (obj.metainfo.heading_lev_markup == 4) {
writefln(
@@ -2220,8 +2275,8 @@ string epub2_oebps_toc_ncx(D,I)(D doc_abstraction, I doc_matters) {
doc_matters.conf_make_meta.meta.title_full, // title
(doc_matters.conf_make_meta.meta.creator_author.empty) ? ""
: " by " ~ doc_matters.conf_make_meta.meta.creator_author, // author
- uuid, // uuid
- "3", // content depth
+ uuid, // uuid
+ "3", // content depth
doc_matters.conf_make_meta.meta.title_full, // title
(doc_matters.conf_make_meta.meta.creator_author.empty) ? ""
: doc_matters.conf_make_meta.meta.creator_author, // author
@@ -2302,7 +2357,7 @@ void outputEPub3(D,I)(
foreach (obj; doc_abstraction[part]) {
string _txt = xhtml_format.special_characters(obj, obj.text);
if (obj.metainfo.is_a == "heading") {
- assert(part == "head" || "toc_seg" || "body" || "endnotes" || "glossary" || "bibliography" || "bookindex_seg" || "blurb" || "tail");
+ assert(part == "head" || "toc" || "body" || "endnotes" || "glossary" || "bibliography" || "bookindex" || "blurb" || "tail");
switch (obj.metainfo.heading_lev_markup) {
case 0: .. case 3:
/+ fill buffer, and replace with new levels from 1 to 3 +/
@@ -2347,21 +2402,27 @@ void outputEPub3(D,I)(
doc_epub3_endnotes[segment_filename] ~= t[1];
break;
case 8: .. case 9:
- if ((doc_matters.opt.action.debug_do)) {
- writeln(__FILE__, ":", __LINE__, ": ", obj.metainfo.is_a, ": ", obj.metainfo.heading_lev_markup);
- writeln(__FILE__, ":", __LINE__, ": ", obj.text);
+ { /+ debug +/
+ if (doc_matters.opt.action.debug_do
+ && doc_matters.opt.action.verbose) {
+ writeln(__FILE__, ":", __LINE__, ": ", obj.metainfo.is_a, ": ", obj.metainfo.heading_lev_markup);
+ writeln(__FILE__, ":", __LINE__, ": ", obj.text);
+ }
}
break;
default:
- if ((doc_matters.opt.action.debug_do)) {
- writeln(__FILE__, ":", __LINE__, ": ", obj.metainfo.is_a, ": ", obj.metainfo.heading_lev_markup);
+ { /+ debug +/
+ if (doc_matters.opt.action.debug_do
+ && doc_matters.opt.action.verbose) {
+ writeln(__FILE__, ":", __LINE__, ": ", obj.metainfo.is_a, ": ", obj.metainfo.heading_lev_markup);
+ }
}
break;
}
} else {
- assert(part == "head" || "toc_seg" || "body" || "endnotes" || "glossary" || "bibliography" || "bookindex_seg" || "blurb" || "tail");
+ assert(part == "head" || "toc" || "body" || "endnotes" || "glossary" || "bibliography" || "bookindex" || "blurb" || "tail");
switch (obj.metainfo.is_of_part) {
- case "frontmatter": assert(part == "head" || "toc_seg");
+ case "frontmatter": assert(part == "head" || "toc");
switch (obj.metainfo.is_of_type) {
case "para":
switch (obj.metainfo.is_a) {
@@ -2371,15 +2432,21 @@ void outputEPub3(D,I)(
doc_epub3_endnotes[segment_filename] ~= t[1];
break;
default:
- if ((doc_matters.opt.action.debug_do)) {
- writeln(__FILE__, ":", __LINE__, ": ", obj.metainfo.is_a);
+ { /+ debug +/
+ if (doc_matters.opt.action.debug_do
+ && doc_matters.opt.action.verbose) {
+ writeln(__FILE__, ":", __LINE__, ": ", obj.metainfo.is_a);
+ }
}
break;
}
break;
default:
- if ((doc_matters.opt.action.debug_do)) {
- writeln(__FILE__, ":", __LINE__, ": ", obj.metainfo.is_of_type);
+ { /+ debug +/
+ if (doc_matters.opt.action.debug_do
+ && doc_matters.opt.action.verbose) {
+ writeln(__FILE__, ":", __LINE__, ": ", obj.metainfo.is_of_type);
+ }
}
break;
}
@@ -2394,8 +2461,11 @@ void outputEPub3(D,I)(
doc_epub3_endnotes[segment_filename] ~= t[1];
break;
default:
- if ((doc_matters.opt.action.debug_do)) {
- writeln(__FILE__, ":", __LINE__, ": ", obj.metainfo.is_a);
+ { /+ debug +/
+ if (doc_matters.opt.action.debug_do
+ && doc_matters.opt.action.verbose) {
+ writeln(__FILE__, ":", __LINE__, ": ", obj.metainfo.is_a);
+ }
}
break;
}
@@ -2432,21 +2502,27 @@ void outputEPub3(D,I)(
doc_epub3_endnotes[segment_filename] ~= "";
break;
default:
- if ((doc_matters.opt.action.debug_do)) {
- writeln(__FILE__, ":", __LINE__, ": ", obj.metainfo.is_a);
+ { /+ debug +/
+ if (doc_matters.opt.action.debug_do
+ && doc_matters.opt.action.verbose) {
+ writeln(__FILE__, ":", __LINE__, ": ", obj.metainfo.is_a);
+ }
}
break;
}
break;
default:
- if ((doc_matters.opt.action.debug_do)) {
- writeln(__FILE__, ":", __LINE__, ": ", obj.metainfo.is_of_type);
+ { /+ debug +/
+ if (doc_matters.opt.action.debug_do
+ && doc_matters.opt.action.verbose) {
+ writeln(__FILE__, ":", __LINE__, ": ", obj.metainfo.is_of_type);
+ }
}
break;
}
break;
case "backmatter":
- assert(part == "endnotes" || "glossary" || "bibliography" || "bookindex_seg" || "blurb" || "tail");
+ assert(part == "endnotes" || "glossary" || "bibliography" || "bookindex" || "blurb" || "tail");
switch (obj.metainfo.is_of_type) {
case "para":
switch (obj.metainfo.is_a) {
@@ -2464,7 +2540,7 @@ void outputEPub3(D,I)(
doc_epub3[segment_filename] ~= t[0];
doc_epub3_endnotes[segment_filename] ~= t[1];
break;
- case "bookindex": assert(part == "bookindex_seg");
+ case "bookindex": assert(part == "bookindex");
auto t = xhtml_format.para_seg(doc_matters, obj, _txt, suffix, "epub");
doc_epub3[segment_filename] ~= t[0];
doc_epub3_endnotes[segment_filename] ~= t[1];
@@ -2475,15 +2551,21 @@ void outputEPub3(D,I)(
doc_epub3_endnotes[segment_filename] ~= t[1];
break;
default:
- if ((doc_matters.opt.action.debug_do)) {
- writeln(__FILE__, ":", __LINE__, ": ", obj.metainfo.is_a);
+ { /+ debug +/
+ if (doc_matters.opt.action.debug_do
+ && doc_matters.opt.action.verbose) {
+ writeln(__FILE__, ":", __LINE__, ": ", obj.metainfo.is_a);
+ }
}
break;
}
break;
default:
- if ((doc_matters.opt.action.debug_do)) {
- writeln(__FILE__, ":", __LINE__, ": ", obj.metainfo.is_of_type);
+ { /+ debug +/
+ if (doc_matters.opt.action.debug_do
+ && doc_matters.opt.action.verbose) {
+ writeln(__FILE__, ":", __LINE__, ": ", obj.metainfo.is_of_type);
+ }
}
break;
}
@@ -2491,8 +2573,11 @@ void outputEPub3(D,I)(
case "comment":
break;
default:
- if ((doc_matters.opt.action.debug_do)) {
- writeln(__FILE__, ":", __LINE__, ": ", obj.metainfo.is_of_part);
+ { /+ debug +/
+ if (doc_matters.opt.action.debug_do
+ && doc_matters.opt.action.verbose) {
+ writeln(__FILE__, ":", __LINE__, ": ", obj.metainfo.is_of_part);
+ }
}
break;
}
@@ -2597,15 +2682,17 @@ void epub3_write_output_files(M,D,E,Mt,Mic,Otnx,Otn,Oc)(
if (!exists(pth_epub3.base)) {
pth_epub3.base.mkdirRecurse;
}
- debug(epub_output) {
- if (!exists(pth_epub3.dbg_doc_meta_inf(doc_matters.src.filename))) {
- pth_epub3.dbg_doc_meta_inf(doc_matters.src.filename).mkdirRecurse;
- }
- if (!exists(pth_epub3.dbg_doc_oebps_css(doc_matters.src.filename))) {
- pth_epub3.dbg_doc_oebps_css(doc_matters.src.filename).mkdirRecurse;
- }
- if (!exists(pth_epub3.dbg_doc_oebps_image(doc_matters.src.filename))) {
- pth_epub3.dbg_doc_oebps_image(doc_matters.src.filename).mkdirRecurse;
+ { /+ debug +/
+ if (doc_matters.opt.action.debug_do) {
+ if (!exists(pth_epub3.dbg_doc_meta_inf(doc_matters.src.filename))) {
+ pth_epub3.dbg_doc_meta_inf(doc_matters.src.filename).mkdirRecurse;
+ }
+ if (!exists(pth_epub3.dbg_doc_oebps_css(doc_matters.src.filename))) {
+ pth_epub3.dbg_doc_oebps_css(doc_matters.src.filename).mkdirRecurse;
+ }
+ if (!exists(pth_epub3.dbg_doc_oebps_image(doc_matters.src.filename))) {
+ pth_epub3.dbg_doc_oebps_image(doc_matters.src.filename).mkdirRecurse;
+ }
}
}
{ /+ OEBPS/[segments].xhtml (the document contents) +/
@@ -2614,19 +2701,25 @@ void epub3_write_output_files(M,D,E,Mt,Mic,Otnx,Otn,Oc)(
auto zip_arc_member_file = new ArchiveMember();
zip_arc_member_file.name = fn;
auto zip_data = new OutBuffer();
- debug(epub_output) {
- string fn_dbg = pth_epub3.dbg_fn_oebps_content_xhtml(doc_matters.src.filename, seg_filename);
- auto f = File(fn_dbg, "w");
+ { /+ debug +/
+ if (doc_matters.opt.action.debug_do) {
+ string fn_dbg = pth_epub3.dbg_fn_oebps_content_xhtml(doc_matters.src.filename, seg_filename);
+ auto f = File(fn_dbg, "w");
+ foreach (docseg; doc_epub3[seg_filename]) {
+ f.writeln(docseg);
+ }
+ foreach (docseg; doc_epub3_endnotes[seg_filename]) {
+ f.writeln(docseg);
+ }
+ f.writeln(xhtml_format.tail);
+ }
}
foreach (docseg; doc_epub3[seg_filename]) {
- debug(epub_output) { f.writeln(docseg); }
zip_data.write(docseg.dup);
}
foreach (docseg; doc_epub3_endnotes[seg_filename]) {
- debug(epub_output) { f.writeln(docseg); }
zip_data.write(docseg.dup);
}
- debug(epub_output) { f.writeln(xhtml_format.tail); }
zip_data.write(xhtml_format.tail.dup);
zip_arc_member_file.expandedData = zip_data.toBytes();
zip.addMember(zip_arc_member_file);
@@ -2635,12 +2728,14 @@ void epub3_write_output_files(M,D,E,Mt,Mic,Otnx,Otn,Oc)(
}
}
string fn;
- debug(epub_output) { string fn_dbg; }
+ string fn_dbg;
File f;
{ /+ mimetypes (identify zip file type) +/
- debug(epub_output) {
- fn_dbg = pth_epub3.dbg_fn_mimetypes(doc_matters.src.filename);
- File(fn_dbg, "w").writeln(mimetypes);
+ { /+ debug +/
+ if (doc_matters.opt.action.debug_do) {
+ fn_dbg = pth_epub3.dbg_fn_mimetypes(doc_matters.src.filename);
+ File(fn_dbg, "w").writeln(mimetypes);
+ }
}
fn = pth_epub3.fn_mimetypes(doc_matters.src.filename);
auto zip_arc_member_file = new ArchiveMember();
@@ -2652,9 +2747,11 @@ void epub3_write_output_files(M,D,E,Mt,Mic,Otnx,Otn,Oc)(
createZipFile!()(fn_epub, zip.build());
}
{ /+ META-INF/container.xml (identify doc root) +/
- debug(epub_output) {
- fn_dbg = pth_epub3.dbg_fn_dmi_container_xml(doc_matters.src.filename);
- File(fn_dbg, "w").writeln(meta_inf_container_xml);
+ { /+ debug +/
+ if (doc_matters.opt.action.debug_do) {
+ fn_dbg = pth_epub3.dbg_fn_dmi_container_xml(doc_matters.src.filename);
+ File(fn_dbg, "w").writeln(meta_inf_container_xml);
+ }
}
fn = pth_epub3.fn_dmi_container_xml(doc_matters.src.filename);
auto zip_arc_member_file = new ArchiveMember();
@@ -2666,9 +2763,11 @@ void epub3_write_output_files(M,D,E,Mt,Mic,Otnx,Otn,Oc)(
createZipFile!()(fn_epub, zip.build());
}
{ /+ OEBPS/toc_nav.xhtml (navigation toc epub3) +/
- debug(epub_output) {
- fn_dbg = pth_epub3.dbg_fn_oebps_toc_nav_xhtml(doc_matters.src.filename);
- File(fn_dbg, "w").writeln(oebps_toc_nav_xhtml);
+ { /+ debug +/
+ if (doc_matters.opt.action.debug_do) {
+ fn_dbg = pth_epub3.dbg_fn_oebps_toc_nav_xhtml(doc_matters.src.filename);
+ File(fn_dbg, "w").writeln(oebps_toc_nav_xhtml);
+ }
}
fn = pth_epub3.fn_oebps_toc_nav_xhtml(doc_matters.src.filename);
auto zip_arc_member_file = new ArchiveMember();
@@ -2680,9 +2779,11 @@ void epub3_write_output_files(M,D,E,Mt,Mic,Otnx,Otn,Oc)(
createZipFile!()(fn_epub, zip.build());
}
{ /+ OEBPS/toc.ncx (navigation toc epub2) +/
- debug(epub_output) {
- fn_dbg = pth_epub3.dbg_fn_oebps_toc_ncx(doc_matters.src.filename);
- File(fn_dbg, "w").writeln(oebps_toc_ncx);
+ { /+ debug +/
+ if (doc_matters.opt.action.debug_do) {
+ fn_dbg = pth_epub3.dbg_fn_oebps_toc_ncx(doc_matters.src.filename);
+ File(fn_dbg, "w").writeln(oebps_toc_ncx);
+ }
}
fn = pth_epub3.fn_oebps_toc_ncx(doc_matters.src.filename);
auto zip_arc_member_file = new ArchiveMember();
@@ -2694,9 +2795,11 @@ void epub3_write_output_files(M,D,E,Mt,Mic,Otnx,Otn,Oc)(
createZipFile!()(fn_epub, zip.build());
}
{ /+ OEBPS/content.opf (doc manifest) +/
- debug(epub_output) {
- fn_dbg = pth_epub3.dbg_fn_oebps_content_opf(doc_matters.src.filename);
- File(fn_dbg, "w").writeln(oebps_content_opf);
+ { /+ debug +/
+ if (doc_matters.opt.action.debug_do) {
+ fn_dbg = pth_epub3.dbg_fn_oebps_content_opf(doc_matters.src.filename);
+ File(fn_dbg, "w").writeln(oebps_content_opf);
+ }
}
fn = pth_epub3.fn_oebps_content_opf(doc_matters.src.filename);
auto zip_arc_member_file = new ArchiveMember();
@@ -2709,20 +2812,18 @@ void epub3_write_output_files(M,D,E,Mt,Mic,Otnx,Otn,Oc)(
}
{ /+ OEBPS/_sisu/image (images) +/
foreach (image; doc_matters.srcs.image_list) {
- debug(epub_output) {
- if (exists(doc_matters.src_path_info.image_root ~ "/" ~ image)) {
- (doc_matters.src_path_info.image_root ~ "/" ~ image)
- .copy((pth_epub3.dbg_doc_oebps_image(doc_matters.src.filename)) ~ "/" ~ image);
- }
- }
- }
- foreach (image; doc_matters.srcs.image_list) {
- debug(epub_output) {
- debug(epub_images) {
- writeln(
- doc_matters.src.image_dir_path, "/", image, " -> ",
- pth_epub3.dbg_doc_oebps_image(doc_matters.src.filename), "/", image
- );
+ { /+ debug +/
+ if (doc_matters.opt.action.debug_do) {
+ if (doc_matters.opt.action.very_verbose) {
+ writeln(
+ doc_matters.src.image_dir_path, "/", image, " -> ",
+ pth_epub3.dbg_doc_oebps_image(doc_matters.src.filename), "/", image
+ );
+ }
+ if (exists(doc_matters.src.image_dir_path ~ "/" ~ image)) {
+ (doc_matters.src.image_dir_path ~ "/" ~ image)
+ .copy((pth_epub3.dbg_doc_oebps_image(doc_matters.src.filename)) ~ "/" ~ image);
+ }
}
}
auto fn_src = doc_matters.src.image_dir_path ~ "/" ~ image;
@@ -2742,9 +2843,11 @@ void epub3_write_output_files(M,D,E,Mt,Mic,Otnx,Otn,Oc)(
}
{ /+ OEBPS/epub.css +/
auto css = DocReformCss();
- debug(epub_output) {
- fn_dbg = pth_epub3.dbg_fn_oebps_css(doc_matters.src.filename);
- File(fn_dbg, "w").writeln(css.epub_css);
+ { /+ debug +/
+ if (doc_matters.opt.action.debug_do) {
+ fn_dbg = pth_epub3.dbg_fn_oebps_css(doc_matters.src.filename);
+ File(fn_dbg, "w").writeln(css.epub_css);
+ }
}
fn = pth_epub3.fn_oebps_css(doc_matters.src.filename);
auto zip_arc_member_file = new ArchiveMember();