aboutsummaryrefslogtreecommitdiffhomepage
path: root/org/out_xmls.org
diff options
context:
space:
mode:
Diffstat (limited to 'org/out_xmls.org')
-rw-r--r--org/out_xmls.org325
1 files changed, 154 insertions, 171 deletions
diff --git a/org/out_xmls.org b/org/out_xmls.org
index c3b9aab..65afb8c 100644
--- a/org/out_xmls.org
+++ b/org/out_xmls.org
@@ -4,7 +4,7 @@
#+FILETAGS: :spine:output:xml:
#+AUTHOR: Ralph Amissah
#+EMAIL: [[mailto:ralph.amissah@gmail.com][ralph.amissah@gmail.com]]
-#+COPYRIGHT: Copyright (C) 2015 - 2024 Ralph Amissah
+#+COPYRIGHT: Copyright (C) 2015 - 2025 Ralph Amissah
#+LANGUAGE: en
#+STARTUP: content hideblocks hidestars noindent entitiespretty
#+PROPERTY: header-args :exports code
@@ -20,7 +20,7 @@
#+NAME: year
#+BEGIN_SRC text
-2024
+2025
#+END_SRC
* xml offspring (xhtml html epub)
@@ -91,38 +91,34 @@ template outputXHTMLs() {
#+NAME: output_imports_xml
#+BEGIN_SRC d
-import
- std.file,
- std.outbuffer,
- std.uri,
- std.conv : to;
-import
- sisudoc.io_out,
- sisudoc.io_out.rgx,
- sisudoc.meta.rgx_files,
- sisudoc.io_out.rgx_xhtml,
- sisudoc.io_out.create_zip_file,
- sisudoc.io_out.xmls,
- sisudoc.io_out.xmls_css;
+import std.file;
+import std.outbuffer;
+import std.uri;
+import std.conv : to;
+import sisudoc.io_out;
+import sisudoc.io_out.rgx;
+import sisudoc.meta.rgx_files;
+import sisudoc.io_out.rgx_xhtml;
+import sisudoc.io_out.create_zip_file;
+import sisudoc.io_out.xmls;
+import sisudoc.io_out.xmls_css;
#+END_SRC
**** epub3
#+NAME: output_imports_epub
#+BEGIN_SRC d
-import
- std.file,
- std.outbuffer,
- std.uri,
- std.zip,
- std.conv : to;
-import
- sisudoc.io_out,
- sisudoc.io_out.rgx,
- sisudoc.io_out.rgx_xhtml,
- sisudoc.io_out.create_zip_file,
- sisudoc.io_out.xmls,
- sisudoc.io_out.xmls_css;
+import std.file;
+import std.outbuffer;
+import std.uri;
+import std.zip;
+import std.conv : to;
+import sisudoc.io_out;
+import sisudoc.io_out.rgx;
+import sisudoc.io_out.rgx_xhtml;
+import sisudoc.io_out.create_zip_file;
+import sisudoc.io_out.xmls;
+import sisudoc.io_out.xmls_css;
#+END_SRC
*** misc
@@ -1766,10 +1762,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 +1771,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 +1798,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 +1808,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 +1824,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 +1840,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 +1858,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 +1875,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 +1905,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 +1924,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 +1955,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 +1966,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 +1982,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 +2007,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 +2044,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 +2056,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 +2091,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 +2125,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 +2152,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 +2166,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 +2184,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 +2200,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 +2229,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 +2238,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 +2257,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 +2296,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 +2307,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 +2322,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 +2407,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 +2549,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 +2576,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 +2612,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 +2645,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 +2664,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 +2725,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 +2765,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 +2793,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 +2828,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 +2837,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 +2857,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 +2884,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 +2899,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 +2917,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 +2933,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 +2972,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 +2991,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 +3030,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 +3047,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 +3116,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