From 08a374929fdfd11b2546636a9151518491457f18 Mon Sep 17 00:00:00 2001 From: Ralph Amissah Date: Fri, 28 Sep 2018 17:05:34 -0400 Subject: output xmls & sqlite, make doc_matter available --- org/output_hub.org | 6 +- org/output_sqlite.org | 157 ++++++++------- org/output_xmls.org | 441 ++++++++++++++++++++++------------------- src/doc_reform/output/epub3.d | 32 +-- src/doc_reform/output/html.d | 74 +++---- src/doc_reform/output/hub.d | 6 +- src/doc_reform/output/sqlite.d | 152 +++++++------- src/doc_reform/output/xmls.d | 324 ++++++++++++++++-------------- 8 files changed, 644 insertions(+), 548 deletions(-) diff --git a/org/output_hub.org b/org/output_hub.org index 6cb7f9b..24095b3 100644 --- a/org/output_hub.org +++ b/org/output_hub.org @@ -82,7 +82,7 @@ if (sched == outTask.sisupod) { } 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) { @@ -120,11 +120,11 @@ if (sched == outTask.html_stuff) { #+BEGIN_SRC d 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"); } #+END_SRC diff --git a/org/output_sqlite.org b/org/output_sqlite.org index 8d792c6..566b960 100644 --- a/org/output_sqlite.org +++ b/org/output_sqlite.org @@ -31,18 +31,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, ) { <> if (!(doc_matters.opt.action.quiet)) { @@ -50,7 +50,7 @@ template SQLiteHubBuildTablesAndPopulate() { } } } - SQLiteDbStatementComposite!()(db, doc_abstraction, doc_matters); + SQLiteDbStatementComposite!()(db, doc_matters, doc_abstraction); } } #+END_SRC @@ -59,18 +59,18 @@ template SQLiteHubBuildTablesAndPopulate() { #+BEGIN_SRC d :tangle ../src/doc_reform/output/sqlite.d 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, ) { <> if (!(doc_matters.opt.action.quiet)) { @@ -78,7 +78,7 @@ template SQLiteHubDiscreteBuildTablesAndPopulate() { } } } - SQLiteDiscreteDbStatementComposite!()(db, doc_abstraction, doc_matters); + SQLiteDiscreteDbStatementComposite!()(db, doc_matters, doc_abstraction); } } #+END_SRC @@ -132,8 +132,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 { @@ -171,8 +171,8 @@ template SQLiteTablesReCreate() { #+BEGIN_SRC d :tangle ../src/doc_reform/output/sqlite.d template SQLiteDeleteDocument() { - string SQLiteDeleteDocument(I)( - I doc_matters, + string SQLiteDeleteDocument(M)( + M doc_matters, ) { <> return _delete_uid; @@ -184,8 +184,8 @@ template SQLiteDeleteDocument() { #+BEGIN_SRC d :tangle ../src/doc_reform/output/sqlite.d template SQLiteInsertMetadata() { - string SQLiteInsertMetadata(I)( - I doc_matters, + string SQLiteInsertMetadata(M)( + M doc_matters, ) { <> return _insert_metadata; @@ -197,9 +197,9 @@ template SQLiteInsertMetadata() { #+BEGIN_SRC d :tangle ../src/doc_reform/output/sqlite.d 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) { @@ -287,7 +287,7 @@ template SQLiteDbDrop() { _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"); } } @@ -304,7 +304,7 @@ template SQLiteDbDrop() { { _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; @@ -383,7 +383,8 @@ light html objects #+name: sanitize_and_munge_inline_html #+BEGIN_SRC d -auto munge_html(O)( +auto munge_html(M,O)( + M doc_matters, auto ref const O obj, ) { string _html_special_characters(string _txt){ @@ -490,10 +491,11 @@ string html_font_face(string _txt){ #+name: html_objects #+BEGIN_SRC d -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"¶

%s

¶", @@ -508,11 +510,12 @@ auto html_heading(O)( ##+name: prepare_objects_html #+BEGIN_SRC d -auto html_heading(O)( +auto html_heading(M,O)( + M doc_matters, auto ref const O obj, ) { string o; - string _txt = munge_html(obj); + string _txt = munge_html(doc_matters, obj); o = format(q"¶ %s ¶", @@ -529,10 +532,11 @@ auto html_heading(O)( #+name: html_objects #+BEGIN_SRC d -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"¶

%s @@ -550,10 +554,11 @@ auto html_para(O)( #+name: html_objects #+BEGIN_SRC d -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"¶

%s

¶", @@ -568,10 +573,11 @@ auto html_quote(O)( #+name: html_objects #+BEGIN_SRC d -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"¶

%s

¶", @@ -586,10 +592,11 @@ auto html_group(O)( #+name: html_objects #+BEGIN_SRC d -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"¶

%s

¶", obj.metainfo.is_a, @@ -603,10 +610,11 @@ auto html_block(O)( #+name: html_objects #+BEGIN_SRC d -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"¶

%s

¶", obj.metainfo.is_a, _txt @@ -635,7 +643,8 @@ auto html_code(O)( #+name: html_objects #+BEGIN_SRC d -auto html_table(O)( +auto html_table(M,O)( + M doc_matters, auto ref const O obj, ) { auto _tablarize(O)( @@ -679,7 +688,7 @@ auto html_table(O)( ); 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]; @@ -702,9 +711,9 @@ auto html_table(O)( #+name: sqlite_load_object #+BEGIN_SRC d -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; @@ -713,9 +722,9 @@ auto sqlite_load_string(O,Dm)( #+name: sqlite_load_object #+BEGIN_SRC d -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; @@ -744,12 +753,13 @@ string sqlite_statement(O)( #+name: hub_format_and_sqlite_load_objects #+BEGIN_SRC d -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) { @@ -769,12 +779,13 @@ auto heading(O)( #+name: hub_format_and_sqlite_load_objects #+BEGIN_SRC d -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) { @@ -794,12 +805,13 @@ auto para(O)( #+name: hub_format_and_sqlite_load_objects #+BEGIN_SRC d -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) { @@ -818,12 +830,13 @@ auto quote(O)( #+name: hub_format_and_sqlite_load_objects #+BEGIN_SRC d -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) { @@ -843,12 +856,13 @@ auto group(O)( #+name: hub_format_and_sqlite_load_objects #+BEGIN_SRC d -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) { @@ -868,12 +882,13 @@ auto block(O)( #+name: hub_format_and_sqlite_load_objects #+BEGIN_SRC d -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) { @@ -893,7 +908,8 @@ auto verse(O)( #+name: hub_format_and_sqlite_load_objects #+BEGIN_SRC d -auto code(O)( +auto code(M,O)( + M doc_matters, auto ref const O obj, ) { string[string] obj_txt = [ @@ -918,12 +934,13 @@ auto code(O)( #+name: hub_format_and_sqlite_load_objects #+BEGIN_SRC d -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) { @@ -955,7 +972,7 @@ foreach (part; doc_matters.xml.keys_seq.sql) { 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)) { @@ -981,10 +998,10 @@ foreach (part; doc_matters.xml.keys_seq.sql) { 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)) { @@ -996,24 +1013,24 @@ foreach (part; doc_matters.xml.keys_seq.sql) { 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)) { @@ -1035,19 +1052,19 @@ foreach (part; doc_matters.xml.keys_seq.sql) { 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/org/output_xmls.org b/org/output_xmls.org index 8ebee95..7a4338e 100644 --- a/org/output_xmls.org +++ b/org/output_xmls.org @@ -419,11 +419,12 @@ auto tail() { #+name: xhtml_format_objects #+BEGIN_SRC d -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") { @@ -445,14 +446,16 @@ auto inline_images(O)( #+END_SRC **** links +***** scroll, seg, epub #+name: xhtml_format_objects #+BEGIN_SRC d -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)) @@ -496,12 +499,14 @@ auto inline_links(O)( } #+END_SRC -**** notes scroll +**** notes +***** scroll #+name: xhtml_format_objects #+BEGIN_SRC d -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) { @@ -525,13 +530,14 @@ auto inline_notes_scroll(O)( } #+END_SRC -**** notes seg +***** seg #+name: xhtml_format_objects #+BEGIN_SRC d -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) { @@ -570,35 +576,38 @@ auto inline_notes_seg(O)( } #+END_SRC -**** inline markup scroll +**** inline markup +***** scroll #+name: xhtml_format_objects #+BEGIN_SRC d -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; } #+END_SRC -**** inline markup seg +***** seg #+name: xhtml_format_objects #+BEGIN_SRC d -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; } #+END_SRC @@ -608,8 +617,9 @@ auto inline_markup_seg(O)( #+name: xhtml_format_objects #+BEGIN_SRC d -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 ~= "
\n"; @@ -640,8 +650,9 @@ string lev4_heading_subtoc(O)( #+name: xhtml_format_objects #+BEGIN_SRC d -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") { @@ -724,10 +735,11 @@ auto nav_pre_next_svg(O)( #+name: xhtml_format_objects #+BEGIN_SRC d -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 = "
"; @@ -779,14 +791,15 @@ auto heading(O)( #+name: xhtml_format_objects #+BEGIN_SRC d -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; } #+END_SRC @@ -795,16 +808,17 @@ auto heading_scroll(O)( #+name: xhtml_format_objects #+BEGIN_SRC d -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, @@ -818,9 +832,10 @@ auto heading_seg(O)( #+name: xhtml_format_objects #+BEGIN_SRC d -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); @@ -863,14 +878,15 @@ auto para(O)( #+name: xhtml_format_objects #+BEGIN_SRC d -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; } #+END_SRC @@ -879,16 +895,17 @@ auto para_scroll(O)( #+name: xhtml_format_objects #+BEGIN_SRC d -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, @@ -902,9 +919,10 @@ auto para_seg(O)( #+name: xhtml_format_objects #+BEGIN_SRC d -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; @@ -939,14 +957,15 @@ auto quote(O)( #+name: xhtml_format_objects #+BEGIN_SRC d -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; } #+END_SRC @@ -955,16 +974,17 @@ auto quote_scroll(O)( #+name: xhtml_format_objects #+BEGIN_SRC d -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, @@ -978,9 +998,10 @@ auto quote_seg(O)( #+name: xhtml_format_objects #+BEGIN_SRC d -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; @@ -1015,15 +1036,16 @@ auto group(O)( #+name: xhtml_format_objects #+BEGIN_SRC d -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; } #+END_SRC @@ -1032,16 +1054,17 @@ auto group_scroll(O)( #+name: xhtml_format_objects #+BEGIN_SRC d -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, @@ -1055,9 +1078,10 @@ auto group_seg(O)( #+name: xhtml_format_objects #+BEGIN_SRC d -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; @@ -1088,15 +1112,16 @@ auto block(O)( #+name: xhtml_format_objects #+BEGIN_SRC d -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; } #+END_SRC @@ -1105,16 +1130,17 @@ auto block_scroll(O)( #+name: xhtml_format_objects #+BEGIN_SRC d -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, @@ -1128,9 +1154,10 @@ auto block_seg(O)( #+name: xhtml_format_objects #+BEGIN_SRC d -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; @@ -1161,15 +1188,16 @@ auto verse(O)( #+name: xhtml_format_objects #+BEGIN_SRC d -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; } #+END_SRC @@ -1178,16 +1206,17 @@ auto verse_scroll(O)( #+name: xhtml_format_objects #+BEGIN_SRC d -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, @@ -1200,9 +1229,10 @@ auto verse_seg(O)( #+name: xhtml_format_objects_code #+BEGIN_SRC d -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) { @@ -1241,9 +1271,10 @@ align="left|right|center" #+name: xhtml_format_objects #+BEGIN_SRC d -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; @@ -1280,13 +1311,14 @@ auto tablarize(O)( #+name: xhtml_format_objects #+BEGIN_SRC d -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; @@ -1315,9 +1347,10 @@ auto table(O)( #+name: xhtml_format_objects #+BEGIN_SRC d -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"¶

@@ -1352,9 +1385,9 @@ template outputHTML() { #+name: output_html_scroll #+BEGIN_SRC d -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(); @@ -1374,10 +1407,10 @@ void scroll(D,I)( 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)) { @@ -1398,10 +1431,10 @@ void scroll(D,I)( 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)) { @@ -1413,24 +1446,24 @@ void scroll(D,I)( 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)) { @@ -1452,22 +1485,22 @@ void scroll(D,I)( 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)) { @@ -1579,7 +1612,7 @@ void seg(D,M)( 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; } @@ -1587,19 +1620,19 @@ void seg(D,M)( 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; @@ -1623,7 +1656,7 @@ void seg(D,M)( 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: @@ -1645,7 +1678,7 @@ void seg(D,M)( 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; @@ -1659,32 +1692,32 @@ void seg(D,M)( 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: @@ -1707,26 +1740,26 @@ void seg(D,M)( 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; @@ -2259,7 +2292,7 @@ void outputEPub3(D,I)( 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; @@ -2268,12 +2301,12 @@ void outputEPub3(D,I)( 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; @@ -2297,7 +2330,7 @@ void outputEPub3(D,I)( 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; @@ -2320,7 +2353,7 @@ void outputEPub3(D,I)( 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; @@ -2334,32 +2367,32 @@ void outputEPub3(D,I)( 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: @@ -2382,26 +2415,26 @@ void outputEPub3(D,I)( 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/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, "$1"); 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"¶

%s

¶", @@ -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"¶

%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"¶

%s

¶", @@ -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"¶

%s

¶", @@ -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"¶

%s

¶", 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"¶

%s

¶", 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() { ¶"); 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 ~= "
\n"; @@ -489,8 +496,9 @@ template outputXHTMLs() { lev4_subtoc ~= "
\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 = "
"; @@ -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"¶

@@ -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) { -- cgit v1.2.3