aboutsummaryrefslogtreecommitdiffhomepage
path: root/org
diff options
context:
space:
mode:
Diffstat (limited to 'org')
-rw-r--r--org/output.org136
1 files changed, 67 insertions, 69 deletions
diff --git a/org/output.org b/org/output.org
index 48fea4f..9c23caa 100644
--- a/org/output.org
+++ b/org/output.org
@@ -29,7 +29,6 @@ template outputHub() {
std.container,
std.exception,
std.getopt,
- std.json,
std.process,
std.stdio,
std.file,
@@ -57,9 +56,7 @@ template outputHub() {
writeln("source");
}
if (doc_matters.opt_action_bool["sisupod"]) {
- mixin SiSUpod;
- auto sisupod=SiSUpod();
- sisupod.sisupod_assemble(doc_matters.source_filename);
+ SiSUpod!()(doc_matters.source_filename);
writeln("sisupod source");
}
if (doc_matters.opt_action_bool["text"]) {
@@ -69,41 +66,15 @@ template outputHub() {
// text.scroll(contents, bookindex_unordered_hashes, biblio, dochead_make, dochead_meta, fn_src, opt_action_bool);
}
if (doc_matters.opt_action_bool["html"]) {
- mixin outputHTML;
- auto html=outputHTML();
- html.css_write;
- html.scroll(
- contents,
- doc_matters,
- );
- html.seg(
- contents,
- doc_matters,
- );
+ outputHTML!().scroll(contents,doc_matters);
+ outputHTML!().seg(contents,doc_matters);
} else if(doc_matters.opt_action_bool["html_seg"]) {
- mixin outputHTML;
- auto html=outputHTML();
- html.css_write;
- html.seg(
- contents,
- doc_matters,
- );
+ outputHTML!().seg(contents,doc_matters);
} else if(doc_matters.opt_action_bool["html_scroll"]) {
- mixin outputHTML;
- auto html=outputHTML();
- html.css_write;
- html.scroll(
- contents,
- doc_matters,
- );
+ outputHTML!().scroll(contents,doc_matters);
}
if (doc_matters.opt_action_bool["epub"]) {
- mixin outputEPub;
- auto epub=outputEPub();
- epub.doc_content( // consolidate
- contents,
- doc_matters,
- );
+ outputEPub!()(contents, doc_matters);
// epub.css_write;
// writeln("epub processing");
}
@@ -128,17 +99,44 @@ template outputHub() {
#+END_SRC
* output functions :output:
+** output imports
+
+#+name: output_imports
+#+BEGIN_SRC d
+private import
+ std.algorithm,
+ std.array,
+ std.container,
+ std.exception,
+ std.file,
+ std.getopt,
+ std.json,
+ std.process,
+ std.stdio,
+ std.path,
+ std.range,
+ std.regex,
+ std.string,
+ std.traits,
+ std.typecons,
+ std.uni,
+ std.utf,
+ ao_defaults;
+import
+ ao_rgx,
+ output_xhtmls;
+#+END_SRC
+
** sisupod :sisupod:
*** sisupod template :template:
#+BEGIN_SRC d :tangle ../src/sdp/source_sisupod.d
template SiSUpod() {
- struct SiSUpod {
- <<source_sisupod_mkdirs>>
- <<source_sisupod_config>>
- <<source_sisupod_text>>
- <<source_sisupod_images>>
- }
+ <<output_imports>>
+ <<source_sisupod_mkdirs>>
+ <<source_sisupod_config>>
+ <<source_sisupod_text>>
+ <<source_sisupod_images>>
}
#+END_SRC
@@ -146,12 +144,13 @@ template SiSUpod() {
#+name: source_sisupod_config
#+BEGIN_SRC d
-void sisupod_assemble(S)(
+void SiSUpod(S)(
S fn_src,
) {
debug(asserts){
static assert(is(typeof(fn_src) == string));
}
+ mixin SiSUrgxInit;
mixin SiSUpaths;
auto pth_sisupod = SiSUpodPaths();
mixin SiSUlanguageCodes;
@@ -525,18 +524,17 @@ auto endnote(O)(
}
#+END_SRC
-*** html output [#A] :html:
+*** html [#A] :html:
**** html template :template:
#+BEGIN_SRC d :tangle ../src/sdp/output_html.d
template outputHTML() {
- struct outputHTML {
- mixin outputXHTMLs;
- <<output_html>>
- <<output_html_scroll>>
- <<output_html_seg>>
- <<output_html_css>>
- }
+ <<output_imports>>
+ mixin outputXHTMLs;
+ <<output_html>>
+ <<output_html_scroll>>
+ <<output_html_seg>>
+ <<output_html_css>>
}
#+END_SRC
@@ -576,6 +574,7 @@ void scroll(C,T)(
auto ref const C contents,
auto ref T doc_matters,
) {
+ mixin SiSUrgxInit;
auto xhtml_format = outputXHTMLs();
auto rgx = Rgx();
string[] doc_html;
@@ -698,6 +697,8 @@ void seg_write_output_files(M,C)(
debug(asserts){
static assert(is(typeof(doc_html) == string[][string]));
}
+ mixin SiSUrgxInit;
+ auto rgx = Rgx();
mixin SiSUpaths;
auto pth_html = HtmlPaths();
auto xhtml_format = outputXHTMLs();
@@ -728,8 +729,9 @@ void seg(C,M)(
auto ref const C contents,
auto ref M doc_matters,
) {
- auto xhtml_format = outputXHTMLs();
+ mixin SiSUrgxInit;
auto rgx = Rgx();
+ auto xhtml_format = outputXHTMLs();
string[][string] doc_html;
string[] doc;
string segment_filename;
@@ -2189,15 +2191,14 @@ auto css_write() {
#+BEGIN_SRC d :tangle ../src/sdp/output_epub.d
template outputEPub() {
- struct outputEPub {
- mixin InternalMarkup;
- mixin outputXHTMLs;
- <<output_epub_fixed>>
- <<output_epub_constructs>>
- <<output_epub_xhtml>>
- <<output_epub_xhtml_seg>>
- <<output_epub_css>>
- }
+ <<output_imports>>
+ mixin InternalMarkup;
+ mixin outputXHTMLs;
+ <<output_epub_fixed>>
+ <<output_epub_constructs>>
+ <<output_epub_xhtml>>
+ <<output_epub_xhtml_seg>>
+ <<output_epub_css>>
}
#+END_SRC
@@ -2237,11 +2238,7 @@ string epub_container_xml() {
#+name: output_epub_constructs
#+BEGIN_SRC d
-string epub_oebps_content(
- // string[string][string] dochead_meta,
-) {
- // string[] toc;
- // int counter = 0;
+string epub_oebps_content(C,M)(C contents, M doc_matters) {
string uuid = "18275d951861c77f78acd05672c9906924c59f18a2e0ba06dad95959693e9bd8"; // TODO shared elsewhere
string content = format(q"ΒΆ<?xml version='1.0' encoding='utf-8'?>
<?xml version='1.0' encoding='utf-8'?>
@@ -2287,7 +2284,7 @@ string epub_oebps_content(
#+name: output_epub_constructs
#+BEGIN_SRC d
-string epub_oebps_toc() {
+string epub_oebps_toc(C,M)(C contents, M doc_matters) {
int counter = 0;
string uuid = "18275d951861c77f78acd05672c9906924c59f18a2e0ba06dad95959693e9bd8"; // TODO shared elsewhere
auto markup = InlineMarkup();
@@ -2373,10 +2370,11 @@ obj.segment_anchor_tag, // lev < 4 [no link]; lev == 4 [filename] markup.xhtml
#+name: output_epub_xhtml_seg
#+BEGIN_SRC d
-void doc_content(C,T)(
+void outputEPub(C,T)(
auto ref const C contents,
auto ref T doc_matters,
) {
+ mixin SiSUrgxInit;
auto xhtml_format = outputXHTMLs();
auto rgx = Rgx();
// string[] toc;
@@ -2386,8 +2384,8 @@ void doc_content(C,T)(
string[] top_level_headings = ["","","",""];
auto mimetypes = epub_mimetypes;
auto meta_inf_container_xml = epub_container_xml;
- auto oebps_toc_ncx = epub_oebps_toc;
- auto oebps_content_opf = epub_oebps_content;
+ auto oebps_toc_ncx = epub_oebps_toc(contents, doc_matters);
+ auto oebps_content_opf = epub_oebps_content(contents, doc_matters);
foreach (part; doc_matters.keys_seq_seg) {
foreach (obj; contents[part]) {
if (obj.is_a == "heading") {