aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/sdp/output
diff options
context:
space:
mode:
authorRalph Amissah <ralph@amissah.com>2018-01-06 20:34:42 -0500
committerRalph Amissah <ralph@amissah.com>2019-04-10 15:14:14 -0400
commitbdcb9189e4cf221bec1efaf2e6e612b127e51f25 (patch)
tree139cffff54a3afdfa9dd70799ef489c3fb51c73d /src/sdp/output
parenttarget config file locations, refine (diff)
0.23.3 work on source & target file paths/locations
Diffstat (limited to 'src/sdp/output')
-rw-r--r--src/sdp/output/epub3.d102
-rw-r--r--src/sdp/output/html.d62
-rw-r--r--src/sdp/output/hub.d125
-rw-r--r--src/sdp/output/paths_source.d491
-rw-r--r--src/sdp/output/rgx.d1
-rw-r--r--src/sdp/output/source_sisupod.d160
-rw-r--r--src/sdp/output/sqlite.d46
-rw-r--r--src/sdp/output/sqlite_discrete.d42
-rw-r--r--src/sdp/output/xmls.d12
9 files changed, 599 insertions, 442 deletions
diff --git a/src/sdp/output/epub3.d b/src/sdp/output/epub3.d
index 2641784..3c8eb4d 100644
--- a/src/sdp/output/epub3.d
+++ b/src/sdp/output/epub3.d
@@ -31,7 +31,7 @@ template outputEPub3() {
}
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"¶ <?xml version='1.0' encoding='utf-8'?>
<package xmlns="http://www.idpf.org/2007/opf" version="2.0" unique-identifier="EPB-UUID">
@@ -70,7 +70,7 @@ template outputEPub3() {
? "" : 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)
@@ -78,17 +78,17 @@ template outputEPub3() {
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 ~= " " ~ "<!-- Content Documents -->" ~ "\n ";
content ~= parts["manifest_documents"];
// TODO sort jpg & png
content ~= " " ~ "<!-- Images -->" ~ "\n ";
- foreach (image; doc_matters.image_list) {
+ foreach (image; doc_matters.src.image_list) {
content ~= format(q"¶ <item id="%s" href="%s/%s" media-type="image/%s" />
¶",
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("."),
);
@@ -102,7 +102,7 @@ template outputEPub3() {
content ~= " " ~ "</guide>" ~ "\n ";
content ~= "" ~ "</package>";
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) {
@@ -144,7 +144,7 @@ template outputEPub3() {
<nav epub:type=\"toc\" id=\"toc\">\n",
doc_matters.conf_make_meta.meta.title_full,
);
- foreach (sect; doc_matters.keys_seq.seg) {
+ foreach (sect; doc_matters.xml.keys_seq.seg) {
foreach (obj; doc_abstraction[sect]) {
if (obj.is_a == "heading") {
string _txt = obj.text.replaceAll(rgx.inline_notes_al_gen, "").strip;
@@ -241,7 +241,7 @@ template outputEPub3() {
(doc_matters.conf_make_meta.meta.creator_author.empty) ? ""
: doc_matters.conf_make_meta.meta.creator_author, // author
);
- foreach (sect; doc_matters.keys_seq.seg) {
+ foreach (sect; doc_matters.xml.keys_seq.seg) {
foreach (obj; doc_abstraction[sect]) {
if (obj.is_a == "heading") {
string _txt = obj.text.replaceAll(rgx.inline_notes_al_gen, "").strip;
@@ -307,7 +307,7 @@ template outputEPub3() {
string[string] oepbs_content_parts;
string suffix = ".xhtml";
string[] doc_parts_;
- foreach (part; doc_matters.keys_seq.seg) {
+ foreach (part; doc_matters.xml.keys_seq.seg) {
foreach (obj; doc_abstraction[part]) {
string _txt = xhtml_format.special_characters(obj, obj.text);
if (obj.is_a == "heading") {
@@ -356,13 +356,13 @@ template outputEPub3() {
doc_epub3_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;
@@ -380,14 +380,14 @@ template outputEPub3() {
doc_epub3_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;
@@ -403,7 +403,7 @@ template outputEPub3() {
doc_epub3_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;
@@ -442,14 +442,14 @@ template outputEPub3() {
doc_epub3_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;
@@ -485,14 +485,14 @@ template outputEPub3() {
doc_epub3_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;
@@ -501,7 +501,7 @@ template outputEPub3() {
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;
@@ -591,10 +591,10 @@ template outputEPub3() {
static assert(is(typeof(oebps_toc_ncx) == string));
static assert(is(typeof(oebps_content_opf) == string));
}
- auto pth_epub3 = SiSUpathsEPUB!()(doc_matters.output_path, doc_matters.language);
+ auto pth_epub3 = SiSUpathsEPUB!()(doc_matters.output_path, doc_matters.src.language);
auto xhtml_format = outputXHTMLs();
/+ zip file +/
- auto fn_epub = pth_epub3.epub_file(doc_matters.source_filename);
+ auto fn_epub = pth_epub3.epub_file(doc_matters.src.filename);
auto zip = new ZipArchive(); // ZipArchive zip = new ZipArchive();
/+ zip archive member files +/
try {
@@ -602,24 +602,24 @@ template outputEPub3() {
pth_epub3.base.mkdirRecurse;
}
debug(epub_output) {
- if (!exists(pth_epub3.dbg_doc_meta_inf(doc_matters.source_filename))) {
- pth_epub3.dbg_doc_meta_inf(doc_matters.source_filename).mkdirRecurse;
+ 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.source_filename))) {
- pth_epub3.dbg_doc_oebps_css(doc_matters.source_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.source_filename))) {
- pth_epub3.dbg_doc_oebps_image(doc_matters.source_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) +/
- foreach (seg_filename; doc_matters.segnames_lv_0_to_4) {
- string fn = pth_epub3.fn_oebps_content_xhtml(doc_matters.source_filename, seg_filename);
+ foreach (seg_filename; doc_matters.xml.segnames_lv_0_to_4) {
+ string fn = pth_epub3.fn_oebps_content_xhtml(doc_matters.src.filename, seg_filename);
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.source_filename, seg_filename);
+ 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]) {
@@ -643,10 +643,10 @@ template outputEPub3() {
File f;
{ /+ mimetypes (identify zip file type) +/
debug(epub_output) {
- fn_dbg = pth_epub3.dbg_fn_mimetypes(doc_matters.source_filename);
+ fn_dbg = pth_epub3.dbg_fn_mimetypes(doc_matters.src.filename);
File(fn_dbg, "w").writeln(mimetypes);
}
- fn = pth_epub3.fn_mimetypes(doc_matters.source_filename);
+ fn = pth_epub3.fn_mimetypes(doc_matters.src.filename);
auto zip_arc_member_file = new ArchiveMember();
zip_arc_member_file.name = fn;
auto zip_data = new OutBuffer();
@@ -657,10 +657,10 @@ template outputEPub3() {
}
{ /+ META-INF/container.xml (identify doc root) +/
debug(epub_output) {
- fn_dbg = pth_epub3.dbg_fn_dmi_container_xml(doc_matters.source_filename);
+ 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.source_filename);
+ fn = pth_epub3.fn_dmi_container_xml(doc_matters.src.filename);
auto zip_arc_member_file = new ArchiveMember();
zip_arc_member_file.name = fn;
auto zip_data = new OutBuffer();
@@ -671,10 +671,10 @@ template outputEPub3() {
}
{ /+ OEBPS/toc_nav.xhtml (navigation toc epub3) +/
debug(epub_output) {
- fn_dbg = pth_epub3.dbg_fn_oebps_toc_nav_xhtml(doc_matters.source_filename);
+ 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.source_filename);
+ fn = pth_epub3.fn_oebps_toc_nav_xhtml(doc_matters.src.filename);
auto zip_arc_member_file = new ArchiveMember();
zip_arc_member_file.name = fn;
auto zip_data = new OutBuffer();
@@ -685,10 +685,10 @@ template outputEPub3() {
}
{ /+ OEBPS/toc.ncx (navigation toc epub2) +/
debug(epub_output) {
- fn_dbg = pth_epub3.dbg_fn_oebps_toc_ncx(doc_matters.source_filename);
+ 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.source_filename);
+ fn = pth_epub3.fn_oebps_toc_ncx(doc_matters.src.filename);
auto zip_arc_member_file = new ArchiveMember();
zip_arc_member_file.name = fn;
auto zip_data = new OutBuffer();
@@ -699,10 +699,10 @@ template outputEPub3() {
}
{ /+ OEBPS/content.opf (doc manifest) +/
debug(epub_output) {
- fn_dbg = pth_epub3.dbg_fn_oebps_content_opf(doc_matters.source_filename);
+ 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.source_filename);
+ fn = pth_epub3.fn_oebps_content_opf(doc_matters.src.filename);
auto zip_arc_member_file = new ArchiveMember();
zip_arc_member_file.name = fn;
auto zip_data = new OutBuffer();
@@ -712,25 +712,25 @@ template outputEPub3() {
createZipFile!()(fn_epub, zip.build());
}
{ /+ OEBPS/_sisu/image (images) +/
- foreach (image; doc_matters.image_list) {
+ foreach (image; doc_matters.src.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.source_filename)) ~ "/" ~ image);
+ 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.image_list) {
+ foreach (image; doc_matters.src.image_list) {
debug(epub_output) {
debug(epub_images) {
writeln(
- doc_matters.src_path_info.image_root, image, " -> ",
- pth_epub3.dbg_doc_oebps_image(doc_matters.source_filename), "/", image
+ doc_matters.src.path_info.image_root, image, " -> ",
+ pth_epub3.dbg_doc_oebps_image(doc_matters.src.filename), "/", image
);
}
}
- auto fn_src = doc_matters.src_path_info.image_root ~ image;
- auto fn_out = pth_epub3.doc_oebps_image(doc_matters.source_filename).to!string ~ "/" ~ image;
+ auto fn_src = doc_matters.src.path_info.image_root ~ image;
+ auto fn_out = pth_epub3.doc_oebps_image(doc_matters.src.filename).to!string ~ "/" ~ image;
if (exists(fn_src)) {
{
auto zip_arc_member_file = new ArchiveMember();
@@ -747,10 +747,10 @@ template outputEPub3() {
{ /+ OEBPS/epub.css +/
auto css = SiSUcss();
debug(epub_output) {
- fn_dbg = pth_epub3.dbg_fn_oebps_css(doc_matters.source_filename);
+ 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.source_filename);
+ fn = pth_epub3.fn_oebps_css(doc_matters.src.filename);
auto zip_arc_member_file = new ArchiveMember();
zip_arc_member_file.name = fn;
auto zip_data = new OutBuffer();
diff --git a/src/sdp/output/html.d b/src/sdp/output/html.d
index 6767e11..10539a5 100644
--- a/src/sdp/output/html.d
+++ b/src/sdp/output/html.d
@@ -24,7 +24,7 @@ template outputHTML() {
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);
@@ -40,14 +40,14 @@ template outputHTML() {
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;
@@ -64,7 +64,7 @@ template outputHTML() {
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;
@@ -93,14 +93,14 @@ template outputHTML() {
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;
@@ -130,14 +130,14 @@ template outputHTML() {
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;
@@ -146,7 +146,7 @@ template outputHTML() {
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);
@@ -165,12 +165,12 @@ template outputHTML() {
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);
}
@@ -178,7 +178,7 @@ template outputHTML() {
catch (ErrnoException ex) {
// Handle error
}
- writeln(" ", pth_html.fn_scroll(doc_matters.source_filename));
+ writeln(" ", pth_html.fn_scroll(doc_matters.src.filename));
}
void seg(D,I)(
auto return ref const D doc_abstraction,
@@ -196,7 +196,7 @@ template outputHTML() {
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);
@@ -251,13 +251,13 @@ template outputHTML() {
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;
@@ -274,14 +274,14 @@ template outputHTML() {
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;
@@ -297,7 +297,7 @@ template outputHTML() {
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;
@@ -335,14 +335,14 @@ template outputHTML() {
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;
@@ -378,14 +378,14 @@ template outputHTML() {
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;
@@ -394,7 +394,7 @@ template outputHTML() {
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;
@@ -414,15 +414,15 @@ template outputHTML() {
}
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);
}
@@ -435,13 +435,13 @@ template outputHTML() {
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"));
}
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;
diff --git a/src/sdp/output/hub.d b/src/sdp/output/hub.d
index 1600dd2..7f03360 100644
--- a/src/sdp/output/hub.d
+++ b/src/sdp/output/hub.d
@@ -16,73 +16,108 @@ template outputHub() {
void outputHub(D,I)(D doc_abstraction, I doc_matters) {
mixin SiSUoutputRgxInit;
static auto rgx = Rgx();
- if ((doc_matters.opt_action.verbose)) {
- writeln(doc_matters.keys_seq.seg);
+ if ((doc_matters.opt.action.verbose)) {
+ writeln(doc_matters.xml.keys_seq.seg);
}
- if ((doc_matters.opt_action.source)
- || (doc_matters.opt_action.sisupod)) {
- if ((doc_matters.opt_action.verbose)
- && (doc_matters.opt_action.source))
- { writeln("sisu source processing... "); }
- if ((doc_matters.opt_action.verbose)
- && (doc_matters.opt_action.sisupod))
- { writeln("sisupod source processing... "); }
+ if ((doc_matters.opt.action.source)
+ || (doc_matters.opt.action.sisupod)) {
+ if ((doc_matters.opt.action.verbose)
+ && (doc_matters.opt.action.source)) {
+ writeln("sisu source processing... ");
+ }
+ if ((doc_matters.opt.action.verbose)
+ && (doc_matters.opt.action.sisupod)) {
+ writeln("sisupod source processing... ");
+ }
SiSUpod!()(doc_matters);
- if ((doc_matters.opt_action.verbose)
- && (doc_matters.opt_action.debug_do)
- && (doc_matters.opt_action.source))
- { writeln("sisu source done"); }
- if ((doc_matters.opt_action.verbose)
- && (doc_matters.opt_action.debug_do)
- && (doc_matters.opt_action.sisupod))
- { writeln("sisupod done"); }
+ if ((doc_matters.opt.action.verbose)
+ && (doc_matters.opt.action.debug_do)
+ && (doc_matters.opt.action.source)) {
+ writeln("sisu source done");
+ }
+ if ((doc_matters.opt.action.verbose)
+ && (doc_matters.opt.action.debug_do)
+ && (doc_matters.opt.action.sisupod)) {
+ writeln("sisupod done");
+ }
}
- if (doc_matters.opt_action.text) {
+ if (doc_matters.opt.action.text) {
/+ mixin outputText; +/
- if ((doc_matters.opt_action.verbose)) { writeln("text processing... "); }
+ if ((doc_matters.opt.action.verbose)) {
+ writeln("text processing... ");
+ }
}
- if (doc_matters.opt_action.html) {
- if ((doc_matters.opt_action.verbose)) { writeln("html scroll processing... "); }
+ if (doc_matters.opt.action.html) {
+ if ((doc_matters.opt.action.verbose)) {
+ writeln("html scroll processing... ");
+ }
outputHTML!().scroll(doc_abstraction, doc_matters);
- if ((doc_matters.opt_action.verbose) && (doc_matters.opt_action.debug_do)) { writeln("html scroll done"); }
- if ((doc_matters.opt_action.verbose)) { writeln("html seg processing... "); }
+ if ((doc_matters.opt.action.verbose)
+ && (doc_matters.opt.action.debug_do)) {
+ writeln("html scroll done");
+ }
+ if ((doc_matters.opt.action.verbose)) {
+ writeln("html seg processing... ");
+ }
outputHTML!().seg(doc_abstraction, doc_matters);
- if ((doc_matters.opt_action.verbose) && (doc_matters.opt_action.debug_do)) { writeln("html seg done"); }
+ if ((doc_matters.opt.action.verbose)
+ && (doc_matters.opt.action.debug_do)) {
+ writeln("html seg done");
+ }
outputHTML!().css(doc_matters);
- } else if (doc_matters.opt_action.html_seg) {
- if ((doc_matters.opt_action.verbose)) { writeln("html seg processing... "); }
+ } else if (doc_matters.opt.action.html_seg) {
+ if ((doc_matters.opt.action.verbose)) {
+ writeln("html seg processing... ");
+ }
outputHTML!().seg(doc_abstraction, doc_matters);
- if ((doc_matters.opt_action.verbose) && (doc_matters.opt_action.debug_do)) { writeln("html seg done"); }
+ if ((doc_matters.opt.action.verbose)
+ && (doc_matters.opt.action.debug_do)) {
+ writeln("html seg done");
+ }
outputHTML!().css(doc_matters);
- } else if (doc_matters.opt_action.html_scroll) {
- if ((doc_matters.opt_action.verbose)) { writeln("html scroll processing... "); }
+ } else if (doc_matters.opt.action.html_scroll) {
+ if ((doc_matters.opt.action.verbose)) {
+ writeln("html scroll processing... ");
+ }
outputHTML!().scroll(doc_abstraction, doc_matters);
- if ((doc_matters.opt_action.verbose) && (doc_matters.opt_action.debug_do)) { writeln("html scroll done"); }
+ if ((doc_matters.opt.action.verbose)
+ && (doc_matters.opt.action.debug_do)) {
+ writeln("html scroll done");
+ }
outputHTML!().css(doc_matters);
}
- if (doc_matters.opt_action.epub) {
- if ((doc_matters.opt_action.verbose)) { writeln("epub3 processing... "); }
+ if (doc_matters.opt.action.epub) {
+ if ((doc_matters.opt.action.verbose)) {
+ writeln("epub3 processing... ");
+ }
outputEPub3!()(doc_abstraction, doc_matters);
// epub.css_write;
- if ((doc_matters.opt_action.verbose) && (doc_matters.opt_action.debug_do)) { writeln("epub3 done"); }
+ if ((doc_matters.opt.action.verbose)
+ && (doc_matters.opt.action.debug_do)) {
+ writeln("epub3 done");
+ }
}
- if (doc_matters.opt_action.pdf) {
+ if (doc_matters.opt.action.pdf) {
/+ mixin outputPDF; +/
writeln("pdf processing");
}
- if (doc_matters.opt_action.odt) {
+ if (doc_matters.opt.action.odt) {
/+ mixin outputODT; +/
writeln("odt processing");
}
- if (doc_matters.opt_action.sqlite_discrete) {
- if ((doc_matters.opt_action.verbose)) { writeln("sqlite processing... "); }
+ if (doc_matters.opt.action.sqlite_discrete) {
+ if ((doc_matters.opt.action.verbose)) {
+ writeln("sqlite processing... ");
+ }
SQLiteDiscreteBuildTablesAndPopulate!()(doc_abstraction, doc_matters);
}
- if (doc_matters.opt_action.sqlite_update) {
- if ((doc_matters.opt_action.verbose)) { writeln("sqlite processing... "); }
+ if (doc_matters.opt.action.sqlite_update) {
+ if ((doc_matters.opt.action.verbose)) {
+ writeln("sqlite processing... ");
+ }
SQLiteBuildTablesAndPopulate!()(doc_abstraction, doc_matters);
}
- if (doc_matters.opt_action.postgresql) {
+ if (doc_matters.opt.action.postgresql) {
/+ mixin outputPostgreSQL; +/
writeln("pgsql processing");
}
@@ -102,11 +137,15 @@ template outputHubOp() {
mixin SiSUoutputRgxInit;
static auto rgx = Rgx();
if ((opt_action.sqlite_create)) {
- if ((opt_action.verbose)) { writeln("sqlite create table... "); }
+ if ((opt_action.verbose)) {
+ writeln("sqlite create table... ");
+ }
SQLiteTablesCreate!()();
}
if ((opt_action.sqlite_drop)) {
- if ((opt_action.verbose)) { writeln("sqlite drop table... "); }
+ if ((opt_action.verbose)) {
+ writeln("sqlite drop table... ");
+ }
SQLiteTablesDrop!()();
}
}
diff --git a/src/sdp/output/paths_source.d b/src/sdp/output/paths_source.d
index 1330606..d141b86 100644
--- a/src/sdp/output/paths_source.d
+++ b/src/sdp/output/paths_source.d
@@ -42,10 +42,10 @@ template PodManifest() {
return ManifestFile_();
}
}
-template PodMatters() {
+template PathMatters() {
mixin SiSUrgxInit;
static auto rgx = Rgx();
- auto PodMatters(O,E,P,F)(
+ auto PathMatters(O,E,P,F)(
O _opt_actions,
E _env,
P _pth = "",
@@ -54,99 +54,206 @@ template PodMatters() {
) {
auto _manifest = PodManifest!()(_pth);
struct ManifestMatters_ {
- auto pwd() {
- return _env["pwd"];
- }
- auto home() {
- return _env["home"];
- }
- auto opt_action() {
- return _opt_actions;
- }
- auto is_pod() {
- auto _is_pod = (_manifest.pod_manifest_path.length > 0) ? true : false;
- return _is_pod;
- }
- auto pod_manifest_list_of_filenames() {
- return _manifest_fn_list;
- }
- auto pod_manifest_list_of_languages() {
- string[] _lngs;
- foreach (filename_; pod_manifest_list_of_filenames) {
- string _k = "en";
- if (auto m = (filename_).match(rgx.language_code_and_filename)) {
- _k = m.captures[1].to!string;
+ auto env() {
+ struct Env_ {
+ auto pwd() {
+ return _env["pwd"];
+ }
+ auto home() {
+ return _env["home"];
}
- _lngs ~= _k; // all the languages from the manifest list of filenames with paths
}
- return _lngs;
- }
- auto pod_manifest_filename() {
- return _manifest.pod_manifest_filename;
- }
- auto pod_manifest_path() {
- return _manifest.pod_manifest_path;
+ return Env_();
}
- auto pod_manifest_file_with_path() {
- return _manifest.pod_manifest_file_with_path;
- }
- auto pod_config_dirs() { // TODO
- string[] _config_dirs;
- return _config_dirs;
- }
- auto pod_image_dirs() { // TODO
- string[] _image_dirs;
- return _image_dirs;
- }
- auto src_path_and_fn() {
- return _fns;
+ auto opt() {
+ struct Opt_ {
+ auto action() { // redundant
+ return _opt_actions;
+ }
+ }
+ return Opt_();
}
- auto src_fn() {
- auto _fn = (src_path_and_fn).match(rgx.src_pth_sst_or_ssm).captures["filename"];
- return _fn;
+ auto src_is_pod() {
+ auto _src_is_pod = (_manifest.pod_manifest_path.length > 0) ? true : false;
+ return _src_is_pod;
}
- auto src_lng() {
- string _k;
- if (auto m = (src_path_and_fn).match(rgx.language_code_and_filename)) {
- _k = m.captures[1];
- } else {
- _k = "en";
+ auto pod() {
+ struct Pod_ {
+ auto src_is_pod() {
+ auto _src_is_pod = (_manifest.pod_manifest_path.length > 0) ? true : false;
+ return _src_is_pod;
+ }
+ auto manifest_filename() {
+ return _manifest.pod_manifest_filename;
+ }
+ auto manifest_path() {
+ return _manifest.pod_manifest_path;
+ }
+ auto manifest_file_with_path() {
+ return _manifest.pod_manifest_file_with_path;
+ }
+ auto config_dirs() { // TODO
+ string[] _config_dirs;
+ return _config_dirs;
+ }
+ auto image_dirs() { // TODO
+ string[] _image_dirs;
+ return _image_dirs;
+ }
+ auto manifest_list_of_filenames() {
+ return _manifest_fn_list;
+ }
+ auto manifest_list_of_languages() {
+ string[] _lngs;
+ foreach (filename_; manifest_list_of_filenames) {
+ string _k = "en";
+ if (auto m = (filename_).match(rgx.language_code_and_filename)) {
+ _k = m.captures[1].to!string;
+ }
+ _lngs ~= _k; // all the languages from the manifest list of filenames with paths
+ }
+ return _lngs;
+ }
}
- return _k;
+ return Pod_();
}
- auto output_path() {
- auto _output_path = pwd;
- if ((_opt_actions.output_dir_set.length > 0)
- && isValidPath(_opt_actions.output_dir_set)
- ) {
- _output_path = asNormalizedPath(_opt_actions.output_dir_set).array;
- if (!exists(_output_path)) {
- try {
- _output_path.mkdirRecurse;
+ auto src() {
+ struct SRC_ {
+ auto is_pod() {
+ auto _src_is_pod = (_manifest.pod_manifest_path.length > 0) ? true : false;
+ return _src_is_pod;
+ }
+ auto path_and_fn() {
+ return _fns;
+ }
+ auto filename() {
+ auto _fn = (path_and_fn).baseName;
+ return _fn;
+ }
+ auto lng() {
+ string _k;
+ if (auto m = (path_and_fn).match(rgx.language_code_and_filename)) {
+ _k = m.captures[1];
+ } else {
+ _k = "en";
}
- catch (Exception ex) {
- // Handle error
+ return _k;
+ }
+ auto file_with_absolute_path() {
+ string _pth = _env["pwd"].chainPath(path_and_fn).array;
+ return _pth;
+ }
+ auto absolute_path_to_src() {
+ string _pth = (_env["pwd"].chainPath(path_and_fn)).dirName.array;
+ return _pth;
+ }
+ auto base_dir() {
+ string _dir;
+ if ( // TODO this should catch generated --source sisupod, untested, needs manifest
+ auto m = (absolute_path_to_src)
+ .match(regex(r"[/](?P<dir>(?:[a-zA-Z0-9._-]+))/sisupod/" ~ filename.stripExtension))
+ ) {
+ _dir = asAbsolutePath(path_and_fn.chainPath("../../")).array;
+ assert(_dir == m.captures["dir"]);
+ } else {
+ _dir = asAbsolutePath(path_and_fn.chainPath("../../../")).array;
+ assert(_dir == absolute_path_to_src.match(rgx.src_base_parent_dir_name).captures["dir"]);
}
+ writeln("--> ", _dir);
+ return _dir;
+ }
+ auto base_parent_dir_path() {
+ string _dir;
+ if ( // TODO this should catch generated --source sisupod, untested, needs manifest
+ auto m = (absolute_path_to_src)
+ .match(regex(r"[/](?P<dir>(?:[a-zA-Z0-9._-]+))/sisupod/" ~ filename.stripExtension))
+ ) {
+ _dir = asAbsolutePath(path_and_fn.chainPath("../../")).array;
+ } else {
+ _dir = asAbsolutePath(path_and_fn.chainPath("../../../")).array;
+ }
+ return _dir;
+ }
+ auto base_dir_path() { // looks like there is work to do
+ string _dir;
+ if ( // TODO this should catch generated --source sisupod, untested, needs manifest
+ auto m = (absolute_path_to_src)
+ .match(regex(r"[/](?P<dir>(?:[a-zA-Z0-9._-]+))/sisupod/" ~ filename.stripExtension))
+ ) {
+ _dir = asAbsolutePath(path_and_fn.chainPath("../")).array;
+ } else {
+ _dir = asAbsolutePath(path_and_fn.chainPath("../../")).array;
+ }
+ writeln("--> ", _dir);
+ return _dir;
+ }
+ auto media_dir_path() { // TODO rework, can base directly on src fn path
+ auto _dir = asAbsolutePath(base_dir_path.chainPath("media")).array;
+ return _dir;
+ }
+ auto image_dir_path() {
+ auto _dir = asAbsolutePath(base_dir_path.chainPath("media/image")).array;
+ return _dir;
+ }
+ auto conf_dir_path() {
+ auto _dir = asAbsolutePath(base_dir_path.chainPath("conf")).array;
+ return _dir;
+ }
+ auto base_parent_dir() {
+ string _dir;
+ if ( // TODO this should catch generated --source sisupod, untested, needs manifest
+ auto m = (absolute_path_to_src)
+ .match(regex(r"[/](?P<dir>(?:[a-zA-Z0-9._-]+))/sisupod/" ~ filename.stripExtension))
+ ) {
+ _dir = m.captures["dir"];
+ } else {
+ _dir = (absolute_path_to_src).match(rgx.src_base_parent_dir_name).captures["dir"];
+ }
+ writeln("--> ", _dir);
+ return _dir;
+ }
+ auto config_dirs() { // TODO
+ string[] _config_dirs;
+ if (is_pod) {
+ } else {
+ }
+ return _config_dirs;
+ }
+ auto image_dirs() { // TODO
+ string[] _image_dirs;
+ if (is_pod) {
+ } else {
+ }
+ return _image_dirs;
}
- assert(_output_path.isDir,
- "not a directory: " ~ _output_path);
- // TODO always test that is a directory and it is writable
- }
- return _output_path;
- }
- auto src_config_dirs() { // TODO
- string[] _config_dirs;
- if (is_pod) {
- } else {
}
- return _config_dirs;
- }
- auto src_image_dirs() { // TODO
- string[] _image_dirs;
- if (is_pod) {
- } else {
+ return SRC_();
+ }
+ auto output() {
+ struct Out_ {
+ auto path() {
+ auto _output_path = _env["pwd"];
+ if ((_opt_actions.output_dir_set.length > 0)
+ && isValidPath(_opt_actions.output_dir_set)
+ ) {
+ _output_path = asNormalizedPath(_opt_actions.output_dir_set).array;
+ if (!exists(_output_path)) {
+ try {
+ _output_path.mkdirRecurse;
+ }
+ // catch (ErrnoException ex) {
+ catch (Exception ex) {
+ // Handle error
+ }
+ }
+ assert(_output_path.isDir,
+ "not a directory: " ~ _output_path);
+ // TODO always test that is a directory and it is writable
+ }
+ return _output_path;
+ }
}
- return _image_dirs;
+ return Out_();
}
}
return ManifestMatters_();
@@ -163,90 +270,95 @@ template ConfigFilePaths() {
auto config_filename_document() {
return "config_document";
}
- auto possible_config_path_locations_document() {
- /+ FIX clean up conf paths ↓ +/
- /+ config local site (file system only, not in pod) +/
- /+ return paths +/
- string[] _possible_config_path_locations;
- if (_manifest.is_pod) {
- /+ config document in pod +/
- string _sisudoc_conf_pod;
- string _sisudoc_conf_pod_text;
- _sisudoc_conf_pod = asNormalizedPath(chainPath(
- to!string(_env["pwd"]),
- _manifest.pod_manifest_path ~ "/conf"
- )).array;
- _sisudoc_conf_pod_text = asNormalizedPath(chainPath(
- to!string(_env["pwd"]),
- _manifest.pod_manifest_path ~ "/media/text/" ~ _manifest.src_lng ~ "/conf"
- )).array;
- /+ return paths +/
- _possible_config_path_locations = [
- _sisudoc_conf_pod_text,
- _sisudoc_conf_pod,
- ];
- } else {
- /+ config document (& or local site) on filesystem +/
- string _sisudoc_conf_pwd = asNormalizedPath(chainPath(to!string(_env["pwd"]), "sisudoc/conf")).array; // think about
- string _sisudoc_conf_pwd_a = asNormalizedPath(chainPath(to!string(_env["pwd"]), "conf")).array;
- string _sisudoc_conf_pwd_b = asNormalizedPath(chainPath(to!string(_env["pwd"]), "../conf")).array;
- string _sisudoc_conf_pwd_c = asNormalizedPath(chainPath(to!string(_env["pwd"]), "../../conf")).array;
- string _sisudoc_conf_pwd_d = asNormalizedPath(chainPath(to!string(_env["pwd"]), "../../../conf")).array;
- /+ return paths +/
- _possible_config_path_locations = [
- _sisudoc_conf_pwd,
- _sisudoc_conf_pwd_a,
- _sisudoc_conf_pwd_b,
- _sisudoc_conf_pwd_c,
- _sisudoc_conf_pwd_d,
- ];
- }
- /+ FIX clean up conf paths ↑
- (compare pwd to doc path location, and build config path)
- +/
- return _possible_config_path_locations;
- }
- auto config_filename_site() {
- return "config_local_site";
- }
- auto possible_config_path_locations_local_site() {
- /+ FIX clean up conf paths ↓ +/
- /+ config local site (file system only, not in pod) +/
- string _dot_pwd = asNormalizedPath(chainPath(to!string(_env["pwd"]), ".sisu")).array;
- string _underscore_pwd = asNormalizedPath(chainPath(to!string(_env["pwd"]), "_sisu")).array;
- string _dot_home = asNormalizedPath(chainPath(to!string(_env["home"]), ".sisu")).array;
- /+ return paths +/
- string[] _possible_config_path_locations;
- if (_manifest.is_pod) {
- _possible_config_path_locations = [
- _dot_pwd,
- _underscore_pwd,
- _dot_home,
- "/etc/sisu"
- ];
- } else {
- /+ config document (& or local site) on filesystem +/
- string _sisudoc_conf_pwd = asNormalizedPath(chainPath(to!string(_env["pwd"]), "sisudoc/conf")).array; // think about
- string _sisudoc_conf_pwd_a = asNormalizedPath(chainPath(to!string(_env["pwd"]), "conf")).array;
- string _sisudoc_conf_pwd_b = asNormalizedPath(chainPath(to!string(_env["pwd"]), "../conf")).array;
- string _sisudoc_conf_pwd_c = asNormalizedPath(chainPath(to!string(_env["pwd"]), "../../conf")).array;
- string _sisudoc_conf_pwd_d = asNormalizedPath(chainPath(to!string(_env["pwd"]), "../../../conf")).array;
- _possible_config_path_locations = [
- _sisudoc_conf_pwd,
- _sisudoc_conf_pwd_a,
- _sisudoc_conf_pwd_b,
- _sisudoc_conf_pwd_c,
- _sisudoc_conf_pwd_d,
- _dot_pwd,
- _underscore_pwd,
- _dot_home,
- "/etc/sisu"
- ];
+ auto possible_config_path_locations() {
+ struct _ConfFilePaths {
+ auto document() {
+ /+ FIX clean up conf paths ↓ +/
+ /+ config local site (file system only, not in pod) +/
+ /+ return paths +/
+ string[] _possible_config_path_locations;
+ if (_manifest.src.is_pod) {
+ /+ config document in pod +/
+ string _sisudoc_conf_pod; //
+ string _sisudoc_conf_pod_text; //
+ _sisudoc_conf_pod = asNormalizedPath(chainPath(
+ to!string(_env["pwd"]),
+ _manifest.pod.manifest_path ~ "/conf"
+ )).array;
+ _sisudoc_conf_pod_text = asNormalizedPath(chainPath(
+ to!string(_env["pwd"]),
+ _manifest.pod.manifest_path ~ "/media/text/" ~ _manifest.src.lng ~ "/conf"
+ )).array;
+ /+ return paths +/
+ _possible_config_path_locations = [
+ _sisudoc_conf_pod_text,
+ _sisudoc_conf_pod,
+ ];
+ } else {
+ /+ config document (& or local site) on filesystem +/
+ string _sisudoc_conf_pwd = asNormalizedPath(chainPath(to!string(_env["pwd"]), "sisudoc/conf")).array; // think about
+ string _sisudoc_conf_pwd_a = asNormalizedPath(chainPath(to!string(_env["pwd"]), "conf")).array;
+ string _sisudoc_conf_pwd_b = asNormalizedPath(chainPath(to!string(_env["pwd"]), "../conf")).array;
+ string _sisudoc_conf_pwd_c = asNormalizedPath(chainPath(to!string(_env["pwd"]), "../../conf")).array;
+ string _sisudoc_conf_pwd_d = asNormalizedPath(chainPath(to!string(_env["pwd"]), "../../../conf")).array;
+ /+ return paths +/
+ _possible_config_path_locations = [
+ _sisudoc_conf_pwd,
+ _sisudoc_conf_pwd_a,
+ _sisudoc_conf_pwd_b,
+ _sisudoc_conf_pwd_c,
+ _sisudoc_conf_pwd_d,
+ ];
+ }
+ /+ FIX clean up conf paths ↑
+ (compare pwd to doc path location, and build config path)
+ +/
+ return _possible_config_path_locations;
+ }
+ auto config_filename_site() {
+ return "config_local_site";
+ }
+ auto local_site() {
+ /+ FIX clean up conf paths ↓ +/
+ /+ config local site (file system only, not in pod) +/
+ string _dot_pwd = asNormalizedPath(chainPath(to!string(_env["pwd"]), ".sisu")).array;
+ string _underscore_pwd = asNormalizedPath(chainPath(to!string(_env["pwd"]), "_sisu")).array;
+ string _dot_home = asNormalizedPath(chainPath(to!string(_env["home"]), ".sisu")).array;
+ /+ return paths +/
+ string[] _possible_config_path_locations;
+ if (_manifest.src.is_pod) {
+ _possible_config_path_locations = [
+ _dot_pwd,
+ _underscore_pwd,
+ _dot_home,
+ "/etc/sisu"
+ ];
+ } else {
+ /+ config document (& or local site) on filesystem +/
+ string _sisudoc_conf_pwd = asNormalizedPath(chainPath(to!string(_env["pwd"]), "sisudoc/conf")).array; // think about
+ string _sisudoc_conf_pwd_a = asNormalizedPath(chainPath(to!string(_env["pwd"]), "conf")).array;
+ string _sisudoc_conf_pwd_b = asNormalizedPath(chainPath(to!string(_env["pwd"]), "../conf")).array;
+ string _sisudoc_conf_pwd_c = asNormalizedPath(chainPath(to!string(_env["pwd"]), "../../conf")).array;
+ string _sisudoc_conf_pwd_d = asNormalizedPath(chainPath(to!string(_env["pwd"]), "../../../conf")).array;
+ _possible_config_path_locations = [
+ _sisudoc_conf_pwd,
+ _sisudoc_conf_pwd_a,
+ _sisudoc_conf_pwd_b,
+ _sisudoc_conf_pwd_c,
+ _sisudoc_conf_pwd_d,
+ _dot_pwd,
+ _underscore_pwd,
+ _dot_home,
+ "/etc/sisu"
+ ];
+ }
+ /+ FIX clean up conf paths ↑
+ (compare pwd to doc path location, and build config path)
+ +/
+ return _possible_config_path_locations;
+ }
}
- /+ FIX clean up conf paths ↑
- (compare pwd to doc path location, and build config path)
- +/
- return _possible_config_path_locations;
+ return _ConfFilePaths();
}
}
return ConfFilePaths();
@@ -301,52 +413,17 @@ template SiSUpathsSRC() {
return SisuSrcPaths();
}
}
-template SiSUpathsSisupod() {
- mixin SiSUrgxInit;
- static auto rgx = Rgx();
- string _base_dir_pod = "sisupod";
- string _base_dir_doc = "sisudoc";
- string _suffix = ".zip";
- auto SiSUpathsSisupod()() {
- struct _PathsStruct {
- string base_filename(string fn_src) {
- auto pth = fn_src.baseName.stripExtension;
- return pth;
- }
- string sisupod_dir() {
- auto pth = _base_dir_pod;
- return pth;
- }
- string sisudoc_dir() {
- auto pth = _base_dir_doc;
- return pth;
- }
- string sisupod_filename(string fn_src) {
- string pth = _base_dir_pod.chainPath(base_filename(fn_src) ~ _suffix).array;
- return pth;
- }
- string base_filesystem(string fn_src) {
- string pth = _base_dir_pod.chainPath(base_filename(fn_src)).array;
- assert(pth == _base_dir_pod ~ "/" ~ base_filename(fn_src),
- pth ~ " == " ~ _base_dir_pod ~ "/" ~ base_filename(fn_src) ~ "?");
- return pth;
- }
- string base_pod(string fn_src) {
- string pth = _base_dir_pod.chainPath(base_filename(fn_src)).array; // change this
- return pth;
- }
- }
- return _PathsStruct();
- }
-}
+
template SiSUpathsSisupods() {
mixin SiSUrgxInit;
static auto rgx = Rgx();
- string _base_dir_pod = "sisupod";
- string _base_dir_doc = "sisudoc";
string _suffix = ".zip";
- auto SiSUpathsSisupods()() {
+ auto SiSUpathsSisupods(Dm)(Dm doc_matters) {
+ string _base_dir_pod = (doc_matters.output_path.length > 0)
+ ? doc_matters.output_path ~ "/sisupod"
+ : "/sisupod";
+ string _base_dir_doc = "sisudoc";
struct _PodPaths {
string base_filename_(string fn_src) {
auto pth = fn_src.baseName.stripExtension;
diff --git a/src/sdp/output/rgx.d b/src/sdp/output/rgx.d
index 3e03620..1c32351 100644
--- a/src/sdp/output/rgx.d
+++ b/src/sdp/output/rgx.d
@@ -30,6 +30,7 @@ static template SiSUoutputRgxInit() {
static src_fn_insert = ctRegex!(`^(?P<path>[a-zA-Z0-9._-]+/)*(?P<filename>[a-zA-Z0-9._-]+[.]ssi)$`);
static src_fn_find_inserts = ctRegex!(`^(?P<path>[a-zA-Z0-9._-]+/)*(?P<filename>[a-zA-Z0-9._-]+[.]ss[im])$`);
static insert_src_fn_ssi_or_sst = ctRegex!(`^<<\s*(?P<path>[a-zA-Z0-9._-]+/)*(?P<filename>[a-zA-Z0-9._-]+[.]ss[ti])$`);
+ static src_base_parent_dir_name = ctRegex!(`[/](?P<dir>(?:[a-zA-Z0-9._-]+))(?:/media/text/[a-z]{2})$`); // formalizes dir structure
/+ inline markup footnotes endnotes +/
static inline_notes_al = ctRegex!(`【(?:[*+]\s+|\s*)(.+?)】`, "mg");
static inline_notes_al_gen = ctRegex!(`【.+?】`, "m");
diff --git a/src/sdp/output/source_sisupod.d b/src/sdp/output/source_sisupod.d
index 0d529b6..c48a0e3 100644
--- a/src/sdp/output/source_sisupod.d
+++ b/src/sdp/output/source_sisupod.d
@@ -15,64 +15,71 @@ template SiSUpod() {
// static assert(is(typeof(doc_matters) == tuple));
}
mixin SiSUoutputRgxInit;
- string pwd = doc_matters.environment.pwd;
- auto src_path_info = doc_matters.src_path_info;
- auto pth_sisudoc_src = doc_matters.src_path_info;
- auto pths_sisupod = SiSUpathsSisupods!()();
+ string pwd = doc_matters.env.pwd;
+ auto src_path_info = doc_matters.src.path_info;
+ auto pth_sisudoc_src = doc_matters.src.path_info;
+ auto pths_sisupod = SiSUpathsSisupods!()(doc_matters);
mixin SiSUlanguageCodes;
auto lang = Lang();
static auto rgx = Rgx();
- assert (doc_matters.source_filename.match(rgx.src_fn));
+ assert (doc_matters.src.filename.match(rgx.src_fn));
try {
/+ create directory structure +/
if (!exists(pths_sisupod.sisupod_dir_())) {
// used both by sisupod zipped (& sisupod filesystem (unzipped) which makes its own recursive dirs)
pths_sisupod.sisupod_dir_().mkdirRecurse;
}
- if (doc_matters.opt_action.source) {
- if (!exists(pths_sisupod.text_root(doc_matters.source_filename).filesystem_open_zpod)) {
- pths_sisupod.text_root(doc_matters.source_filename).filesystem_open_zpod.mkdirRecurse;
+ if (doc_matters.opt.action.source) {
+ if (!exists(pths_sisupod.text_root(doc_matters.src.filename).filesystem_open_zpod)) {
+ pths_sisupod.text_root(doc_matters.src.filename).filesystem_open_zpod.mkdirRecurse;
}
- if (!exists(pths_sisupod.conf_root(doc_matters.source_filename).filesystem_open_zpod)) {
- pths_sisupod.conf_root(doc_matters.source_filename).filesystem_open_zpod.mkdirRecurse;
+ if (!exists(pths_sisupod.conf_root(doc_matters.src.filename).filesystem_open_zpod)) {
+ pths_sisupod.conf_root(doc_matters.src.filename).filesystem_open_zpod.mkdirRecurse;
}
- if (!exists(pths_sisupod.media_root(doc_matters.source_filename).filesystem_open_zpod)) {
- pths_sisupod.media_root(doc_matters.source_filename).filesystem_open_zpod.mkdirRecurse;
+ if (!exists(pths_sisupod.media_root(doc_matters.src.filename).filesystem_open_zpod)) {
+ pths_sisupod.media_root(doc_matters.src.filename).filesystem_open_zpod.mkdirRecurse;
}
- if (!exists(pths_sisupod.css(doc_matters.source_filename).filesystem_open_zpod)) {
- pths_sisupod.css(doc_matters.source_filename).filesystem_open_zpod.mkdirRecurse;
+ if (!exists(pths_sisupod.css(doc_matters.src.filename).filesystem_open_zpod)) {
+ pths_sisupod.css(doc_matters.src.filename).filesystem_open_zpod.mkdirRecurse;
}
- if (!exists(pths_sisupod.image_root(doc_matters.source_filename).filesystem_open_zpod)) {
- pths_sisupod.image_root(doc_matters.source_filename).filesystem_open_zpod.mkdirRecurse;
+ if (!exists(pths_sisupod.image_root(doc_matters.src.filename).filesystem_open_zpod)) {
+ pths_sisupod.image_root(doc_matters.src.filename).filesystem_open_zpod.mkdirRecurse;
}
- if (!exists(pths_sisupod.doc_lng(doc_matters.source_filename, doc_matters.language).filesystem_open_zpod)) {
- pths_sisupod.doc_lng(doc_matters.source_filename, doc_matters.language).filesystem_open_zpod.mkdirRecurse;
+ if (!exists(pths_sisupod.doc_lng(doc_matters.src.filename, doc_matters.src.language).filesystem_open_zpod)) {
+ pths_sisupod.doc_lng(doc_matters.src.filename, doc_matters.src.language).filesystem_open_zpod.mkdirRecurse;
}
}
debug(sisupod) {
writeln(__LINE__, ": ",
- doc_matters.source_filename, " -> ",
- pths_sisupod.fn_doc(doc_matters.source_filename, doc_matters.language).filesystem_open_zpod
+ doc_matters.src.filename, " -> ",
+ pths_sisupod.fn_doc(doc_matters.src.filename, doc_matters.src.language).filesystem_open_zpod
);
}
auto zip = new ZipArchive();
- auto fn_sisupod = pths_sisupod.sisupod_filename(doc_matters.source_filename).zpod;
+ auto fn_sisupod = pths_sisupod.sisupod_filename(doc_matters.src.filename).zpod;
{ /+ bundle images +/
- foreach (image; doc_matters.image_list) {
+ foreach (image; doc_matters.src.image_list) {
debug(sisupodimages) {
writeln(
pth_sisudoc_src.image_root.to!string, "/", image, " -> ",
- pths_sisupod.image_root(doc_matters.source_filename).zpod, "/", image
+ pths_sisupod.image_root(doc_matters.src.filename).zpod, "/", image
);
}
auto fn_src_in = pth_sisudoc_src.image_root.to!string ~ "/" ~ image;
- auto fn_src_out_sisupod_zip_base = pths_sisupod.image_root(doc_matters.source_filename).zpod.to!string ~ "/" ~ image;
- auto fn_src_out_filesystem = pths_sisupod.image_root(doc_matters.source_filename).filesystem_open_zpod.to!string ~ "/" ~ image;
+ auto fn_src_out_sisupod_zip_base
+ = pths_sisupod.image_root(doc_matters.src.filename).zpod.to!string
+ ~ "/" ~ image;
+ auto fn_src_out_filesystem
+ = pths_sisupod.image_root(doc_matters.src.filename).filesystem_open_zpod.to!string
+ ~ "/" ~ image;
if (exists(fn_src_in)) {
- if (doc_matters.opt_action.source) {
+ debug(io) {
+ writeln("src out found: ", fn_src_in);
+ }
+ if (doc_matters.opt.action.source) {
fn_src_in.copy(fn_src_out_filesystem);
}
- if (doc_matters.opt_action.sisupod) {
+ if (doc_matters.opt.action.sisupod) {
auto zip_arc_member_file = new ArchiveMember();
zip_arc_member_file.name = fn_src_out_sisupod_zip_base;
auto zip_data = new OutBuffer();
@@ -80,17 +87,28 @@ template SiSUpod() {
zip_arc_member_file.expandedData = zip_data.toBytes();
zip.addMember(zip_arc_member_file);
}
+ } else {
+ if (doc_matters.opt.action.verbose) {
+ writeln("src out NOT found (image): ", fn_src_in);
+ }
}
}
} { /+ bundle sisu_document_make +/
- auto fn_src_in = pth_sisudoc_src.conf_root.to!string ~ "/" ~ "sisu_document_make"; // check (_sisu/sisu_document_make)
- auto fn_src_out_sisupod_zip_base = pths_sisupod.conf_root(doc_matters.source_filename).zpod.to!string ~ "/" ~ "sisu_document_make";
- auto fn_src_out_filesystem = pths_sisupod.conf_root(doc_matters.source_filename).filesystem_open_zpod.to!string ~ "/" ~ "sisu_document_make";
+ auto fn_src_in
+ = pth_sisudoc_src.conf_root.to!string ~ "/" ~ "sisu_document_make"; // check (_sisu/sisu_document_make)
+ auto fn_src_out_sisupod_zip_base
+ = pths_sisupod.conf_root(doc_matters.src.filename).zpod.to!string ~ "/" ~ "sisu_document_make";
+ auto fn_src_out_filesystem
+ = pths_sisupod.conf_root(doc_matters.src.filename).filesystem_open_zpod.to!string
+ ~ "/" ~ "sisu_document_make"; // TODO
if (exists(fn_src_in)) {
- if (doc_matters.opt_action.source) {
+ debug(io) {
+ writeln("src out found: ", fn_src_in);
+ }
+ if (doc_matters.opt.action.source) {
fn_src_in.copy(fn_src_out_filesystem);
}
- if (doc_matters.opt_action.sisupod) {
+ if (doc_matters.opt.action.sisupod) {
auto zip_arc_member_file = new ArchiveMember();
zip_arc_member_file.name = fn_src_out_sisupod_zip_base;
auto zip_data = new OutBuffer();
@@ -98,25 +116,36 @@ template SiSUpod() {
zip_arc_member_file.expandedData = zip_data.toBytes();
zip.addMember(zip_arc_member_file);
}
+ } else {
+ if (doc_matters.opt.action.verbose) {
+ writeln("src out NOT found (document make): ", fn_src_in);
+ }
}
} { /+ TODO bundle primary file +/
- auto fn_src_in = doc_matters.source_filename;
- auto fn_src_out_sisupod_zip_base = pths_sisupod.fn_doc(doc_matters.source_filename, doc_matters.language).zpod.to!string;
- auto fn_src_out_filesystem = pths_sisupod.fn_doc(doc_matters.source_filename, doc_matters.language).filesystem_open_zpod.to!string; // needed without root path:
- auto fn_src_out_inside_pod = pths_sisupod.fn_doc(doc_matters.source_filename, doc_matters.language).zpod.to!string; // needed without root path:
+ auto fn_src_in = doc_matters.src.file_with_absolute_path.to!string;
+ auto fn_src_out_sisupod_zip_base
+ = pths_sisupod.fn_doc(doc_matters.src.filename, doc_matters.src.language).zpod.to!string;
+ auto fn_src_out_filesystem
+ = pths_sisupod.fn_doc(doc_matters.src.filename, doc_matters.src.language).filesystem_open_zpod.to!string; // needed without root path:
+ auto fn_src_out_inside_pod
+ = pths_sisupod.fn_doc(doc_matters.src.filename, doc_matters.src.language).zpod.to!string; // needed without root path:
string[] filelist_src_out_sisupod_arr;
string[] filelist_src_zpod_arr;
if (exists(fn_src_in)) {
- filelist_src_out_sisupod_arr ~= fn_src_out_sisupod_zip_base;
+ debug(io) {
+ writeln("src out found: ", fn_src_in);
+ }
+ filelist_src_out_sisupod_arr ~= fn_src_out_sisupod_zip_base;
filelist_src_zpod_arr ~= fn_src_out_inside_pod;
- if (doc_matters.opt_action.source) {
- auto filelist = File(pths_sisupod.fn_pod_filelist(doc_matters.source_filename).filesystem_open_zpod, "w");
+ if (doc_matters.opt.action.source) {
+ auto filelist
+ = File(pths_sisupod.fn_pod_filelist(doc_matters.src.filename).filesystem_open_zpod, "w");
foreach (source_pth_and_fn; filelist_src_zpod_arr) {
filelist.writeln(source_pth_and_fn);
}
fn_src_in.copy(fn_src_out_filesystem);
}
- if (doc_matters.opt_action.sisupod) {
+ if (doc_matters.opt.action.sisupod) {
auto zip_arc_member_file = new ArchiveMember();
zip_arc_member_file.name = fn_src_out_sisupod_zip_base;
auto zip_data = new OutBuffer();
@@ -124,38 +153,45 @@ template SiSUpod() {
zip_arc_member_file.expandedData = zip_data.toBytes();
zip.addMember(zip_arc_member_file);
}
+ } else {
+ if (doc_matters.opt.action.verbose) {
+ writeln("src out NOT found (markup source): ", fn_src_in);
+ }
}
} { /+ bundle insert files +/
- if (doc_matters.file_insert_list.length > 0) {
- foreach (insert_file; doc_matters.file_insert_list) {
+ if (doc_matters.src.file_insert_list.length > 0) {
+ foreach (insert_file; doc_matters.src.file_insert_list) {
debug(sisupod) {
writeln(
insert_file, " -> ",
pths_sisupod.fn_doc_insert(
- doc_matters.source_filename,
+ doc_matters.src.filename,
insert_file,
- doc_matters.language,
+ doc_matters.src.language,
).zpod
);
}
auto fn_src_in = insert_file;
- auto fn_src_out_sisupod_zip_base =
- pths_sisupod.fn_doc_insert(
- doc_matters.source_filename,
+ auto fn_src_out_sisupod_zip_base
+ = pths_sisupod.fn_doc_insert(
+ doc_matters.src.filename,
insert_file,
- doc_matters.language,
+ doc_matters.src.language,
).zpod.to!string;
- auto fn_src_out_filesystem =
- pths_sisupod.fn_doc_insert(
- doc_matters.source_filename,
+ auto fn_src_out_filesystem
+ = pths_sisupod.fn_doc_insert(
+ doc_matters.src.filename,
insert_file,
- doc_matters.language,
+ doc_matters.src.language,
).filesystem_open_zpod.to!string;
if (exists(fn_src_in)) {
- if (doc_matters.opt_action.source) {
+ debug(io) {
+ writeln("src out found: ", fn_src_in);
+ }
+ if (doc_matters.opt.action.source) {
fn_src_in.copy(fn_src_out_filesystem);
}
- if (doc_matters.opt_action.sisupod) {
+ if (doc_matters.opt.action.sisupod) {
auto zip_arc_member_file = new ArchiveMember();
zip_arc_member_file.name = fn_src_out_sisupod_zip_base;
auto zip_data = new OutBuffer();
@@ -164,13 +200,17 @@ template SiSUpod() {
zip.addMember(zip_arc_member_file);
createZipFile!()(fn_sisupod, zip.build());
}
+ } else {
+ if (doc_matters.opt.action.verbose) {
+ writeln("src out NOT found (insert file): ", fn_src_in);
+ }
}
}
}
} {
- auto fn_src_in = doc_matters.source_filename;
+ auto fn_src_in = doc_matters.src.filename;
if (exists(fn_src_in)) {
- if (doc_matters.opt_action.sisupod) {
+ if (doc_matters.opt.action.sisupod) {
createZipFile!()(fn_sisupod, zip.build());
}
}
@@ -190,22 +230,22 @@ template SiSUpod() {
catch (ZipException ex) {
// Handle errors
}
- if (doc_matters.source_filename == "sisudoc/media/text/en/the_wealth_of_networks.yochai_benkler.sst") {
+ if (doc_matters.src.filename == "sisudoc/media/text/en/the_wealth_of_networks.yochai_benkler.sst") {
assert(
((data).sha256Of).toHexString
== "626F83A31ED82F42CF528E922C1643498A137ABA3F2E5AFF8A379EA79EA22A1E",
"\nsisupod: sha256 value for "
- ~ doc_matters.source_filename
+ ~ doc_matters.src.filename
~ " has changed, is now: "
~ ((data).sha256Of).toHexString
);
}
- if (doc_matters.source_filename == "sisudoc/media/text/en/sisu_markup_stress_test.sst") {
+ if (doc_matters.src.filename == "sisudoc/media/text/en/sisu_markup_stress_test.sst") {
assert(
((data).sha256Of).toHexString
== "AAE0C87AB3F6D5F7385AEEA6EE661F56D40475CFE87AD930C78C9FE07FFB0D91",
"\nsisupod: sha256 value for "
- ~ doc_matters.source_filename
+ ~ doc_matters.src.filename
~ " has changed, is now: "
~ ((data).sha256Of).toHexString
);
diff --git a/src/sdp/output/sqlite.d b/src/sdp/output/sqlite.d
index 5804da7..4abe3d1 100644
--- a/src/sdp/output/sqlite.d
+++ b/src/sdp/output/sqlite.d
@@ -44,7 +44,7 @@ template SQLiteBuildTablesAndPopulate() {
if (_urls.length > 0) {
_txt ~= _urls;
}
- if (doc_matters.opt_action.debug_do) {
+ if (doc_matters.opt.action.debug_do) {
writeln(_txt, "\n");
}
debug(sql_text_clean) {
@@ -96,7 +96,7 @@ template SQLiteBuildTablesAndPopulate() {
if (_notes.length > 0) {
_txt ~= _notes;
}
- if (doc_matters.opt_action.debug_do) {
+ if (doc_matters.opt.action.debug_do) {
writeln(_txt, "\n");
}
return _txt;
@@ -303,7 +303,7 @@ template SQLiteBuildTablesAndPopulate() {
"text": generic_munge_sanitize_text_for_search(obj.text),
"html": html_heading(obj)
];
- if (doc_matters.opt_action.debug_do) {
+ if (doc_matters.opt.action.debug_do) {
debug(sql_txt) {
writeln(obj_txt["text"]);
}
@@ -322,7 +322,7 @@ template SQLiteBuildTablesAndPopulate() {
"text": generic_munge_sanitize_text_for_search(obj.text),
"html": html_para(obj)
];
- if (doc_matters.opt_action.debug_do) {
+ if (doc_matters.opt.action.debug_do) {
debug(sql_txt) {
writeln(obj_txt["text"]);
}
@@ -341,7 +341,7 @@ template SQLiteBuildTablesAndPopulate() {
"text": generic_munge_sanitize_text_for_search(obj.text),
"html": html_quote(obj)
];
- if (doc_matters.opt_action.debug_do) {
+ if (doc_matters.opt.action.debug_do) {
debug(sql_txt) {
writeln(obj_txt["text"]);
}
@@ -360,7 +360,7 @@ template SQLiteBuildTablesAndPopulate() {
"text": generic_munge_sanitize_text_for_search(obj.text),
"html": html_group(obj)
];
- if (doc_matters.opt_action.debug_do) {
+ if (doc_matters.opt.action.debug_do) {
debug(sql_txt) {
writeln(obj_txt["text"]);
}
@@ -379,7 +379,7 @@ template SQLiteBuildTablesAndPopulate() {
"text": generic_munge_sanitize_text_for_search(obj.text),
"html": html_block(obj)
];
- if (doc_matters.opt_action.debug_do) {
+ if (doc_matters.opt.action.debug_do) {
debug(sql_txt) {
writeln(obj_txt["text"]);
}
@@ -398,7 +398,7 @@ template SQLiteBuildTablesAndPopulate() {
"text": generic_munge_sanitize_text_for_search(obj.text),
"html": html_verse(obj)
];
- if (doc_matters.opt_action.debug_do) {
+ if (doc_matters.opt.action.debug_do) {
debug(sql_txt) {
writeln(obj_txt["text"]);
}
@@ -417,7 +417,7 @@ template SQLiteBuildTablesAndPopulate() {
"text": generic_munge_sanitize_text_for_search(obj.text),
"html": html_code(obj)
];
- if (doc_matters.opt_action.debug_do) {
+ if (doc_matters.opt.action.debug_do) {
debug(sql_txt) {
writeln(obj_txt["text"]);
}
@@ -436,7 +436,7 @@ template SQLiteBuildTablesAndPopulate() {
"text": generic_munge_sanitize_text_for_search(obj.text),
"html": html_table(obj)
];
- if (doc_matters.opt_action.debug_do) {
+ if (doc_matters.opt.action.debug_do) {
debug(sql_txt) {
writeln(obj_txt["text"]);
}
@@ -456,11 +456,11 @@ template SQLiteBuildTablesAndPopulate() {
Statement SQLiteInstruct(I)(
auto ref I doc_matters,
) {
- auto pth_sqlite = SiSUpathsSQLite!()(doc_matters.output_path, doc_matters.language);
- auto db = Database(pth_sqlite.sqlite_file(doc_matters.environment.pwd.baseName));
+ auto pth_sqlite = SiSUpathsSQLite!()(doc_matters.output_path, doc_matters.src.language);
+ auto db = Database(pth_sqlite.sqlite_file(doc_matters.env.pwd.baseName));
// auto db = Database(":memory:"); // open database in memory
- if (doc_matters.opt_action.sqlite_create) {
- if ((doc_matters.opt_action.verbose)) { writeln("sqlite create tables... "); }
+ if (doc_matters.opt.action.sqlite_create) {
+ if ((doc_matters.opt.action.verbose)) { writeln("sqlite create tables... "); }
db.run("
DROP TABLE IF EXISTS metadata_and_text;
DROP TABLE IF EXISTS doc_objects;
@@ -911,14 +911,14 @@ template SQLiteBuildTablesAndPopulate() {
obj_txt = format_and_sqlite_load.heading(obj);
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;
@@ -940,7 +940,7 @@ template SQLiteBuildTablesAndPopulate() {
obj_txt = format_and_sqlite_load.para(obj);
break;
default:
- if ((doc_matters.opt_action.debug_do)) {
+ if ((doc_matters.opt.action.debug_do)) {
writeln(__FILE__, ":", __LINE__, ": ", obj.is_a);
}
break;
@@ -969,14 +969,14 @@ template SQLiteBuildTablesAndPopulate() {
obj_txt = format_and_sqlite_load.table(obj);
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;
@@ -1006,14 +1006,14 @@ template SQLiteBuildTablesAndPopulate() {
obj_txt = format_and_sqlite_load.para(obj);
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;
@@ -1022,7 +1022,7 @@ template SQLiteBuildTablesAndPopulate() {
case "comment":
break;
default:
- if ((doc_matters.opt_action.debug_do)) {
+ if ((doc_matters.opt.action.debug_do)) {
writeln(__FILE__, ":", __LINE__, ": ", obj.of_part); // check where empty value could come from
writeln(__FILE__, ":", __LINE__, ": ", obj.is_a);
writeln(__FILE__, ":", __LINE__, ": ", obj.text); // check where empty value could come from
@@ -1073,7 +1073,7 @@ template SQLiteBuildTablesAndPopulate() {
}
}
}
- SQLiteObjectsLoop!()(doc_matters.keys_seq.sql);
+ SQLiteObjectsLoop!()(doc_matters.xml.keys_seq.sql);
}
}
template SQLiteTablesCreate() {
diff --git a/src/sdp/output/sqlite_discrete.d b/src/sdp/output/sqlite_discrete.d
index f97692f..0c323d1 100644
--- a/src/sdp/output/sqlite_discrete.d
+++ b/src/sdp/output/sqlite_discrete.d
@@ -44,7 +44,7 @@ template SQLiteDiscreteBuildTablesAndPopulate() {
if (_urls.length > 0) {
_txt ~= _urls;
}
- if (doc_matters.opt_action.debug_do) {
+ if (doc_matters.opt.action.debug_do) {
writeln(_txt, "\n");
}
debug(sql_text_clean) {
@@ -96,7 +96,7 @@ template SQLiteDiscreteBuildTablesAndPopulate() {
if (_notes.length > 0) {
_txt ~= _notes;
}
- if (doc_matters.opt_action.debug_do) {
+ if (doc_matters.opt.action.debug_do) {
writeln(_txt, "\n");
}
return _txt;
@@ -303,7 +303,7 @@ template SQLiteDiscreteBuildTablesAndPopulate() {
"text": generic_munge_sanitize_text_for_search(obj.text),
"html": html_heading(obj)
];
- if (doc_matters.opt_action.debug_do) {
+ if (doc_matters.opt.action.debug_do) {
debug(sql_txt) {
writeln(obj_txt["text"]);
}
@@ -322,7 +322,7 @@ template SQLiteDiscreteBuildTablesAndPopulate() {
"text": generic_munge_sanitize_text_for_search(obj.text),
"html": html_para(obj)
];
- if (doc_matters.opt_action.debug_do) {
+ if (doc_matters.opt.action.debug_do) {
debug(sql_txt) {
writeln(obj_txt["text"]);
}
@@ -341,7 +341,7 @@ template SQLiteDiscreteBuildTablesAndPopulate() {
"text": generic_munge_sanitize_text_for_search(obj.text),
"html": html_quote(obj)
];
- if (doc_matters.opt_action.debug_do) {
+ if (doc_matters.opt.action.debug_do) {
debug(sql_txt) {
writeln(obj_txt["text"]);
}
@@ -360,7 +360,7 @@ template SQLiteDiscreteBuildTablesAndPopulate() {
"text": generic_munge_sanitize_text_for_search(obj.text),
"html": html_group(obj)
];
- if (doc_matters.opt_action.debug_do) {
+ if (doc_matters.opt.action.debug_do) {
debug(sql_txt) {
writeln(obj_txt["text"]);
}
@@ -379,7 +379,7 @@ template SQLiteDiscreteBuildTablesAndPopulate() {
"text": generic_munge_sanitize_text_for_search(obj.text),
"html": html_block(obj)
];
- if (doc_matters.opt_action.debug_do) {
+ if (doc_matters.opt.action.debug_do) {
debug(sql_txt) {
writeln(obj_txt["text"]);
}
@@ -398,7 +398,7 @@ template SQLiteDiscreteBuildTablesAndPopulate() {
"text": generic_munge_sanitize_text_for_search(obj.text),
"html": html_verse(obj)
];
- if (doc_matters.opt_action.debug_do) {
+ if (doc_matters.opt.action.debug_do) {
debug(sql_txt) {
writeln(obj_txt["text"]);
}
@@ -417,7 +417,7 @@ template SQLiteDiscreteBuildTablesAndPopulate() {
"text": generic_munge_sanitize_text_for_search(obj.text),
"html": html_code(obj)
];
- if (doc_matters.opt_action.debug_do) {
+ if (doc_matters.opt.action.debug_do) {
debug(sql_txt) {
writeln(obj_txt["text"]);
}
@@ -436,7 +436,7 @@ template SQLiteDiscreteBuildTablesAndPopulate() {
"text": generic_munge_sanitize_text_for_search(obj.text),
"html": html_table(obj)
];
- if (doc_matters.opt_action.debug_do) {
+ if (doc_matters.opt.action.debug_do) {
debug(sql_txt) {
writeln(obj_txt["text"]);
}
@@ -456,8 +456,8 @@ template SQLiteDiscreteBuildTablesAndPopulate() {
Statement SQLiteInstruct(I)(
auto ref I doc_matters,
) {
- auto pth_sqlite = SiSUpathsSQLiteDiscrete!()(doc_matters.output_path, doc_matters.language);
- auto db = Database(pth_sqlite.sqlite_file(doc_matters.source_filename));
+ auto pth_sqlite = SiSUpathsSQLiteDiscrete!()(doc_matters.output_path, doc_matters.src.language);
+ auto db = Database(pth_sqlite.sqlite_file(doc_matters.src.filename));
// auto db = Database(":memory:"); // open database in memory
db.run("
DROP TABLE IF EXISTS metadata_and_text;
@@ -908,14 +908,14 @@ template SQLiteDiscreteBuildTablesAndPopulate() {
obj_txt = format_and_sqlite_load.heading(obj);
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;
@@ -937,7 +937,7 @@ template SQLiteDiscreteBuildTablesAndPopulate() {
obj_txt = format_and_sqlite_load.para(obj);
break;
default:
- if ((doc_matters.opt_action.debug_do)) {
+ if ((doc_matters.opt.action.debug_do)) {
writeln(__FILE__, ":", __LINE__, ": ", obj.is_a);
}
break;
@@ -966,14 +966,14 @@ template SQLiteDiscreteBuildTablesAndPopulate() {
obj_txt = format_and_sqlite_load.table(obj);
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;
@@ -1003,14 +1003,14 @@ template SQLiteDiscreteBuildTablesAndPopulate() {
obj_txt = format_and_sqlite_load.para(obj);
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;
@@ -1019,7 +1019,7 @@ template SQLiteDiscreteBuildTablesAndPopulate() {
case "comment":
break;
default:
- if ((doc_matters.opt_action.debug_do)) {
+ if ((doc_matters.opt.action.debug_do)) {
writeln(__FILE__, ":", __LINE__, ": ", obj.of_part); // check where empty value could come from
writeln(__FILE__, ":", __LINE__, ": ", obj.is_a);
writeln(__FILE__, ":", __LINE__, ": ", obj.text); // check where empty value could come from
@@ -1070,7 +1070,7 @@ template SQLiteDiscreteBuildTablesAndPopulate() {
}
}
}
- SQLiteObjectsLoop!()(doc_matters.keys_seq.sql);
+ SQLiteObjectsLoop!()(doc_matters.xml.keys_seq.sql);
}
}
template SQLiteDiscreteTablesCreate() {
diff --git a/src/sdp/output/xmls.d b/src/sdp/output/xmls.d
index 622e599..5e7f2e9 100644
--- a/src/sdp/output/xmls.d
+++ b/src/sdp/output/xmls.d
@@ -243,7 +243,7 @@ template outputXHTMLs() {
((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</div>"),
@@ -261,16 +261,16 @@ template outputXHTMLs() {
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"¶<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html 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 o;
o = format(q"¶%s
@@ -304,7 +304,7 @@ template outputXHTMLs() {
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;
}