diff options
author | Ralph Amissah <ralph.amissah@gmail.com> | 2018-09-28 17:05:34 -0400 |
---|---|---|
committer | Ralph Amissah <ralph.amissah@gmail.com> | 2019-04-10 15:14:15 -0400 |
commit | 08a374929fdfd11b2546636a9151518491457f18 (patch) | |
tree | 31b97119fcd3d3e37a94cee5becdc841745ba693 /src | |
parent | doc_abstraction provide object with segment it occurs in (diff) |
output xmls & sqlite, make doc_matter available
Diffstat (limited to 'src')
-rw-r--r-- | src/doc_reform/output/epub3.d | 32 | ||||
-rw-r--r-- | src/doc_reform/output/html.d | 74 | ||||
-rw-r--r-- | src/doc_reform/output/hub.d | 6 | ||||
-rw-r--r-- | src/doc_reform/output/sqlite.d | 152 | ||||
-rw-r--r-- | src/doc_reform/output/xmls.d | 324 |
5 files changed, 317 insertions, 271 deletions
diff --git a/src/doc_reform/output/epub3.d b/src/doc_reform/output/epub3.d index 7c4e346..19c7934 100644 --- a/src/doc_reform/output/epub3.d +++ b/src/doc_reform/output/epub3.d @@ -337,7 +337,7 @@ template outputEPub3() { default: doc_parts_ ~= obj.tags.segment_anchor_tag; doc_epub3[obj.tags.segment_anchor_tag] ~= xhtml_format.epub3_seg_head(doc_matters); - auto t = xhtml_format.heading_seg(obj, _txt, suffix, "epub"); + auto t = xhtml_format.heading_seg(doc_matters, obj, _txt, suffix, "epub"); doc_epub3[obj.tags.segment_anchor_tag] ~= t[0]; doc_epub3_endnotes[obj.tags.segment_anchor_tag] ~= t[1]; break; @@ -346,12 +346,12 @@ template outputEPub3() { case 4: segment_filename = obj.tags.segment_anchor_tag; doc_epub3[segment_filename] ~= xhtml_format.epub3_seg_head(doc_matters); - auto t = xhtml_format.heading_seg(obj, _txt, suffix, "epub"); + auto t = xhtml_format.heading_seg(doc_matters, obj, _txt, suffix, "epub"); doc_epub3[segment_filename] ~= t[0]; doc_epub3_endnotes[segment_filename] ~= t[1]; break; case 5: .. case 7: - auto t = xhtml_format.heading_seg(obj, _txt, suffix, "epub"); + auto t = xhtml_format.heading_seg(doc_matters, obj, _txt, suffix, "epub"); doc_epub3[segment_filename] ~= t[0]; doc_epub3_endnotes[segment_filename] ~= t[1]; break; @@ -375,7 +375,7 @@ template outputEPub3() { case "para": switch (obj.metainfo.is_a) { case "toc": - auto t = xhtml_format.para_seg(obj, _txt, suffix, "epub"); + auto t = xhtml_format.para_seg(doc_matters, obj, _txt, suffix, "epub"); doc_epub3[segment_filename] ~= t[0]; doc_epub3_endnotes[segment_filename] ~= t[1]; break; @@ -398,7 +398,7 @@ template outputEPub3() { case "para": switch (obj.metainfo.is_a) { case "para": - auto t = xhtml_format.para_seg(obj, _txt, suffix, "epub"); + auto t = xhtml_format.para_seg(doc_matters, obj, _txt, suffix, "epub"); doc_epub3[segment_filename] ~= t[0]; doc_epub3_endnotes[segment_filename] ~= t[1]; break; @@ -412,32 +412,32 @@ template outputEPub3() { case "block": switch (obj.metainfo.is_a) { case "quote": - auto t = xhtml_format.quote_seg(obj, _txt, suffix, "epub"); + auto t = xhtml_format.quote_seg(doc_matters, obj, _txt, suffix, "epub"); doc_epub3[segment_filename] ~= t[0].to!string; doc_epub3_endnotes[segment_filename] ~= t[1]; break; case "group": - auto t = xhtml_format.group_seg(obj, _txt, suffix, "epub"); + auto t = xhtml_format.group_seg(doc_matters, obj, _txt, suffix, "epub"); doc_epub3[segment_filename] ~= t[0].to!string; doc_epub3_endnotes[segment_filename] ~= t[1]; break; case "block": - auto t = xhtml_format.block_seg(obj, _txt, suffix, "epub"); + auto t = xhtml_format.block_seg(doc_matters, obj, _txt, suffix, "epub"); doc_epub3[segment_filename] ~= t[0].to!string; doc_epub3_endnotes[segment_filename] ~= t[1]; break; case "poem": break; case "verse": - auto t = xhtml_format.verse_seg(obj, _txt, suffix, "epub"); + auto t = xhtml_format.verse_seg(doc_matters, obj, _txt, suffix, "epub"); doc_epub3[segment_filename] ~= t[0].to!string; doc_epub3_endnotes[segment_filename] ~= t[1]; break; case "code": - doc_epub3[segment_filename] ~= xhtml_format.code(obj, _txt); + doc_epub3[segment_filename] ~= xhtml_format.code(doc_matters, obj, _txt); break; case "table": - doc_epub3[segment_filename] ~= xhtml_format.table(obj, _txt); + doc_epub3[segment_filename] ~= xhtml_format.table(doc_matters, obj, _txt); doc_epub3_endnotes[segment_filename] ~= ""; break; default: @@ -460,26 +460,26 @@ template outputEPub3() { case "para": switch (obj.metainfo.is_a) { case "endnote": assert(part == "endnotes"); - auto t = xhtml_format.para_seg(obj, _txt, suffix, "epub"); + auto t = xhtml_format.para_seg(doc_matters, obj, _txt, suffix, "epub"); doc_epub3[segment_filename] ~= t[0]; break; case "glossary": assert(part == "glossary"); - auto t = xhtml_format.para_seg(obj, _txt, suffix, "epub"); + auto t = xhtml_format.para_seg(doc_matters, obj, _txt, suffix, "epub"); doc_epub3[segment_filename] ~= t[0]; doc_epub3_endnotes[segment_filename] ~= t[1]; break; case "bibliography": assert(part == "bibliography"); - auto t = xhtml_format.para_seg(obj, _txt, suffix, "epub"); + auto t = xhtml_format.para_seg(doc_matters, obj, _txt, suffix, "epub"); doc_epub3[segment_filename] ~= t[0]; doc_epub3_endnotes[segment_filename] ~= t[1]; break; case "bookindex": assert(part == "bookindex_seg"); - auto t = xhtml_format.para_seg(obj, _txt, suffix, "epub"); + auto t = xhtml_format.para_seg(doc_matters, obj, _txt, suffix, "epub"); doc_epub3[segment_filename] ~= t[0]; doc_epub3_endnotes[segment_filename] ~= t[1]; break; case "blurb": assert(part == "blurb"); - auto t = xhtml_format.para_seg(obj, _txt, suffix, "epub"); + auto t = xhtml_format.para_seg(doc_matters, obj, _txt, suffix, "epub"); doc_epub3[segment_filename] ~= t[0]; doc_epub3_endnotes[segment_filename] ~= t[1]; break; diff --git a/src/doc_reform/output/html.d b/src/doc_reform/output/html.d index 5d5ccb5..bad29db 100644 --- a/src/doc_reform/output/html.d +++ b/src/doc_reform/output/html.d @@ -12,9 +12,9 @@ template outputHTML() { doc_reform.output.xmls, doc_reform.output.xmls_css; mixin outputXHTMLs; - void scroll(D,I)( - const D doc_abstraction, - I doc_matters, + void scroll(D,M)( + const D doc_abstraction, + M doc_matters, ) { mixin DocReformOutputRgxInit; auto xhtml_format = outputXHTMLs(); @@ -34,10 +34,10 @@ template outputHTML() { case "para": switch (obj.metainfo.is_a) { case "heading": - doc_html ~= delimit ~ xhtml_format.heading_scroll(obj, _txt, suffix); + doc_html ~= delimit ~ xhtml_format.heading_scroll(doc_matters, obj, _txt, suffix); break; case "toc": - doc_html ~= xhtml_format.para_scroll(obj, _txt, suffix); + doc_html ~= xhtml_format.para_scroll(doc_matters, obj, _txt, suffix); break; default: if ((doc_matters.opt.action.debug_do)) { @@ -58,10 +58,10 @@ template outputHTML() { case "para": switch (obj.metainfo.is_a) { case "heading": - doc_html ~= delimit ~ xhtml_format.heading_scroll(obj, _txt, suffix); + doc_html ~= delimit ~ xhtml_format.heading_scroll(doc_matters, obj, _txt, suffix); break; case "para": - doc_html ~= xhtml_format.para_scroll(obj, _txt, suffix); + doc_html ~= xhtml_format.para_scroll(doc_matters, obj, _txt, suffix); break; default: if ((doc_matters.opt.action.debug_do)) { @@ -73,24 +73,24 @@ template outputHTML() { case "block": switch (obj.metainfo.is_a) { case "quote": - doc_html ~= xhtml_format.quote_scroll(obj, _txt); + doc_html ~= xhtml_format.quote_scroll(doc_matters, obj, _txt); break; case "group": - doc_html ~= xhtml_format.group_scroll(obj, _txt); + doc_html ~= xhtml_format.group_scroll(doc_matters, obj, _txt); break; case "block": - doc_html ~= xhtml_format.block_scroll(obj, _txt); + doc_html ~= xhtml_format.block_scroll(doc_matters, obj, _txt); break; case "poem": break; case "verse": - doc_html ~= xhtml_format.verse_scroll(obj, _txt, suffix); + doc_html ~= xhtml_format.verse_scroll(doc_matters, obj, _txt, suffix); break; case "code": - doc_html ~= xhtml_format.code(obj, _txt); + doc_html ~= xhtml_format.code(doc_matters, obj, _txt); break; case "table": - doc_html ~= xhtml_format.table(obj, _txt); + doc_html ~= xhtml_format.table(doc_matters, obj, _txt); break; default: if ((doc_matters.opt.action.debug_do)) { @@ -112,22 +112,22 @@ template outputHTML() { case "para": switch (obj.metainfo.is_a) { case "heading": - doc_html ~= delimit ~ xhtml_format.heading_scroll(obj, _txt, suffix); + doc_html ~= delimit ~ xhtml_format.heading_scroll(doc_matters, obj, _txt, suffix); break; case "endnote": assert(part == "endnotes"); - doc_html ~= xhtml_format.para_scroll(obj, _txt, suffix); + doc_html ~= xhtml_format.para_scroll(doc_matters, obj, _txt, suffix); break; case "glossary": assert(part == "glossary"); - doc_html ~= xhtml_format.para_scroll(obj, _txt, suffix); + doc_html ~= xhtml_format.para_scroll(doc_matters, obj, _txt, suffix); break; case "bibliography": assert(part == "bibliography"); - doc_html ~= xhtml_format.para_scroll(obj, _txt, suffix); + doc_html ~= xhtml_format.para_scroll(doc_matters, obj, _txt, suffix); break; case "bookindex": assert(part == "bookindex_scroll"); - doc_html ~= xhtml_format.para_scroll(obj, _txt, suffix); + doc_html ~= xhtml_format.para_scroll(doc_matters, obj, _txt, suffix); break; case "blurb": assert(part == "blurb"); - doc_html ~= xhtml_format.para_scroll(obj, _txt, suffix); + doc_html ~= xhtml_format.para_scroll(doc_matters, obj, _txt, suffix); break; default: if ((doc_matters.opt.action.debug_do)) { @@ -226,7 +226,7 @@ template outputHTML() { top_level_headings[3] = ""; goto default; default: - auto t = xhtml_format.heading_seg(obj, _txt, suffix, "seg"); + auto t = xhtml_format.heading_seg(doc_matters, obj, _txt, suffix, "seg"); top_level_headings[obj.metainfo.heading_lev_markup] = t[0]; break; } @@ -234,19 +234,19 @@ template outputHTML() { case 4: segment_filename = obj.tags.segment_anchor_tag; doc_html[segment_filename] ~= xhtml_format.html_head(doc_matters, "seg"); - auto navigation_bar = xhtml_format.nav_pre_next_svg(obj); + auto navigation_bar = xhtml_format.nav_pre_next_svg(doc_matters, obj); 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; } - auto t = xhtml_format.heading_seg(obj, _txt, suffix, "seg"); + auto t = xhtml_format.heading_seg(doc_matters, obj, _txt, suffix, "seg"); doc_html[segment_filename] ~= t[0].to!string; - doc_html[segment_filename] ~= xhtml_format.lev4_heading_subtoc(obj); + doc_html[segment_filename] ~= xhtml_format.lev4_heading_subtoc(doc_matters, obj); doc_html_endnotes[segment_filename] ~= t[1]; break; case 5: .. case 7: - auto t = xhtml_format.heading_seg(obj, _txt, suffix, "seg"); + auto t = xhtml_format.heading_seg(doc_matters, obj, _txt, suffix, "seg"); doc_html[segment_filename] ~= t[0].to!string; doc_html_endnotes[segment_filename] ~= t[1]; break; @@ -270,7 +270,7 @@ template outputHTML() { case "para": switch (obj.metainfo.is_a) { case "toc": - auto t = xhtml_format.para_seg(obj, _txt, suffix, "seg"); + auto t = xhtml_format.para_seg(doc_matters, obj, _txt, suffix, "seg"); doc_html[segment_filename] ~= t[0].to!string; break; default: @@ -292,7 +292,7 @@ template outputHTML() { case "para": switch (obj.metainfo.is_a) { case "para": - auto t = xhtml_format.para_seg(obj, _txt, suffix, "seg"); + auto t = xhtml_format.para_seg(doc_matters, obj, _txt, suffix, "seg"); doc_html[segment_filename] ~= t[0].to!string; doc_html_endnotes[segment_filename] ~= t[1]; break; @@ -306,32 +306,32 @@ template outputHTML() { case "block": switch (obj.metainfo.is_a) { case "quote": - auto t = xhtml_format.quote_seg(obj, _txt, suffix, "seg"); + auto t = xhtml_format.quote_seg(doc_matters, obj, _txt, suffix, "seg"); doc_html[segment_filename] ~= t[0].to!string; doc_html_endnotes[segment_filename] ~= t[1]; break; case "group": - auto t = xhtml_format.group_seg(obj, _txt, suffix, "seg"); + auto t = xhtml_format.group_seg(doc_matters, obj, _txt, suffix, "seg"); doc_html[segment_filename] ~= t[0].to!string; doc_html_endnotes[segment_filename] ~= t[1]; break; case "block": - auto t = xhtml_format.block_seg(obj, _txt, suffix, "seg"); + auto t = xhtml_format.block_seg(doc_matters, obj, _txt, suffix, "seg"); doc_html[segment_filename] ~= t[0].to!string; doc_html_endnotes[segment_filename] ~= t[1]; break; case "poem": break; case "verse": - auto t = xhtml_format.verse_seg(obj, _txt, suffix, "seg"); + auto t = xhtml_format.verse_seg(doc_matters, obj, _txt, suffix, "seg"); doc_html[segment_filename] ~= t[0].to!string; doc_html_endnotes[segment_filename] ~= t[1]; break; case "code": - doc_html[segment_filename] ~= xhtml_format.code(obj, _txt); + doc_html[segment_filename] ~= xhtml_format.code(doc_matters, obj, _txt); break; case "table": - doc_html[segment_filename] ~= xhtml_format.table(obj, _txt); + doc_html[segment_filename] ~= xhtml_format.table(doc_matters, obj, _txt); doc_html_endnotes[segment_filename] ~= ""; break; default: @@ -354,26 +354,26 @@ template outputHTML() { case "para": switch (obj.metainfo.is_a) { case "endnote": assert(part == "endnotes"); - auto t = xhtml_format.para_seg(obj, _txt, suffix, "seg"); + auto t = xhtml_format.para_seg(doc_matters, obj, _txt, suffix, "seg"); doc_html[segment_filename] ~= t[0]; break; case "glossary": assert(part == "glossary"); - auto t = xhtml_format.para_seg(obj, _txt, suffix, "seg"); + auto t = xhtml_format.para_seg(doc_matters, obj, _txt, suffix, "seg"); doc_html[segment_filename] ~= t[0]; doc_html_endnotes[segment_filename] ~= t[1]; break; case "bibliography": assert(part == "bibliography"); - auto t = xhtml_format.para_seg(obj, _txt, suffix, "seg"); + auto t = xhtml_format.para_seg(doc_matters, obj, _txt, suffix, "seg"); doc_html[segment_filename] ~= t[0]; doc_html_endnotes[segment_filename] ~= t[1]; break; case "bookindex": assert(part == "bookindex_seg"); - auto t = xhtml_format.para_seg(obj, _txt, suffix, "seg"); + auto t = xhtml_format.para_seg(doc_matters, obj, _txt, suffix, "seg"); doc_html[segment_filename] ~= t[0]; doc_html_endnotes[segment_filename] ~= t[1]; break; case "blurb": assert(part == "blurb"); - auto t = xhtml_format.para_seg(obj, _txt, suffix, "seg"); + auto t = xhtml_format.para_seg(doc_matters, obj, _txt, suffix, "seg"); doc_html[segment_filename] ~= t[0]; doc_html_endnotes[segment_filename] ~= t[1]; break; diff --git a/src/doc_reform/output/hub.d b/src/doc_reform/output/hub.d index a0a73cd..409f2bc 100644 --- a/src/doc_reform/output/hub.d +++ b/src/doc_reform/output/hub.d @@ -28,7 +28,7 @@ template outputHub() { } if (sched == outTask.sqlite) { msg.v("sqlite processing... "); - SQLiteHubDiscreteBuildTablesAndPopulate!()(doc_abstraction, doc_matters); + SQLiteHubDiscreteBuildTablesAndPopulate!()(doc_matters, doc_abstraction); msg.vv("sqlite done"); } if (sched == outTask.epub) { @@ -63,11 +63,11 @@ template outputHub() { } if (doc_matters.opt.action.sqlite_update) { msg.v("sqlite update processing..."); - SQLiteHubBuildTablesAndPopulate!()(doc_abstraction, doc_matters); + SQLiteHubBuildTablesAndPopulate!()(doc_matters, doc_abstraction); msg.vv("sqlite update done"); } else if (doc_matters.opt.action.sqlite_delete) { msg.v("sqlite delete processing..."); - SQLiteHubBuildTablesAndPopulate!()(doc_abstraction, doc_matters); + SQLiteHubBuildTablesAndPopulate!()(doc_matters, doc_abstraction); msg.vv("sqlite delete done"); } } diff --git a/src/doc_reform/output/sqlite.d b/src/doc_reform/output/sqlite.d index 6fbb4a7..b317dc0 100644 --- a/src/doc_reform/output/sqlite.d +++ b/src/doc_reform/output/sqlite.d @@ -9,18 +9,18 @@ mixin DocReformOutputRgxInit; static auto rgx = Rgx(); long _metadata_tid_lastrowid; template SQLiteHubBuildTablesAndPopulate() { - void SQLiteHubBuildTablesAndPopulate(D,I)( + void SQLiteHubBuildTablesAndPopulate(M,D)( + M doc_matters, D doc_abstraction, - I doc_matters, ) { auto pth_sqlite = DocReformPathsSQLite!()(doc_matters.sqlite.filename, doc_matters.output_path); pth_sqlite.base.mkdirRecurse; auto db = Database(pth_sqlite.sqlite_file); template SQLiteDbStatementComposite() { - void SQLiteDbStatementComposite(Db,D,I)( + void SQLiteDbStatementComposite(Db,M,D)( Db db, + M doc_matters, D doc_abstraction, - I doc_matters, ) { { string _db_statement; @@ -41,7 +41,7 @@ template SQLiteHubBuildTablesAndPopulate() { _db_statement ~= SQLiteInsertMetadata!()(doc_matters); SQLiteDbRun!()(db, _db_statement, doc_matters.opt.action, "INSERT MetaData"); /+ get tid (lastrowid or max) for use in doc_objects table +/ - _db_statement ~= SQLiteInsertDocObjectsLoop!()(doc_abstraction, doc_matters); + _db_statement ~= SQLiteInsertDocObjectsLoop!()(doc_matters, doc_abstraction); SQLiteDbRun!()(db, _db_statement, doc_matters.opt.action, "INSERT DocObjects"); } } @@ -52,29 +52,29 @@ template SQLiteHubBuildTablesAndPopulate() { } } } - SQLiteDbStatementComposite!()(db, doc_abstraction, doc_matters); + SQLiteDbStatementComposite!()(db, doc_matters, doc_abstraction); } } template SQLiteHubDiscreteBuildTablesAndPopulate() { - void SQLiteHubDiscreteBuildTablesAndPopulate(D,I)( + void SQLiteHubDiscreteBuildTablesAndPopulate(M,D)( + M doc_matters, D doc_abstraction, - I doc_matters, ) { auto pth_sqlite = DocReformPathsSQLiteDiscrete!()(doc_matters.output_path, doc_matters.src.language); pth_sqlite.base.mkdirRecurse; auto db = Database(pth_sqlite.sqlite_file(doc_matters.src.filename)); template SQLiteDiscreteDbStatementComposite() { - void SQLiteDiscreteDbStatementComposite(Db,D,I)( + void SQLiteDiscreteDbStatementComposite(Db,M,D)( Db db, + M doc_matters, D doc_abstraction, - I doc_matters, ) { { string _db_statement; { _db_statement ~= SQLiteTablesReCreate!()(); _db_statement ~= SQLiteInsertMetadata!()(doc_matters); - _db_statement ~= SQLiteInsertDocObjectsLoop!()(doc_abstraction, doc_matters); + _db_statement ~= SQLiteInsertDocObjectsLoop!()(doc_matters, doc_abstraction); SQLiteDbRun!()(db, _db_statement, doc_matters.opt.action, "table CREATE Tables, INSERT DocObjects"); } db.close; @@ -84,7 +84,7 @@ template SQLiteHubDiscreteBuildTablesAndPopulate() { } } } - SQLiteDiscreteDbStatementComposite!()(db, doc_abstraction, doc_matters); + SQLiteDiscreteDbStatementComposite!()(db, doc_matters, doc_abstraction); } } template SQLiteDbRun() { @@ -128,8 +128,8 @@ template SQLinsertDelimiter() { } } template SQLiteFormatAndLoadObject() { - auto SQLiteFormatAndLoadObject(I)( - I doc_matters, + auto SQLiteFormatAndLoadObject(M)( + M doc_matters, ) { mixin DocReformOutputRgxInit; struct sqlite_format_and_load_objects { @@ -166,7 +166,8 @@ template SQLiteFormatAndLoadObject() { } return _txt; } - auto munge_html(O)( + auto munge_html(M,O)( + M doc_matters, auto ref const O obj, ) { string _html_special_characters(string _txt){ @@ -248,10 +249,11 @@ template SQLiteFormatAndLoadObject() { .replaceAll(rgx.inline_cite, "<cite>$1</cite>"); return _txt; } - auto html_heading(O)( + auto html_heading(M,O)( + M doc_matters, auto ref const O obj, ) { - string _txt = munge_html(obj); + string _txt = munge_html(doc_matters, obj); string o = format(q"¶<p class="%s"><b> %s </b></p>¶", @@ -260,10 +262,11 @@ template SQLiteFormatAndLoadObject() { ); return o; } - auto html_para(O)( + auto html_para(M,O)( + M doc_matters, auto ref const O obj, ) { - string _txt = munge_html(obj); + string _txt = munge_html(doc_matters, obj); _txt = (obj.attrib.bullet) ? ("●  " ~ _txt) : _txt; string o = format(q"¶<p class="%s" indent="h%si%s"> %s @@ -275,10 +278,11 @@ template SQLiteFormatAndLoadObject() { ); return o; } - auto html_quote(O)( + auto html_quote(M,O)( + M doc_matters, auto ref const O obj, ) { - string _txt = munge_html(obj); + string _txt = munge_html(doc_matters, obj); string o = format(q"¶<p class="%s"> %s </p>¶", @@ -287,10 +291,11 @@ template SQLiteFormatAndLoadObject() { ); return o; } - auto html_group(O)( + auto html_group(M,O)( + M doc_matters, auto ref const O obj, ) { - string _txt = munge_html(obj); + string _txt = munge_html(doc_matters, obj); string o = format(q"¶<p class="%s"> %s </p>¶", @@ -299,10 +304,11 @@ template SQLiteFormatAndLoadObject() { ); return o; } - auto html_block(O)( + auto html_block(M,O)( + M doc_matters, auto ref const O obj, ) { - string _txt = munge_html(obj); + string _txt = munge_html(doc_matters, obj); string o = format(q"¶ <p class="%s">%s</p>¶", obj.metainfo.is_a, @@ -310,10 +316,11 @@ template SQLiteFormatAndLoadObject() { ); return o; } - auto html_verse(O)( + auto html_verse(M,O)( + M doc_matters, auto ref const O obj, ) { - string _txt = munge_html(obj); + string _txt = munge_html(doc_matters, obj); string o = format(q"¶<p class="%s">%s</p>¶", obj.metainfo.is_a, _txt @@ -330,7 +337,8 @@ template SQLiteFormatAndLoadObject() { ); return o; } - auto html_table(O)( + auto html_table(M,O)( + M doc_matters, auto ref const O obj, ) { auto _tablarize(O)( @@ -374,7 +382,7 @@ template SQLiteFormatAndLoadObject() { ); return t; } - string _txt = munge_html(obj); + string _txt = munge_html(doc_matters, obj); auto t = _tablarize(obj, _txt); _txt = t[0]; string _note = t[1]; @@ -390,16 +398,16 @@ template SQLiteFormatAndLoadObject() { ); return o; } - auto sqlite_load_string(O,Dm)( + auto sqlite_load_string(M,O)( + auto ref M doc_matters, auto ref const O obj, - auto ref Dm doc_matters, ) { string o; return o; } - auto postgresql_load_string(O,Dm)( + auto postgresql_load_string(M,O)( + auto ref M doc_matters, auto ref const O obj, - auto ref Dm doc_matters, ) { string o; return o; @@ -418,12 +426,13 @@ template SQLiteFormatAndLoadObject() { string _sql; return _sql; } - auto heading(O)( + auto heading(M,O)( + M doc_matters, auto ref const O obj, ) { string[string] obj_txt = [ "text": generic_munge_sanitize_text_for_search(obj.text), - "html": html_heading(obj) + "html": html_heading(doc_matters, obj) ]; if (doc_matters.opt.action.debug_do) { debug(sql_txt) { @@ -437,12 +446,13 @@ template SQLiteFormatAndLoadObject() { } return obj_txt; } - auto para(O)( + auto para(M,O)( + M doc_matters, auto ref const O obj, ) { string[string] obj_txt = [ "text": generic_munge_sanitize_text_for_search(obj.text), - "html": html_para(obj) + "html": html_para(doc_matters, obj) ]; if (doc_matters.opt.action.debug_do) { debug(sql_txt) { @@ -456,12 +466,13 @@ template SQLiteFormatAndLoadObject() { } return obj_txt; } - auto quote(O)( + auto quote(M,O)( + M doc_matters, auto ref const O obj, ) { string[string] obj_txt = [ "text": generic_munge_sanitize_text_for_search(obj.text), - "html": html_quote(obj) + "html": html_quote(doc_matters, obj) ]; if (doc_matters.opt.action.debug_do) { debug(sql_txt) { @@ -475,12 +486,13 @@ template SQLiteFormatAndLoadObject() { } return obj_txt; } - auto group(O)( + auto group(M,O)( + M doc_matters, auto ref const O obj, ) { string[string] obj_txt = [ "text": generic_munge_sanitize_text_for_search(obj.text), - "html": html_group(obj) + "html": html_group(doc_matters, obj) ]; if (doc_matters.opt.action.debug_do) { debug(sql_txt) { @@ -494,12 +506,13 @@ template SQLiteFormatAndLoadObject() { } return obj_txt; } - auto block(O)( + auto block(M,O)( + M doc_matters, auto ref const O obj, ) { string[string] obj_txt = [ "text": generic_munge_sanitize_text_for_search(obj.text), - "html": html_block(obj) + "html": html_block(doc_matters, obj) ]; if (doc_matters.opt.action.debug_do) { debug(sql_txt) { @@ -513,12 +526,13 @@ template SQLiteFormatAndLoadObject() { } return obj_txt; } - auto verse(O)( + auto verse(M,O)( + M doc_matters, auto ref const O obj, ) { string[string] obj_txt = [ "text": generic_munge_sanitize_text_for_search(obj.text), - "html": html_verse(obj) + "html": html_verse(doc_matters, obj) ]; if (doc_matters.opt.action.debug_do) { debug(sql_txt) { @@ -532,7 +546,8 @@ template SQLiteFormatAndLoadObject() { } return obj_txt; } - auto code(O)( + auto code(M,O)( + M doc_matters, auto ref const O obj, ) { string[string] obj_txt = [ @@ -551,12 +566,13 @@ template SQLiteFormatAndLoadObject() { } return obj_txt; } - auto table(O)( + auto table(M,O)( + M doc_matters, auto ref const O obj, ) { string[string] obj_txt = [ "text": generic_munge_sanitize_text_for_search(obj.text), - "html": html_table(obj) + "html": html_table(doc_matters, obj) ]; if (doc_matters.opt.action.debug_do) { debug(sql_txt) { @@ -712,8 +728,8 @@ template SQLiteTablesReCreate() { } } template SQLiteDeleteDocument() { - string SQLiteDeleteDocument(I)( - I doc_matters, + string SQLiteDeleteDocument(M)( + M doc_matters, ) { string _uid = doc_matters.src.doc_uid; string _delete_uid = format(q"¶ @@ -729,8 +745,8 @@ template SQLiteDeleteDocument() { } } template SQLiteInsertMetadata() { - string SQLiteInsertMetadata(I)( - I doc_matters, + string SQLiteInsertMetadata(M)( + M doc_matters, ) { string _uid = SQLinsertDelimiter!()(doc_matters.src.doc_uid); string _insert_metadata = format(q"¶ @@ -885,9 +901,9 @@ template SQLiteInsertMetadata() { } } template SQLiteInsertDocObjectsLoop() { - string SQLiteInsertDocObjectsLoop(D,I)( + string SQLiteInsertDocObjectsLoop(M,D)( + M doc_matters, D doc_abstraction, - I doc_matters, ) { string _uid = SQLinsertDelimiter!()(doc_matters.src.doc_uid); string insertDocObjectsRow(O)(O obj) { @@ -933,7 +949,7 @@ template SQLiteInsertDocObjectsLoop() { case "para": switch (obj.metainfo.is_a) { case "heading": - obj_txt = format_and_sqlite_load.heading(obj); + obj_txt = format_and_sqlite_load.heading(doc_matters, obj); break; default: if ((doc_matters.opt.action.debug_do)) { @@ -959,10 +975,10 @@ template SQLiteInsertDocObjectsLoop() { writeln(__LINE__, ": ", obj.text); } } - obj_txt = format_and_sqlite_load.heading(obj); + obj_txt = format_and_sqlite_load.heading(doc_matters, obj); break; case "para": - obj_txt = format_and_sqlite_load.para(obj); + obj_txt = format_and_sqlite_load.para(doc_matters, obj); break; default: if ((doc_matters.opt.action.debug_do)) { @@ -974,24 +990,24 @@ template SQLiteInsertDocObjectsLoop() { case "block": switch (obj.metainfo.is_a) { case "quote": - obj_txt = format_and_sqlite_load.quote(obj); + obj_txt = format_and_sqlite_load.quote(doc_matters, obj); break; case "group": - obj_txt = format_and_sqlite_load.group(obj); + obj_txt = format_and_sqlite_load.group(doc_matters, obj); break; case "block": - obj_txt = format_and_sqlite_load.block(obj); + obj_txt = format_and_sqlite_load.block(doc_matters, obj); break; case "poem": // double check on keeping both poem & verse break; case "verse": - obj_txt = format_and_sqlite_load.verse(obj); + obj_txt = format_and_sqlite_load.verse(doc_matters, obj); break; case "code": - obj_txt = format_and_sqlite_load.code(obj); + obj_txt = format_and_sqlite_load.code(doc_matters, obj); break; case "table": - obj_txt = format_and_sqlite_load.table(obj); + obj_txt = format_and_sqlite_load.table(doc_matters, obj); break; default: if ((doc_matters.opt.action.debug_do)) { @@ -1013,19 +1029,19 @@ template SQLiteInsertDocObjectsLoop() { case "para": switch (obj.metainfo.is_a) { case "heading": - obj_txt = format_and_sqlite_load.heading(obj); + obj_txt = format_and_sqlite_load.heading(doc_matters, obj); break; case "glossary": assert(part == "glossary", part); - obj_txt = format_and_sqlite_load.para(obj); + obj_txt = format_and_sqlite_load.para(doc_matters, obj); break; case "bibliography": assert(part == "bibliography", part); - obj_txt = format_and_sqlite_load.para(obj); + obj_txt = format_and_sqlite_load.para(doc_matters, obj); break; case "bookindex": assert(part == "bookindex_seg", part); - obj_txt = format_and_sqlite_load.para(obj); + obj_txt = format_and_sqlite_load.para(doc_matters, obj); break; case "blurb": assert(part == "blurb", part); - obj_txt = format_and_sqlite_load.para(obj); + obj_txt = format_and_sqlite_load.para(doc_matters, obj); break; default: if ((doc_matters.opt.action.debug_do)) { diff --git a/src/doc_reform/output/xmls.d b/src/doc_reform/output/xmls.d index f2f09fa..e68a22d 100644 --- a/src/doc_reform/output/xmls.d +++ b/src/doc_reform/output/xmls.d @@ -311,11 +311,12 @@ template outputXHTMLs() { </html>¶"); return o; } - auto inline_images(O)( - const O obj, - string _txt, - string _suffix = ".html", - string _xml_type = "seg", + auto inline_images(M,O)( + M doc_matters, + const O obj, + string _txt, + string _suffix = ".html", + string _xml_type = "seg", ) { string _img_pth; if (_xml_type == "epub") { @@ -334,11 +335,12 @@ template outputXHTMLs() { } return _txt; } - auto inline_links(O)( - const O obj, - string _txt, - string _suffix = ".html", - string _xml_type = "seg", + auto inline_links(M,O)( + M doc_matters, + const O obj, + string _txt, + string _suffix = ".html", + string _xml_type = "seg", ) { if (obj.has.inline_links) { if ((_txt.match(rgx.mark_internal_site_lnk)) @@ -380,8 +382,9 @@ template outputXHTMLs() { } return _txt; } - auto inline_notes_scroll(O)( - const O obj, + auto inline_notes_scroll(M,O)( + M doc_matters, + const O obj, string _txt, ) { if (obj.has.inline_notes_reg) { @@ -403,9 +406,10 @@ template outputXHTMLs() { } return _txt; } - auto inline_notes_seg(O)( - const O obj, - string _txt, + auto inline_notes_seg(M,O)( + M doc_matters, + const O obj, + string _txt, ) { string[] _endnotes; if (obj.has.inline_notes_reg) { @@ -442,29 +446,32 @@ template outputXHTMLs() { ); return t; } - auto inline_markup_scroll(O)( - const O obj, - string _txt, - string _suffix = ".html", + auto inline_markup_scroll(M,O)( + M doc_matters, + const O obj, + string _txt, + string _suffix = ".html", ) { - _txt = inline_images(obj, _txt, _suffix, "scroll"); - _txt = inline_links(obj, _txt, _suffix, "scroll"); - _txt = inline_notes_scroll(obj, _txt); + _txt = inline_images(doc_matters, obj, _txt, _suffix, "scroll"); + _txt = inline_links(doc_matters, obj, _txt, _suffix, "scroll"); + _txt = inline_notes_scroll(doc_matters, obj, _txt); return _txt; } - auto inline_markup_seg(O)( - const O obj, - string _txt, - string _suffix = ".html", - string _xml_type = "seg", + auto inline_markup_seg(M,O)( + M doc_matters, + const O obj, + string _txt, + string _suffix = ".html", + string _xml_type = "seg", ) { - _txt = inline_images(obj, _txt, _suffix, _xml_type); - _txt = inline_links(obj, _txt, _suffix, _xml_type); - auto t = inline_notes_seg(obj, _txt); + _txt = inline_images(doc_matters, obj, _txt, _suffix, _xml_type); // TODO + _txt = inline_links(doc_matters, obj, _txt, _suffix, _xml_type); // TODO + auto t = inline_notes_seg(doc_matters, obj, _txt); return t; } - string lev4_heading_subtoc(O)( - const O obj, + string lev4_heading_subtoc(M,O)( + M doc_matters, + const O obj, ) { char[] lev4_subtoc; lev4_subtoc ~= " <div class=\"nav\">\n"; @@ -489,8 +496,9 @@ template outputXHTMLs() { lev4_subtoc ~= " </div>\n"; return lev4_subtoc.to!string; } - auto nav_pre_next_svg(O)( - const O obj, + auto nav_pre_next_svg(M,O)( + M doc_matters, + const O obj, ) { string prev, next, toc; if (obj.tags.segment_anchor_tag == "toc") { @@ -566,10 +574,11 @@ template outputXHTMLs() { } return bar(); } - auto heading(O)( - const O obj, - string _txt, - string _xml_type = "html", + auto heading(M,O)( + M doc_matters, + const O obj, + string _txt, + string _xml_type = "html", ) { auto tags = _xhtml_anchor_tags(obj.tags.anchor_tags); string _horizontal_rule = "<hr />"; @@ -615,35 +624,38 @@ template outputXHTMLs() { } return o; } - auto heading_scroll(O)( - const O obj, - string _txt, - string _suffix = ".html", + auto heading_scroll(M,O)( + M doc_matters, + const O obj, + string _txt, + string _suffix = ".html", ) { auto tags = _xhtml_anchor_tags(obj.tags.anchor_tags); - _txt = inline_markup_scroll(obj, _txt, _suffix); - string o = heading(obj, _txt); + _txt = inline_markup_scroll(doc_matters, obj, _txt, _suffix); + string o = heading(doc_matters, obj, _txt); return o; } - auto heading_seg(O)( - const O obj, - string _txt, - string _suffix = ".html", - string _xml_type = "html", + auto heading_seg(M,O)( + M doc_matters, + const O obj, + string _txt, + string _suffix = ".html", + string _xml_type = "html" ) { - auto t = inline_markup_seg(obj, _txt, _suffix, _xml_type); + auto t = inline_markup_seg(doc_matters, obj, _txt, _suffix, _xml_type); _txt = t[0]; string[] _endnotes = t[1]; - string o = heading(obj, _txt, _xml_type); + string o = heading(doc_matters, obj, _txt, _xml_type); auto u = tuple( o, _endnotes, ); return u; } - auto para(O)( - const O obj, - string _txt, + auto para(M,O)( + M doc_matters, + const O obj, + string _txt, ) { auto tags = _xhtml_anchor_tags(obj.tags.anchor_tags); _txt = font_face(_txt); @@ -680,35 +692,38 @@ template outputXHTMLs() { } return o; } - auto para_scroll(O)( - const O obj, - string _txt, - string _suffix = ".html", + auto para_scroll(M,O)( + M doc_matters, + const O obj, + string _txt, + string _suffix = ".html", ) { auto tags = _xhtml_anchor_tags(obj.tags.anchor_tags); - _txt = inline_markup_scroll(obj, _txt, _suffix); - string o = para(obj, _txt); + _txt = inline_markup_scroll(doc_matters, obj, _txt, _suffix); + string o = para(doc_matters, obj, _txt); return o; } - auto para_seg(O)( - const O obj, - string _txt, - string _suffix = ".html", - string _xml_type = "html", + auto para_seg(M,O)( + M doc_matters, + const O obj, + string _txt, + string _suffix = ".html", + string _xml_type = "html", ) { - auto t = inline_markup_seg(obj, _txt, _suffix, _xml_type); + auto t = inline_markup_seg(doc_matters, obj, _txt, _suffix, _xml_type); _txt = t[0].to!string; string[] _endnotes = t[1]; - string o = para(obj, _txt); + string o = para(doc_matters, obj, _txt); auto u = tuple( o, _endnotes, ); return u; } - auto quote(O)( - const O obj, - string _txt, + auto quote(M,O)( + M doc_matters, + const O obj, + string _txt, ) { _txt = font_face(_txt); string o; @@ -737,35 +752,38 @@ template outputXHTMLs() { } return o; } - auto quote_scroll(O)( - const O obj, - string _txt, - string _suffix = ".html", + auto quote_scroll(M,O)( + M doc_matters, + const O obj, + string _txt, + string _suffix = ".html", ) { auto tags = _xhtml_anchor_tags(obj.tags.anchor_tags); - _txt = inline_markup_scroll(obj, _txt, _suffix); - string o = quote(obj, _txt); + _txt = inline_markup_scroll(doc_matters, obj, _txt, _suffix); + string o = quote(doc_matters, obj, _txt); return o; } - auto quote_seg(O)( - const O obj, - string _txt, - string _suffix = ".html", - string _xml_type = "html", + auto quote_seg(M,O)( + M doc_matters, + const O obj, + string _txt, + string _suffix = ".html", + string _xml_type = "html", ) { - auto t = inline_markup_seg(obj, _txt, _suffix, _xml_type); + auto t = inline_markup_seg(doc_matters, obj, _txt, _suffix, _xml_type); _txt = t[0].to!string; string[] _endnotes = t[1]; - string o = quote(obj, _txt); + string o = quote(doc_matters, obj, _txt); auto u = tuple( o, _endnotes, ); return u; } - auto group(O)( - const O obj, - string _txt, + auto group(M,O)( + M doc_matters, + const O obj, + string _txt, ) { _txt = font_face(_txt); string o; @@ -794,36 +812,39 @@ template outputXHTMLs() { } return o; } - auto group_scroll(O)( - const O obj, - string _txt, - string _suffix = ".html", - string _xml_type = "html", + auto group_scroll(M,O)( + M doc_matters, + const O obj, + string _txt, + string _suffix = ".html", + string _xml_type = "html", ) { auto tags = _xhtml_anchor_tags(obj.tags.anchor_tags); - _txt = inline_markup_scroll(obj, _txt, _suffix); - string o = group(obj, _txt); + _txt = inline_markup_scroll(doc_matters, obj, _txt, _suffix); + string o = group(doc_matters, obj, _txt); return o; } - auto group_seg(O)( - const O obj, - string _txt, - string _suffix = ".html", - string _xml_type = "html", + auto group_seg(M,O)( + M doc_matters, + const O obj, + string _txt, + string _suffix = ".html", + string _xml_type = "html", ) { - auto t = inline_markup_seg(obj, _txt, _suffix, _xml_type); + auto t = inline_markup_seg(doc_matters, obj, _txt, _suffix, _xml_type); _txt = t[0].to!string; string[] _endnotes = t[1]; - string o = group(obj, _txt); + string o = group(doc_matters, obj, _txt); auto u = tuple( o, _endnotes, ); return u; } - auto block(O)( - const O obj, - string _txt, + auto block(M,O)( + M doc_matters, + const O obj, + string _txt, ) { _txt = font_face(_txt); string o; @@ -848,36 +869,39 @@ template outputXHTMLs() { } return o; } - auto block_scroll(O)( - const O obj, - string _txt, - string _suffix = ".html", - string _xml_type = "html", + auto block_scroll(M,O)( + M doc_matters, + const O obj, + string _txt, + string _suffix = ".html", + string _xml_type = "html", ) { auto tags = _xhtml_anchor_tags(obj.tags.anchor_tags); - _txt = inline_markup_scroll(obj, _txt, _suffix); - string o = block(obj, _txt); + _txt = inline_markup_scroll(doc_matters, obj, _txt, _suffix); + string o = block(doc_matters, obj, _txt); return o; } - auto block_seg(O)( - const O obj, - string _txt, - string _suffix = ".html", - string _xml_type = "html", + auto block_seg(M,O)( + M doc_matters, + const O obj, + string _txt, + string _suffix = ".html", + string _xml_type = "html", ) { - auto t = inline_markup_seg(obj, _txt, _suffix, _xml_type); + auto t = inline_markup_seg(doc_matters, obj, _txt, _suffix, _xml_type); _txt = t[0].to!string; string[] _endnotes = t[1]; - string o = block(obj, _txt); + string o = block(doc_matters, obj, _txt); auto u = tuple( o, _endnotes, ); return u; } - auto verse(O)( - const O obj, - string _txt, + auto verse(M,O)( + M doc_matters, + const O obj, + string _txt, ) { _txt = font_face(_txt); string o; @@ -902,36 +926,39 @@ template outputXHTMLs() { } return o; } - auto verse_scroll(O)( - const O obj, - string _txt, - string _suffix = ".html", - string _xml_type = "html", + auto verse_scroll(M,O)( + M doc_matters, + const O obj, + string _txt, + string _suffix = ".html", + string _xml_type = "html", ) { auto tags = _xhtml_anchor_tags(obj.tags.anchor_tags); - _txt = inline_markup_scroll(obj, _txt, _suffix); - string o = verse(obj, _txt); + _txt = inline_markup_scroll(doc_matters, obj, _txt, _suffix); + string o = verse(doc_matters, obj, _txt); return o; } - auto verse_seg(O)( - const O obj, - string _txt, - string _suffix = ".html", - string _xml_type = "html", + auto verse_seg(M,O)( + M doc_matters, + const O obj, + string _txt, + string _suffix = ".html", + string _xml_type = "html", ) { - auto t = inline_markup_seg(obj, _txt, _suffix, _xml_type); + auto t = inline_markup_seg(doc_matters, obj, _txt, _suffix, _xml_type); _txt = t[0].to!string; string[] _endnotes = t[1]; - string o = verse(obj, _txt); + string o = verse(doc_matters, obj, _txt); auto u = tuple( o, _endnotes, ); return u; } - auto tablarize(O)( - const O obj, - string _txt, + auto tablarize(M,O)( + M doc_matters, + const O obj, + string _txt, ) { string[] _table_rows = (_txt).split(rgx.table_delimiter_row); string[] _table_cols; @@ -962,13 +989,14 @@ template outputXHTMLs() { ); return t; } - auto table(O)( - const O obj, - string _txt, + auto table(M,O)( + M doc_matters, + const O obj, + string _txt, ) { auto tags = _xhtml_anchor_tags(obj.tags.anchor_tags); _txt = font_face(_txt); - auto t = tablarize(obj, _txt); + auto t = tablarize(doc_matters, obj, _txt); _txt = t[0]; string _note = t[1]; string o; @@ -991,9 +1019,10 @@ template outputXHTMLs() { ); return o; } - auto endnote(O)( - const O obj, - string _txt, + auto endnote(M,O)( + M doc_matters, + const O obj, + string _txt, ) { string o; o = format(q"¶ <p class="%s" indent="h%si%s"> @@ -1006,9 +1035,10 @@ template outputXHTMLs() { ); return o; } - auto code(O)( - const O obj, - string _txt, + auto code(M,O)( + M doc_matters, + const O obj, + string _txt, ) { string o; if (obj.metainfo.object_number.empty) { |