From 3f393a3c2955c5af64cab3f22b776b96aebebd66 Mon Sep 17 00:00:00 2001 From: Ralph Amissah Date: Fri, 25 Jan 2019 12:34:03 -0500 Subject: rearrange some code --- src/doc_reform/output/epub3.d | 38 +++--- src/doc_reform/output/html.d | 68 +++++----- src/doc_reform/output/hub.d | 8 +- src/doc_reform/output/sqlite.d | 32 ++--- src/doc_reform/output/xmls.d | 291 +++++++++++++++++++---------------------- 5 files changed, 211 insertions(+), 226 deletions(-) (limited to 'src/doc_reform/output') diff --git a/src/doc_reform/output/epub3.d b/src/doc_reform/output/epub3.d index c94c240..f57229b 100644 --- a/src/doc_reform/output/epub3.d +++ b/src/doc_reform/output/epub3.d @@ -349,7 +349,7 @@ template outputEPub3() { default: epubWrite.doc_parts ~= obj.tags.segment_anchor_tag_epub; epubWrite.doc_epub3[obj.tags.segment_anchor_tag_epub] ~= xhtml_format.epub3_seg_head(doc_matters); - auto t = xhtml_format.heading_seg(doc_matters, obj, _txt, suffix, "epub"); + auto t = xhtml_format.heading_seg(_txt, obj, doc_matters, suffix, "epub"); epubWrite.doc_epub3[obj.tags.segment_anchor_tag_epub] ~= t[0]; epubWrite.doc_epub3_endnotes[obj.tags.segment_anchor_tag_epub] ~= t[1]; break; @@ -358,12 +358,12 @@ template outputEPub3() { case 4: segment_filename = obj.tags.segment_anchor_tag_epub; epubWrite.doc_epub3[segment_filename] ~= xhtml_format.epub3_seg_head(doc_matters); - auto t = xhtml_format.heading_seg(doc_matters, obj, _txt, suffix, "epub"); + auto t = xhtml_format.heading_seg(_txt, obj, doc_matters, suffix, "epub"); epubWrite.doc_epub3[segment_filename] ~= t[0]; epubWrite.doc_epub3_endnotes[segment_filename] ~= t[1]; break; case 5: .. case 7: - auto t = xhtml_format.heading_seg(doc_matters, obj, _txt, suffix, "epub"); + auto t = xhtml_format.heading_seg(_txt, obj, doc_matters, suffix, "epub"); epubWrite.doc_epub3[segment_filename] ~= t[0]; epubWrite.doc_epub3_endnotes[segment_filename] ~= t[1]; break; @@ -393,7 +393,7 @@ template outputEPub3() { case "para": switch (obj.metainfo.is_a) { case "toc": - auto t = xhtml_format.para_seg(doc_matters, obj, _txt, suffix, "epub"); + auto t = xhtml_format.para_seg(_txt, obj, doc_matters, suffix, "epub"); epubWrite.doc_epub3[segment_filename] ~= t[0]; epubWrite.doc_epub3_endnotes[segment_filename] ~= t[1]; break; @@ -422,7 +422,7 @@ template outputEPub3() { case "para": switch (obj.metainfo.is_a) { case "para": - auto t = xhtml_format.para_seg(doc_matters, obj, _txt, suffix, "epub"); + auto t = xhtml_format.para_seg(_txt, obj, doc_matters, suffix, "epub"); epubWrite.doc_epub3[segment_filename] ~= t[0]; epubWrite.doc_epub3_endnotes[segment_filename] ~= t[1]; break; @@ -439,32 +439,32 @@ template outputEPub3() { case "block": switch (obj.metainfo.is_a) { case "quote": - auto t = xhtml_format.quote_seg(doc_matters, obj, _txt, suffix, "epub"); + auto t = xhtml_format.quote_seg(_txt, obj, doc_matters, suffix, "epub"); epubWrite.doc_epub3[segment_filename] ~= t[0].to!string; epubWrite.doc_epub3_endnotes[segment_filename] ~= t[1]; break; case "group": - auto t = xhtml_format.group_seg(doc_matters, obj, _txt, suffix, "epub"); + auto t = xhtml_format.group_seg(_txt, obj, doc_matters, suffix, "epub"); epubWrite.doc_epub3[segment_filename] ~= t[0].to!string; epubWrite.doc_epub3_endnotes[segment_filename] ~= t[1]; break; case "block": - auto t = xhtml_format.block_seg(doc_matters, obj, _txt, suffix, "epub"); + auto t = xhtml_format.block_seg(_txt, obj, doc_matters, suffix, "epub"); epubWrite.doc_epub3[segment_filename] ~= t[0].to!string; epubWrite.doc_epub3_endnotes[segment_filename] ~= t[1]; break; case "poem": break; case "verse": - auto t = xhtml_format.verse_seg(doc_matters, obj, _txt, suffix, "epub"); + auto t = xhtml_format.verse_seg(_txt, obj, doc_matters, suffix, "epub"); epubWrite.doc_epub3[segment_filename] ~= t[0].to!string; epubWrite.doc_epub3_endnotes[segment_filename] ~= t[1]; break; case "code": - epubWrite.doc_epub3[segment_filename] ~= xhtml_format.code(obj, _txt); + epubWrite.doc_epub3[segment_filename] ~= xhtml_format.code(_txt, obj); break; case "table": - epubWrite.doc_epub3[segment_filename] ~= xhtml_format.table(obj, _txt); + epubWrite.doc_epub3[segment_filename] ~= xhtml_format.table(_txt, obj); epubWrite.doc_epub3_endnotes[segment_filename] ~= ""; break; default: @@ -493,26 +493,26 @@ template outputEPub3() { case "para": switch (obj.metainfo.is_a) { case "endnote": assert(part == "endnotes"); - auto t = xhtml_format.para_seg(doc_matters, obj, _txt, suffix, "epub"); + auto t = xhtml_format.para_seg(_txt, obj, doc_matters, suffix, "epub"); epubWrite.doc_epub3[segment_filename] ~= t[0]; break; case "glossary": assert(part == "glossary"); - auto t = xhtml_format.para_seg(doc_matters, obj, _txt, suffix, "epub"); + auto t = xhtml_format.para_seg(_txt, obj, doc_matters, suffix, "epub"); epubWrite.doc_epub3[segment_filename] ~= t[0]; epubWrite.doc_epub3_endnotes[segment_filename] ~= t[1]; break; case "bibliography": assert(part == "bibliography"); - auto t = xhtml_format.para_seg(doc_matters, obj, _txt, suffix, "epub"); + auto t = xhtml_format.para_seg(_txt, obj, doc_matters, suffix, "epub"); epubWrite.doc_epub3[segment_filename] ~= t[0]; epubWrite.doc_epub3_endnotes[segment_filename] ~= t[1]; break; case "bookindex": assert(part == "bookindex"); - auto t = xhtml_format.para_seg(doc_matters, obj, _txt, suffix, "epub"); + auto t = xhtml_format.para_seg(_txt, obj, doc_matters, suffix, "epub"); epubWrite.doc_epub3[segment_filename] ~= t[0]; epubWrite.doc_epub3_endnotes[segment_filename] ~= t[1]; break; case "blurb": assert(part == "blurb"); - auto t = xhtml_format.para_seg(doc_matters, obj, _txt, suffix, "epub"); + auto t = xhtml_format.para_seg(_txt, obj, doc_matters, suffix, "epub"); epubWrite.doc_epub3[segment_filename] ~= t[0]; epubWrite.doc_epub3_endnotes[segment_filename] ~= t[1]; break; @@ -598,9 +598,9 @@ template outputEPub3() { /+ epub specific documents +/ epubWrite.mimetypes = epub3_mimetypes; epubWrite.meta_inf_container_xml = epub3_container_xml; - epubWrite.oebps_toc_ncx = epub2_oebps_toc_ncx(doc_abstraction, doc_matters); - epubWrite.oebps_toc_nav_xhtml = epub3_oebps_toc_nav_xhtml(doc_abstraction, doc_matters); - epubWrite.oebps_content_opf = epub3_oebps_content(doc_abstraction, doc_matters, oepbs_content_parts); + epubWrite.oebps_toc_ncx = doc_abstraction.epub2_oebps_toc_ncx(doc_matters); + epubWrite.oebps_toc_nav_xhtml = doc_abstraction.epub3_oebps_toc_nav_xhtml(doc_matters); + epubWrite.oebps_content_opf = doc_abstraction.epub3_oebps_content(doc_matters, oepbs_content_parts); epubWrite.epub3_write_output_files(doc_matters); } void epub3_write_output_files(W,I)( diff --git a/src/doc_reform/output/html.d b/src/doc_reform/output/html.d index dee5d53..45b95ce 100644 --- a/src/doc_reform/output/html.d +++ b/src/doc_reform/output/html.d @@ -35,10 +35,10 @@ template outputHTML() { case "para": switch (obj.metainfo.is_a) { case "heading": - doc_html ~= delimit ~ xhtml_format.heading_scroll(doc_matters, obj, _txt, suffix); + doc_html ~= delimit ~ xhtml_format.heading_scroll(_txt, obj, doc_matters, suffix); break; case "toc": - doc_html ~= xhtml_format.para_scroll(doc_matters, obj, _txt, suffix); + doc_html ~= xhtml_format.para_scroll(_txt, obj, doc_matters, suffix); break; default: { /+ debug +/ @@ -65,10 +65,10 @@ template outputHTML() { case "para": switch (obj.metainfo.is_a) { case "heading": - doc_html ~= delimit ~ xhtml_format.heading_scroll(doc_matters, obj, _txt, suffix); + doc_html ~= delimit ~ xhtml_format.heading_scroll(_txt, obj, doc_matters, suffix); break; case "para": - doc_html ~= xhtml_format.para_scroll(doc_matters, obj, _txt, suffix); + doc_html ~= xhtml_format.para_scroll(_txt, obj, doc_matters, suffix); break; default: { /+ debug +/ @@ -83,24 +83,24 @@ template outputHTML() { case "block": switch (obj.metainfo.is_a) { case "quote": - doc_html ~= xhtml_format.quote_scroll(doc_matters, obj, _txt); + doc_html ~= xhtml_format.quote_scroll(_txt, obj, doc_matters); break; case "group": - doc_html ~= xhtml_format.group_scroll(doc_matters, obj, _txt); + doc_html ~= xhtml_format.group_scroll(_txt, obj, doc_matters); break; case "block": - doc_html ~= xhtml_format.block_scroll(doc_matters, obj, _txt); + doc_html ~= xhtml_format.block_scroll(_txt, obj, doc_matters); break; case "poem": break; case "verse": - doc_html ~= xhtml_format.verse_scroll(doc_matters, obj, _txt, suffix); + doc_html ~= xhtml_format.verse_scroll(_txt, obj, doc_matters, suffix); break; case "code": - doc_html ~= xhtml_format.code(obj, _txt); + doc_html ~= xhtml_format.code(_txt, obj); break; case "table": - doc_html ~= xhtml_format.table(obj, _txt); + doc_html ~= xhtml_format.table(_txt, obj); break; default: { /+ debug +/ @@ -128,22 +128,22 @@ template outputHTML() { case "para": switch (obj.metainfo.is_a) { case "heading": - doc_html ~= delimit ~ xhtml_format.heading_scroll(doc_matters, obj, _txt, suffix); + doc_html ~= delimit ~ xhtml_format.heading_scroll(_txt, obj, doc_matters, suffix); break; case "endnote": assert(part == "endnotes"); - doc_html ~= xhtml_format.para_scroll(doc_matters, obj, _txt, suffix); + doc_html ~= xhtml_format.para_scroll(_txt, obj, doc_matters, suffix); break; case "glossary": assert(part == "glossary"); - doc_html ~= xhtml_format.para_scroll(doc_matters, obj, _txt, suffix); + doc_html ~= xhtml_format.para_scroll(_txt, obj, doc_matters, suffix); break; case "bibliography": assert(part == "bibliography"); - doc_html ~= xhtml_format.para_scroll(doc_matters, obj, _txt, suffix); + doc_html ~= xhtml_format.para_scroll(_txt, obj, doc_matters, suffix); break; case "bookindex": assert(part == "bookindex"); - doc_html ~= xhtml_format.para_scroll(doc_matters, obj, _txt, suffix); + doc_html ~= xhtml_format.para_scroll(_txt, obj, doc_matters, suffix); break; case "blurb": assert(part == "blurb"); - doc_html ~= xhtml_format.para_scroll(doc_matters, obj, _txt, suffix); + doc_html ~= xhtml_format.para_scroll(_txt, obj, doc_matters, suffix); break; default: { /+ debug +/ @@ -251,7 +251,7 @@ template outputHTML() { top_level_headings[3] = ""; goto default; default: - auto t = xhtml_format.heading_seg(doc_matters, obj, _txt, suffix, "seg"); + auto t = xhtml_format.heading_seg(_txt, obj, doc_matters, suffix, "seg"); top_level_headings[obj.metainfo.heading_lev_markup] = t[0]; break; } @@ -259,19 +259,19 @@ template outputHTML() { case 4: segment_filename = obj.tags.segment_anchor_tag_epub; doc_html[segment_filename] ~= xhtml_format.html_head(doc_matters, "seg"); - auto navigation_bar = xhtml_format.nav_pre_next_svg(doc_matters, obj); + auto navigation_bar = xhtml_format.nav_pre_next_svg(obj, doc_matters); doc_html[segment_filename] ~= navigation_bar.toc_pre_next; previous_seg_filename = segment_filename; foreach (top_level_heading; top_level_headings) { doc_html[segment_filename] ~= top_level_heading; } - auto t = xhtml_format.heading_seg(doc_matters, obj, _txt, suffix, "seg"); + auto t = xhtml_format.heading_seg(_txt, obj, doc_matters, suffix, "seg"); doc_html[segment_filename] ~= t[0].to!string; - doc_html[segment_filename] ~= xhtml_format.lev4_heading_subtoc(doc_matters, obj); + doc_html[segment_filename] ~= xhtml_format.lev4_heading_subtoc(obj, doc_matters); doc_html_endnotes[segment_filename] ~= t[1]; break; case 5: .. case 7: - auto t = xhtml_format.heading_seg(doc_matters, obj, _txt, suffix, "seg"); + auto t = xhtml_format.heading_seg(_txt, obj, doc_matters, suffix, "seg"); doc_html[segment_filename] ~= t[0].to!string; doc_html_endnotes[segment_filename] ~= t[1]; break; @@ -301,7 +301,7 @@ template outputHTML() { case "para": switch (obj.metainfo.is_a) { case "toc": - auto t = xhtml_format.para_seg(doc_matters, obj, _txt, suffix, "seg"); + auto t = xhtml_format.para_seg(_txt, obj, doc_matters, suffix, "seg"); doc_html[segment_filename] ~= t[0].to!string; break; default: @@ -329,7 +329,7 @@ template outputHTML() { case "para": switch (obj.metainfo.is_a) { case "para": - auto t = xhtml_format.para_seg(doc_matters, obj, _txt, suffix, "seg"); + auto t = xhtml_format.para_seg(_txt, obj, doc_matters, suffix, "seg"); doc_html[segment_filename] ~= t[0].to!string; doc_html_endnotes[segment_filename] ~= t[1]; break; @@ -346,32 +346,32 @@ template outputHTML() { case "block": switch (obj.metainfo.is_a) { case "quote": - auto t = xhtml_format.quote_seg(doc_matters, obj, _txt, suffix, "seg"); + auto t = xhtml_format.quote_seg(_txt, obj, doc_matters, 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(doc_matters, obj, _txt, suffix, "seg"); + auto t = xhtml_format.group_seg(_txt, obj, doc_matters, 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(doc_matters, obj, _txt, suffix, "seg"); + auto t = xhtml_format.block_seg(_txt, obj, doc_matters, 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(doc_matters, obj, _txt, suffix, "seg"); + auto t = xhtml_format.verse_seg(_txt, obj, doc_matters, 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(_txt, obj); break; case "table": - doc_html[segment_filename] ~= xhtml_format.table(obj, _txt); + doc_html[segment_filename] ~= xhtml_format.table(_txt, obj); doc_html_endnotes[segment_filename] ~= ""; break; default: @@ -400,26 +400,26 @@ template outputHTML() { case "para": switch (obj.metainfo.is_a) { case "endnote": assert(part == "endnotes"); - auto t = xhtml_format.para_seg(doc_matters, obj, _txt, suffix, "seg"); + auto t = xhtml_format.para_seg(_txt, obj, doc_matters, suffix, "seg"); doc_html[segment_filename] ~= t[0]; break; case "glossary": assert(part == "glossary"); - auto t = xhtml_format.para_seg(doc_matters, obj, _txt, suffix, "seg"); + auto t = xhtml_format.para_seg(_txt, obj, doc_matters, suffix, "seg"); doc_html[segment_filename] ~= t[0]; doc_html_endnotes[segment_filename] ~= t[1]; break; case "bibliography": assert(part == "bibliography"); - auto t = xhtml_format.para_seg(doc_matters, obj, _txt, suffix, "seg"); + auto t = xhtml_format.para_seg(_txt, obj, doc_matters, suffix, "seg"); doc_html[segment_filename] ~= t[0]; doc_html_endnotes[segment_filename] ~= t[1]; break; case "bookindex": assert(part == "bookindex"); - auto t = xhtml_format.para_seg(doc_matters, obj, _txt, suffix, "seg"); + auto t = xhtml_format.para_seg(_txt, obj, doc_matters, suffix, "seg"); doc_html[segment_filename] ~= t[0]; doc_html_endnotes[segment_filename] ~= t[1]; break; case "blurb": assert(part == "blurb"); - auto t = xhtml_format.para_seg(doc_matters, obj, _txt, suffix, "seg"); + auto t = xhtml_format.para_seg(_txt, obj, doc_matters, suffix, "seg"); doc_html[segment_filename] ~= t[0]; doc_html_endnotes[segment_filename] ~= t[1]; break; diff --git a/src/doc_reform/output/hub.d b/src/doc_reform/output/hub.d index 1534bc0..a32bd9e 100644 --- a/src/doc_reform/output/hub.d +++ b/src/doc_reform/output/hub.d @@ -26,7 +26,7 @@ template outputHub() { if (sched == outTask.epub) { msg.v("epub3 processing... "); import doc_reform.output.epub3; - outputEPub3!()(doc_abstraction, doc_matters); + doc_abstraction.outputEPub3!()(doc_matters); msg.vv("epub3 done"); } if (sched == outTask.html_scroll) { @@ -50,7 +50,7 @@ template outputHub() { if (sched == outTask.sqlite) { msg.v("sqlite processing... "); import doc_reform.output.sqlite; - SQLiteHubDiscreteBuildTablesAndPopulate!()(doc_matters, doc_abstraction); + doc_abstraction.SQLiteHubDiscreteBuildTablesAndPopulate!()(doc_matters); msg.vv("sqlite done"); } } @@ -69,12 +69,12 @@ template outputHub() { if (doc_matters.opt.action.sqlite_update) { msg.v("sqlite update processing..."); import doc_reform.output.sqlite; - SQLiteHubBuildTablesAndPopulate!()(doc_matters, doc_abstraction); + doc_abstraction.SQLiteHubBuildTablesAndPopulate!()(doc_matters); msg.vv("sqlite update done"); } else if (doc_matters.opt.action.sqlite_delete) { msg.v("sqlite delete processing..."); import doc_reform.output.sqlite; - SQLiteHubBuildTablesAndPopulate!()(doc_matters, doc_abstraction); + doc_abstraction.SQLiteHubBuildTablesAndPopulate!()(doc_matters); msg.vv("sqlite delete done"); } } diff --git a/src/doc_reform/output/sqlite.d b/src/doc_reform/output/sqlite.d index e0c9390..acfbff3 100644 --- a/src/doc_reform/output/sqlite.d +++ b/src/doc_reform/output/sqlite.d @@ -10,18 +10,18 @@ mixin DocReformOutputRgxInit; static auto rgx = Rgx(); long _metadata_tid_lastrowid; template SQLiteHubBuildTablesAndPopulate() { - void SQLiteHubBuildTablesAndPopulate(M,D)( - M doc_matters, + void SQLiteHubBuildTablesAndPopulate(D,M)( D doc_abstraction, + M 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,M,D)( + void SQLiteDbStatementComposite(Db,D,M)( Db db, - M doc_matters, D doc_abstraction, + M doc_matters, ) { { string _db_statement; @@ -42,7 +42,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_matters, doc_abstraction); + _db_statement ~= doc_abstraction.SQLiteInsertDocObjectsLoop!()(doc_matters); SQLiteDbRun!()(db, _db_statement, doc_matters.opt.action, "INSERT DocObjects"); } } @@ -53,29 +53,29 @@ template SQLiteHubBuildTablesAndPopulate() { } } } - SQLiteDbStatementComposite!()(db, doc_matters, doc_abstraction); + SQLiteDbStatementComposite!()(db, doc_abstraction, doc_matters); } } template SQLiteHubDiscreteBuildTablesAndPopulate() { - void SQLiteHubDiscreteBuildTablesAndPopulate(M,D)( - M doc_matters, + void SQLiteHubDiscreteBuildTablesAndPopulate(D,M)( D doc_abstraction, + M 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,M,D)( + void SQLiteDiscreteDbStatementComposite(Db,D,M)( Db db, - M doc_matters, D doc_abstraction, + M doc_matters, ) { { string _db_statement; { _db_statement ~= SQLiteTablesReCreate!()(); _db_statement ~= SQLiteInsertMetadata!()(doc_matters); - _db_statement ~= SQLiteInsertDocObjectsLoop!()(doc_matters, doc_abstraction); + _db_statement ~= doc_abstraction.SQLiteInsertDocObjectsLoop!()(doc_matters); SQLiteDbRun!()(db, _db_statement, doc_matters.opt.action, "table CREATE Tables, INSERT DocObjects"); } db.close; @@ -85,7 +85,7 @@ template SQLiteHubDiscreteBuildTablesAndPopulate() { } } } - SQLiteDiscreteDbStatementComposite!()(db, doc_matters, doc_abstraction); + SQLiteDiscreteDbStatementComposite!()(db, doc_abstraction, doc_matters); } } template SQLiteDbRun() { @@ -286,8 +286,8 @@ template SQLiteFormatAndLoadObject() { ) { if (obj.has.inline_links) { if (obj.metainfo.is_a != "code") { - _txt = replaceAll!(hit => - hit[1] ~ "┤" ~ to!string((obj.stow.link[hit[2].to!ulong])).encode ~ "├" + _txt = replaceAll!(m => + m[1] ~ "┤" ~ to!string((obj.stow.link[m[2].to!ulong])).encode ~ "├" )(_txt, rgx.inline_link_number_only); } if ((_txt.match(rgx.mark_internal_site_lnk)) @@ -1133,9 +1133,9 @@ template SQLiteInsertMetadata() { } } template SQLiteInsertDocObjectsLoop() { - string SQLiteInsertDocObjectsLoop(M,D)( - M doc_matters, + string SQLiteInsertDocObjectsLoop(D,M)( D doc_abstraction, + M doc_matters, ) { string _uid = SQLinsertDelimiter!()(doc_matters.src.doc_uid); auto site_url = DocReformPathsUrl!()(doc_matters); diff --git a/src/doc_reform/output/xmls.d b/src/doc_reform/output/xmls.d index fe02338..97262a1 100644 --- a/src/doc_reform/output/xmls.d +++ b/src/doc_reform/output/xmls.d @@ -318,10 +318,10 @@ template outputXHTMLs() { ¶"); return o; } - auto inline_images(M,O)( - M doc_matters, - const O obj, + auto inline_images(O,M)( string _txt, + const O obj, + M doc_matters, string _suffix = ".html", string _xml_type = "seg", ) { @@ -342,18 +342,18 @@ template outputXHTMLs() { } return _txt; } - auto inline_links(M,O)( - M doc_matters, - const O obj, - string _txt, + auto inline_links(O,M)( + string _txt, + const O obj, + M doc_matters, string _suffix = ".html", string _xml_type = "seg", ) { string seg_lvs; if (obj.has.inline_links) { if (obj.metainfo.is_a != "code") { - _txt = replaceAll!(hit => - hit[1] ~ "┤" ~ to!string((obj.stow.link[hit[2].to!ulong])).encode ~ "├" + _txt = replaceAll!(m => + m[1] ~ "┤" ~ to!string((obj.stow.link[m[2].to!ulong])).encode ~ "├" )(_txt, rgx.inline_link_number_only); } if ((_txt.match(rgx.mark_internal_site_lnk)) @@ -429,10 +429,10 @@ template outputXHTMLs() { } return _txt; } - auto inline_notes_scroll(M,O)( - M doc_matters, - const O obj, - string _txt, + auto inline_notes_scroll(O,M)( + string _txt, + const O obj, + M doc_matters, ) { if (obj.has.inline_notes_reg) { _txt = font_face(_txt); @@ -453,10 +453,10 @@ template outputXHTMLs() { } return _txt; } - auto inline_notes_seg(M,O)( - M doc_matters, - const O obj, - string _txt, + auto inline_notes_seg(O,M)( + string _txt, + const O obj, + M doc_matters, ) { string[] _endnotes; if (obj.has.inline_notes_reg) { @@ -493,32 +493,32 @@ template outputXHTMLs() { ); return t; } - auto inline_markup_scroll(M,O)( - M doc_matters, - const O obj, + auto inline_markup_scroll(O,M)( string _txt, + const O obj, + M doc_matters, string _suffix = ".html", ) { - _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); + _txt = inline_images(_txt, obj, doc_matters, _suffix, "scroll"); + _txt = inline_links(_txt, obj, doc_matters, _suffix, "scroll"); + _txt = inline_notes_scroll(_txt, obj, doc_matters); return _txt; } - auto inline_markup_seg(M,O)( - M doc_matters, - const O obj, + auto inline_markup_seg(O,M)( string _txt, + const O obj, + M doc_matters, string _suffix = ".html", string _xml_type = "seg", ) { - _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); + _txt = inline_images(_txt, obj, doc_matters, _suffix, _xml_type); // TODO + _txt = inline_links(_txt, obj, doc_matters, _suffix, _xml_type); // TODO + auto t = inline_notes_seg(_txt, obj, doc_matters); return t; } - string lev4_heading_subtoc(M,O)( - M doc_matters, - const O obj, + string lev4_heading_subtoc(O,M)( + const O obj, + M doc_matters, ) { char[] lev4_subtoc; lev4_subtoc ~= "
\n"; @@ -543,9 +543,9 @@ template outputXHTMLs() { lev4_subtoc ~= "
\n"; return lev4_subtoc.to!string; } - auto nav_pre_next_svg(M,O)( - M doc_matters, - const O obj, + auto nav_pre_next_svg(O,M)( + const O obj, + M doc_matters, ) { string prev, next, toc; if (obj.tags.segment_anchor_tag_epub == "toc") { @@ -622,8 +622,8 @@ template outputXHTMLs() { return bar(); } auto heading(O)( - const O obj, string _txt, + const O obj, string _xml_type = "html", ) { assert(obj.metainfo.is_of_part == "body" || "frontmatter" || "backmatter"); @@ -680,28 +680,28 @@ template outputXHTMLs() { } return o; } - auto heading_scroll(M,O)( - M doc_matters, - const O obj, - string _txt, - string _suffix = ".html", + auto heading_scroll(O,M)( + string _txt, + const O obj, + M doc_matters, + string _suffix = ".html", ) { auto tags = _xhtml_anchor_tags(obj); - _txt = inline_markup_scroll(doc_matters, obj, _txt, _suffix); - string o = heading(obj, _txt); + _txt = inline_markup_scroll(_txt, obj, doc_matters, _suffix); + string o = heading(_txt, obj); return o; } - auto heading_seg(M,O)( - M doc_matters, - const O obj, - string _txt, - string _suffix = ".html", - string _xml_type = "html" + auto heading_seg(O,M)( + string _txt, + const O obj, + M doc_matters, + string _suffix = ".html", + string _xml_type = "html", ) { - auto t = inline_markup_seg(doc_matters, obj, _txt, _suffix, _xml_type); + auto t = inline_markup_seg(_txt, obj, doc_matters, _suffix, _xml_type); _txt = t[0]; string[] _endnotes = t[1]; - string o = heading(obj, _txt, _xml_type); + string o = heading(_txt, obj, _xml_type); auto u = tuple( o, _endnotes, @@ -709,8 +709,8 @@ template outputXHTMLs() { return u; } auto para(O)( - const O obj, string _txt, + const O obj, ) { assert(obj.metainfo.is_of_part == "body" || "frontmatter" || "backmatter"); assert(obj.metainfo.is_of_section == "body" || "toc" || "endnotes" || "glossary" || "bibliography" || "bookindex" || "blurb"); @@ -753,28 +753,28 @@ template outputXHTMLs() { } return o; } - auto para_scroll(M,O)( - M doc_matters, - const O obj, - string _txt, - string _suffix = ".html", + auto para_scroll(O,M)( + string _txt, + const O obj, + M doc_matters, + string _suffix = ".html", ) { auto tags = _xhtml_anchor_tags(obj); - _txt = inline_markup_scroll(doc_matters, obj, _txt, _suffix); - string o = para(obj, _txt); + _txt = inline_markup_scroll(_txt, obj, doc_matters, _suffix); + string o = para(_txt, obj); return o; } - auto para_seg(M,O)( - M doc_matters, - const O obj, - string _txt, - string _suffix = ".html", - string _xml_type = "html", + auto para_seg(O,M)( + string _txt, + const O obj, + M doc_matters, + string _suffix = ".html", + string _xml_type = "html", ) { - auto t = inline_markup_seg(doc_matters, obj, _txt, _suffix, _xml_type); + auto t = inline_markup_seg(_txt, obj, doc_matters, _suffix, _xml_type); _txt = t[0].to!string; string[] _endnotes = t[1]; - string o = para(obj, _txt); + string o = para(_txt, obj); auto u = tuple( o, _endnotes, @@ -782,8 +782,8 @@ template outputXHTMLs() { return u; } auto quote(O)( - const O obj, string _txt, + const O obj, ) { assert(obj.metainfo.is_of_part == "body"); assert(obj.metainfo.is_of_section == "body" || "glossary" || "bibliography" || "bookindex" || "blurb"); @@ -816,28 +816,28 @@ template outputXHTMLs() { } return o; } - auto quote_scroll(M,O)( - M doc_matters, - const O obj, - string _txt, - string _suffix = ".html", + auto quote_scroll(O,M)( + string _txt, + const O obj, + M doc_matters, + string _suffix = ".html", ) { auto tags = _xhtml_anchor_tags(obj); - _txt = inline_markup_scroll(doc_matters, obj, _txt, _suffix); - string o = quote(obj, _txt); + _txt = inline_markup_scroll(_txt, obj, doc_matters, _suffix); + string o = quote(_txt, obj); return o; } - auto quote_seg(M,O)( - M doc_matters, - const O obj, - string _txt, - string _suffix = ".html", - string _xml_type = "html", + auto quote_seg(O,M)( + string _txt, + const O obj, + M doc_matters, + string _suffix = ".html", + string _xml_type = "html", ) { - auto t = inline_markup_seg(doc_matters, obj, _txt, _suffix, _xml_type); + auto t = inline_markup_seg(_txt, obj, doc_matters, _suffix, _xml_type); _txt = t[0].to!string; string[] _endnotes = t[1]; - string o = quote(obj, _txt); + string o = quote(_txt, obj); auto u = tuple( o, _endnotes, @@ -845,8 +845,8 @@ template outputXHTMLs() { return u; } auto group(O)( - const O obj, string _txt, + const O obj, ) { assert(obj.metainfo.is_of_part == "body"); assert(obj.metainfo.is_of_section == "body" || "glossary" || "bibliography" || "bookindex" || "blurb"); @@ -879,29 +879,29 @@ template outputXHTMLs() { } return o; } - auto group_scroll(M,O)( - M doc_matters, - const O obj, - string _txt, - string _suffix = ".html", - string _xml_type = "html", + auto group_scroll(O,M)( + string _txt, + const O obj, + M doc_matters, + string _suffix = ".html", + string _xml_type = "html", ) { auto tags = _xhtml_anchor_tags(obj); - _txt = inline_markup_scroll(doc_matters, obj, _txt, _suffix); - string o = group(obj, _txt); + _txt = inline_markup_scroll(_txt, obj, doc_matters, _suffix); + string o = group(_txt, obj); return o; } - auto group_seg(M,O)( - M doc_matters, - const O obj, - string _txt, - string _suffix = ".html", - string _xml_type = "html", + auto group_seg(O,M)( + string _txt, + const O obj, + M doc_matters, + string _suffix = ".html", + string _xml_type = "html", ) { - auto t = inline_markup_seg(doc_matters, obj, _txt, _suffix, _xml_type); + auto t = inline_markup_seg(_txt, obj, doc_matters, _suffix, _xml_type); _txt = t[0].to!string; string[] _endnotes = t[1]; - string o = group(obj, _txt); + string o = group(_txt, obj); auto u = tuple( o, _endnotes, @@ -909,8 +909,8 @@ template outputXHTMLs() { return u; } auto block(O)( - const O obj, string _txt, + const O obj, ) { assert(obj.metainfo.is_of_part == "body"); assert(obj.metainfo.is_of_section == "body" || "glossary" || "bibliography" || "bookindex" || "blurb"); @@ -939,29 +939,29 @@ template outputXHTMLs() { } return o; } - auto block_scroll(M,O)( - M doc_matters, - const O obj, - string _txt, - string _suffix = ".html", - string _xml_type = "html", + auto block_scroll(O,M)( + string _txt, + const O obj, + M doc_matters, + string _suffix = ".html", + string _xml_type = "html", ) { auto tags = _xhtml_anchor_tags(obj); - _txt = inline_markup_scroll(doc_matters, obj, _txt, _suffix); - string o = block(obj, _txt); + _txt = inline_markup_scroll(_txt, obj, doc_matters, _suffix); + string o = block(_txt, obj); return o; } - auto block_seg(M,O)( - M doc_matters, - const O obj, - string _txt, - string _suffix = ".html", - string _xml_type = "html", + auto block_seg(O,M)( + string _txt, + const O obj, + M doc_matters, + string _suffix = ".html", + string _xml_type = "html", ) { - auto t = inline_markup_seg(doc_matters, obj, _txt, _suffix, _xml_type); + auto t = inline_markup_seg(_txt, obj, doc_matters, _suffix, _xml_type); _txt = t[0].to!string; string[] _endnotes = t[1]; - string o = block(obj, _txt); + string o = block(_txt, obj); auto u = tuple( o, _endnotes, @@ -969,8 +969,8 @@ template outputXHTMLs() { return u; } auto verse(O)( - const O obj, string _txt, + const O obj, ) { assert(obj.metainfo.is_of_part == "body"); assert(obj.metainfo.is_of_section == "body" || "glossary" || "bibliography" || "bookindex" || "blurb"); @@ -999,29 +999,29 @@ template outputXHTMLs() { } return o; } - auto verse_scroll(M,O)( - M doc_matters, - const O obj, - string _txt, - string _suffix = ".html", - string _xml_type = "html", + auto verse_scroll(O,M)( + string _txt, + const O obj, + M doc_matters, + string _suffix = ".html", + string _xml_type = "html", ) { auto tags = _xhtml_anchor_tags(obj); - _txt = inline_markup_scroll(doc_matters, obj, _txt, _suffix); - string o = verse(obj, _txt); + _txt = inline_markup_scroll(_txt, obj, doc_matters, _suffix); + string o = verse(_txt, obj); return o; } - auto verse_seg(M,O)( - M doc_matters, - const O obj, - string _txt, - string _suffix = ".html", - string _xml_type = "html", + auto verse_seg(O,M)( + string _txt, + const O obj, + M doc_matters, + string _suffix = ".html", + string _xml_type = "html", ) { - auto t = inline_markup_seg(doc_matters, obj, _txt, _suffix, _xml_type); + auto t = inline_markup_seg(_txt, obj, doc_matters, _suffix, _xml_type); _txt = t[0].to!string; string[] _endnotes = t[1]; - string o = verse(obj, _txt); + string o = verse(_txt, obj); auto u = tuple( o, _endnotes, @@ -1029,8 +1029,8 @@ template outputXHTMLs() { return u; } auto tablarize(O)( - const O obj, string _txt, + const O obj, ) { string[] _table_rows = (_txt).split(rgx.table_delimiter_row); string[] _table_cols; @@ -1062,8 +1062,8 @@ template outputXHTMLs() { return t; } auto table(O)( - const O obj, string _txt, + const O obj, ) { assert(obj.metainfo.is_of_part == "body"); assert(obj.metainfo.is_of_section == "body"); @@ -1071,7 +1071,7 @@ template outputXHTMLs() { assert(obj.metainfo.is_a == "table"); auto tags = _xhtml_anchor_tags(obj); _txt = font_face(_txt); - auto t = tablarize(obj, _txt); + auto t = tablarize(_txt, obj); _txt = t[0]; string _note = t[1]; string o; @@ -1094,24 +1094,9 @@ template outputXHTMLs() { ); return o; } - auto endnote(O)( - const O obj, - string _txt, - ) { - string o; - o = format(q"¶

- %s -

¶", - obj.metainfo.is_a, - obj.attrib.indent_hang, - obj.attrib.indent_base, - _txt - ); - return o; - } auto code(O)( - const O obj, string _txt, + const O obj, ) { assert(obj.metainfo.is_of_part == "body"); assert(obj.metainfo.is_of_section == "body"); -- cgit v1.2.3