aboutsummaryrefslogtreecommitdiffhomepage
path: root/org/output.org
diff options
context:
space:
mode:
Diffstat (limited to 'org/output.org')
-rw-r--r--org/output.org63
1 files changed, 26 insertions, 37 deletions
diff --git a/org/output.org b/org/output.org
index e0cf35b..74fca4e 100644
--- a/org/output.org
+++ b/org/output.org
@@ -535,9 +535,9 @@ auto endnote(O)(
#+name: output_html_scroll
#+BEGIN_SRC d
-void scroll_write_output_file(Fn,D)(
+void scroll_write_output_file(Fn,C)(
Fn fn_src,
- D doc,
+ C doc,
) {
debug(asserts){
static assert(is(typeof(fn_src) == string));
@@ -681,25 +681,22 @@ void scroll(C,T)(
#+name: output_html_seg
#+BEGIN_SRC d
-void seg_write_output_files(Fn,FnS,D)(
- Fn fn_src,
- FnS seg_filenames,
- D doc_html,
+void seg_write_output_files(M,C)(
+ M doc_matters,
+ C doc_html,
) {
debug(asserts){
- static assert(is(typeof(fn_src) == string));
- static assert(is(typeof(seg_filenames) == string[]));
static assert(is(typeof(doc_html) == string[][string]));
}
mixin SiSUpaths;
auto pth_html = HtmlPaths();
auto xhtml_format = outputXHTMLs();
- auto m = matchFirst(fn_src, rgx.src_fn);
+ auto m = matchFirst(doc_matters.source_filename, rgx.src_fn);
try {
- mkdirRecurse(pth_html.seg(fn_src));
- foreach (seg_filename; seg_filenames) {
+ mkdirRecurse(pth_html.seg(doc_matters.source_filename));
+ foreach (seg_filename; doc_matters.segnames) {
// writeln(__LINE__, ": ", fn);
- auto f = File(pth_html.fn_seg(fn_src, seg_filename), "w");
+ auto f = File(pth_html.fn_seg(doc_matters.source_filename, seg_filename), "w");
/+ // f.writeln(seg_head); // not needed built and inserted earlier +/
foreach (docseg; doc_html[seg_filename]) {
f.writeln(docseg);
@@ -717,16 +714,15 @@ void seg_write_output_files(Fn,FnS,D)(
#+name: output_html_seg
#+BEGIN_SRC d
-void seg(C,T)(
+void seg(C,M)(
auto ref const C contents,
- auto ref T doc_matters,
+ auto ref M doc_matters,
) {
auto xhtml_format = outputXHTMLs();
auto rgx = Rgx();
string[][string] doc_html;
string[] doc;
string segment_filename;
- string[] seg_filenames;
string[] top_level_headings = ["","","",""];
foreach (part; doc_matters.keys_seq_seg) {
foreach (obj; contents[part]) {
@@ -759,7 +755,6 @@ void seg(C,T)(
}
break;
case 4:
- seg_filenames ~= obj.segment_anchor_tag;
segment_filename = obj.segment_anchor_tag;
doc_html[segment_filename] ~= xhtml_format.seg_head(doc_matters.dochead_meta); // consider placing seg_head here as can more easily populate it with lev4 info
foreach (top_level_heading; top_level_headings) {
@@ -866,7 +861,7 @@ void seg(C,T)(
}
}
writeln(doc_matters.keys_seq_seg);
- seg_write_output_files(doc_matters.source_filename, seg_filenames, doc_html);
+ seg_write_output_files(doc_matters, doc_html);
}
#+END_SRC
@@ -2348,7 +2343,7 @@ obj.segment_anchor_tag, // lev < 4 [no link]; lev == 4 [filename] markup.xhtml
}
#+END_SRC
-**** (sections & objects) switch (for epub xhtml output format)
+**** build (sections & objects) switch (for epub xhtml output format)
#+name: output_epub_xhtml_seg
#+BEGIN_SRC d
@@ -2362,7 +2357,6 @@ void doc_content(C,T)(
string[][string] doc_epub;
string[] doc;
string segment_filename;
- string[] seg_filenames;
string[] top_level_headings = ["","","",""];
auto mimetypes = epub_mimetypes;
auto meta_inf_container_xml = epub_container_xml;
@@ -2401,7 +2395,6 @@ void doc_content(C,T)(
}
break;
case 4:
- seg_filenames ~= obj.segment_anchor_tag;
segment_filename = obj.segment_anchor_tag;
doc_epub[segment_filename] ~= xhtml_format.seg_head(doc_matters.dochead_meta);
foreach (top_level_heading; top_level_headings) {
@@ -2515,8 +2508,7 @@ void doc_content(C,T)(
}
writeln(doc_matters.keys_seq_seg);
epub_write_output_files(
- doc_matters.source_filename,
- seg_filenames,
+ doc_matters,
doc_epub,
mimetypes,
meta_inf_container_xml,
@@ -2530,18 +2522,15 @@ void doc_content(C,T)(
#+name: output_epub_xhtml_seg
#+BEGIN_SRC d
-void epub_write_output_files(Fn,FnS,De,Mt,Mic,Ot,Oc)(
- Fn fn_src,
- FnS seg_filenames,
- De doc_epub,
+void epub_write_output_files(C,EpD,Mt,Mic,Ot,Oc)(
+ C doc_matters,
+ EpD doc_epub,
Mt mimetypes,
Mic meta_inf_container_xml,
Ot oebps_toc_ncx,
Oc oebps_content_opf,
) {
debug(asserts){
- static assert(is(typeof(fn_src) == string));
- static assert(is(typeof(seg_filenames) == string[]));
static assert(is(typeof(doc_epub) == string[][string]));
static assert(is(typeof(mimetypes) == string));
static assert(is(typeof(meta_inf_container_xml) == string));
@@ -2553,12 +2542,12 @@ void epub_write_output_files(Fn,FnS,De,Mt,Mic,Ot,Oc)(
// doc = xhtml_format.scroll_head ~ doc_epub ~ xhtml_format.tail;
auto xhtml_format = outputXHTMLs();
try {
- mkdirRecurse(pth_epub.doc_meta_inf(fn_src));
- mkdirRecurse(pth_epub.doc_oebps_css(fn_src));
- mkdirRecurse(pth_epub.doc_oebps_image(fn_src));
+ mkdirRecurse(pth_epub.doc_meta_inf(doc_matters.source_filename));
+ mkdirRecurse(pth_epub.doc_oebps_css(doc_matters.source_filename));
+ mkdirRecurse(pth_epub.doc_oebps_image(doc_matters.source_filename));
/+ OEBPS/[segments].xhtml +/
- foreach (seg_filename; seg_filenames) {
- auto f = File(pth_epub.fn_oebps_content_xhtml(fn_src, seg_filename), "w");
+ foreach (seg_filename; doc_matters.segnames) {
+ auto f = File(pth_epub.fn_oebps_content_xhtml(doc_matters.source_filename, seg_filename), "w");
/+ // f.writeln(seg_head); // not needed built and inserted earlier +/
foreach (docseg; doc_epub[seg_filename]) {
f.writeln(docseg);
@@ -2566,16 +2555,16 @@ void epub_write_output_files(Fn,FnS,De,Mt,Mic,Ot,Oc)(
f.writeln(xhtml_format.tail); // needed for each lev4
}
/+ mimetypes +/
- auto f = File(pth_epub.fn_mimetypes(fn_src), "w");
+ auto f = File(pth_epub.fn_mimetypes(doc_matters.source_filename), "w");
f.writeln(mimetypes);
/+ META-INF/container.xml +/
- f = File(pth_epub.fn_dmi_container_xml(fn_src), "w");
+ f = File(pth_epub.fn_dmi_container_xml(doc_matters.source_filename), "w");
f.writeln(meta_inf_container_xml);
/+ OEBPS/toc.ncx +/
- f = File(pth_epub.fn_oebps_toc_ncx(fn_src), "w");
+ f = File(pth_epub.fn_oebps_toc_ncx(doc_matters.source_filename), "w");
f.writeln(oebps_toc_ncx);
/+ OEBPS/content.opf +/
- f = File(pth_epub.fn_oebps_content_opf(fn_src), "w");
+ f = File(pth_epub.fn_oebps_content_opf(doc_matters.source_filename), "w");
f.writeln(oebps_content_opf);
}
catch (ErrnoException ex) {