From 916e227028ab19e58a4ae1e5ebb1fa38691633bd Mon Sep 17 00:00:00 2001 From: Ralph Amissah Date: Thu, 23 Nov 2017 16:09:14 -0500 Subject: 0.20.1 struct for opt_actions --- org/meta_abstraction.org | 175 +++++++++++++++++++++++------------------------ 1 file changed, 86 insertions(+), 89 deletions(-) (limited to 'org/meta_abstraction.org') diff --git a/org/meta_abstraction.org b/org/meta_abstraction.org index 9a5d41f..0caa15c 100644 --- a/org/meta_abstraction.org +++ b/org/meta_abstraction.org @@ -43,7 +43,6 @@ template SiSUdocAbstraction() { static auto rgx = Rgx(); debug(asserts) { static assert(is(typeof(markup_sourcefile_content) == char[][])); - static assert(is(typeof(opt_action) == bool[string])); } /+ ↓ abstraction init +/ <> @@ -600,7 +599,7 @@ if (line.matchFirst(rgx.heading_biblio) obj_type_status["glossary_section"] = State.off; obj_type_status["biblio_section"] = State.on; obj_type_status["blurb_section"] = State.off; - if (opt_action["backmatter"] && opt_action["section_biblio"]) { + if (opt_action.backmatter && opt_action.section_biblio) { _biblio_block_(line, obj_type_status, bib_entry, biblio_entry_str_json, biblio_arr_json); debug(bibliobuild) { writeln("- ", biblio_entry_str_json); @@ -634,7 +633,7 @@ if there is a glossary section you need to: obj_type_status["glossary_section"] = State.on; obj_type_status["biblio_section"] = State.off; obj_type_status["blurb_section"] = State.off; - if (opt_action["backmatter"] && opt_action["section_glossary"]) { + if (opt_action.backmatter && opt_action.section_glossary) { indent=[ "hang_position" : 0, "base_position" : 0, @@ -729,7 +728,7 @@ if there is a blurb section you need to: obj_type_status["glossary_section"] = State.off; obj_type_status["biblio_section"] = State.off; obj_type_status["blurb_section"] = State.on; - if (opt_action["backmatter"] && opt_action["section_blurb"]) { + if (opt_action.backmatter && opt_action.section_blurb) { indent=[ "hang_position" : 0, "base_position" : 0, @@ -779,7 +778,7 @@ if there is a blurb section you need to: comp_obj_heading_.dom_collapsed = [ 1, 1, 1, 0, 0, 0, 0, 0]; the_blurb_section ~= comp_obj_heading_; } else if (line.matchFirst(rgx.heading) - && (opt_action["backmatter"] && opt_action["section_blurb"])) { + && (opt_action.backmatter && opt_action.section_blurb)) { comp_obj_heading_ = comp_obj_heading_.init; comp_obj_heading_.of_part = "backmatter"; comp_obj_heading_.of_section = "blurb"; @@ -1879,13 +1878,13 @@ foreach (ref obj; the_document_head_section) { obj.obj_cite_number_type = OCNtype.ocn; } /+ dom structure (marked up & collapsed) +/ - if ((opt_action["html"]) - || (opt_action["html-scroll"]) - || (opt_action["html-seg"]) - || (opt_action["epub"]) - || (opt_action["sqlite-discrete"]) - || (opt_action["sqlite-update"]) - || (opt_action["postgresql"])) { + if ((opt_action.html) + || (opt_action.html_scroll) + || (opt_action.html_seg) + || (opt_action.epub) + || (opt_action.sqlite_discrete) + || (opt_action.sqlite_update) + || (opt_action.postgresql)) { obj = obj_dom_structure_set_markup_tags(obj, dom_markedup, obj.heading_lev_markup); obj = obj_dom_set_collapsed_tags(obj, dom_collapsed, obj.heading_lev_collapsed); } @@ -1912,13 +1911,13 @@ if (the_table_of_contents_section["scroll"].length > 1) { } } /+ dom structure (marked up & collapsed) +/ - if ((opt_action["html"]) - || (opt_action["html-scroll"]) - || (opt_action["html-seg"]) - || (opt_action["epub"]) - || (opt_action["sqlite-discrete"]) - || (opt_action["sqlite-update"]) - || (opt_action["postgresql"])) { + if ((opt_action.html) + || (opt_action.html_scroll) + || (opt_action.html_seg) + || (opt_action.epub) + || (opt_action.sqlite_discrete) + || (opt_action.sqlite_update) + || (opt_action.postgresql)) { obj = obj_dom_structure_set_markup_tags(obj, dom_markedup, obj.heading_lev_markup); obj = obj_dom_set_collapsed_tags(obj, dom_collapsed, obj.heading_lev_collapsed); } @@ -1940,10 +1939,10 @@ if (the_table_of_contents_section["scroll"].length > 1) { assert(obj.segment_anchor_tag == html_segnames[obj.ptr_html_segnames]); } } - if ((opt_action["html"]) - || (opt_action["html-scroll"]) - || (opt_action["html-seg"]) - || (opt_action["epub"])) { + if ((opt_action.html) + || (opt_action.html_scroll) + || (opt_action.html_seg) + || (opt_action.epub)) { obj = obj_dom_structure_set_markup_tags(obj, dom_markedup, obj.heading_lev_markup); obj = obj_dom_set_collapsed_tags(obj, dom_collapsed, obj.heading_lev_collapsed); } @@ -1976,13 +1975,13 @@ if (the_document_body_section.length > 1) { } } /+ dom structure (marked up & collapsed) +/ - if ((opt_action["html"]) - || (opt_action["html-scroll"]) - || (opt_action["html-seg"]) - || (opt_action["epub"]) - || (opt_action["sqlite-discrete"]) - || (opt_action["sqlite-update"]) - || (opt_action["postgresql"])) { + if ((opt_action.html) + || (opt_action.html_scroll) + || (opt_action.html_seg) + || (opt_action.epub) + || (opt_action.sqlite_discrete) + || (opt_action.sqlite_update) + || (opt_action.postgresql)) { obj = obj_dom_structure_set_markup_tags(obj, dom_markedup, obj.heading_lev_markup); obj = obj_dom_set_collapsed_tags(obj, dom_collapsed, obj.heading_lev_collapsed); } @@ -2024,13 +2023,13 @@ if (the_endnotes_section.length > 1) { } } /+ dom structure (marked up & collapsed) +/ - if ((opt_action["html"]) - || (opt_action["html-scroll"]) - || (opt_action["html-seg"]) - || (opt_action["epub"]) - || (opt_action["sqlite-discrete"]) - || (opt_action["sqlite-update"]) - || (opt_action["postgresql"])) { + if ((opt_action.html) + || (opt_action.html_scroll) + || (opt_action.html_seg) + || (opt_action.epub) + || (opt_action.sqlite_discrete) + || (opt_action.sqlite_update) + || (opt_action.postgresql)) { obj = obj_dom_structure_set_markup_tags(obj, dom_markedup, obj.heading_lev_markup); obj = obj_dom_set_collapsed_tags(obj, dom_collapsed, obj.heading_lev_collapsed); } @@ -2065,13 +2064,13 @@ if (the_glossary_section.length > 1) { } } /+ dom structure (marked up & collapsed) +/ - if ((opt_action["html"]) - || (opt_action["html-scroll"]) - || (opt_action["html-seg"]) - || (opt_action["epub"]) - || (opt_action["sqlite-discrete"]) - || (opt_action["sqlite-update"]) - || (opt_action["postgresql"])) { + if ((opt_action.html) + || (opt_action.html_scroll) + || (opt_action.html_seg) + || (opt_action.epub) + || (opt_action.sqlite_discrete) + || (opt_action.sqlite_update) + || (opt_action.postgresql)) { obj = obj_dom_structure_set_markup_tags(obj, dom_markedup, obj.heading_lev_markup); obj = obj_dom_set_collapsed_tags(obj, dom_collapsed, obj.heading_lev_collapsed); } @@ -2110,13 +2109,13 @@ if (the_bibliography_section.length > 1) { } } /+ dom structure (marked up & collapsed) +/ - if ((opt_action["html"]) - || (opt_action["html-scroll"]) - || (opt_action["html-seg"]) - || (opt_action["epub"]) - || (opt_action["sqlite-discrete"]) - || (opt_action["sqlite-update"]) - || (opt_action["postgresql"])) { + if ((opt_action.html) + || (opt_action.html_scroll) + || (opt_action.html_seg) + || (opt_action.epub) + || (opt_action.sqlite_discrete) + || (opt_action.sqlite_update) + || (opt_action.postgresql)) { obj = obj_dom_structure_set_markup_tags(obj, dom_markedup, obj.heading_lev_markup); obj = obj_dom_set_collapsed_tags(obj, dom_collapsed, obj.heading_lev_collapsed); } @@ -2160,13 +2159,13 @@ if (the_bookindex_section["scroll"].length > 1) { } } /+ dom structure (marked up & collapsed) +/ - if ((opt_action["html"]) - || (opt_action["html-scroll"]) - || (opt_action["html-seg"]) - || (opt_action["epub"]) - || (opt_action["sqlite-discrete"]) - || (opt_action["sqlite-update"]) - || (opt_action["postgresql"])) { + if ((opt_action.html) + || (opt_action.html_scroll) + || (opt_action.html_seg) + || (opt_action.epub) + || (opt_action.sqlite_discrete) + || (opt_action.sqlite_update) + || (opt_action.postgresql)) { obj = obj_dom_structure_set_markup_tags(obj, dom_markedup, obj.heading_lev_markup); obj = obj_dom_set_collapsed_tags(obj, dom_collapsed, obj.heading_lev_collapsed); } @@ -2199,13 +2198,13 @@ if (the_bookindex_section["scroll"].length > 1) { } } /+ dom structure (marked up & collapsed) +/ - if ((opt_action["html"]) - || (opt_action["html-scroll"]) - || (opt_action["html-seg"]) - || (opt_action["epub"]) - || (opt_action["sqlite-discrete"]) - || (opt_action["sqlite-update"]) - || (opt_action["postgresql"])) { + if ((opt_action.html) + || (opt_action.html_scroll) + || (opt_action.html_seg) + || (opt_action.epub) + || (opt_action.sqlite_discrete) + || (opt_action.sqlite_update) + || (opt_action.postgresql)) { obj = obj_dom_structure_set_markup_tags(obj, dom_markedup, obj.heading_lev_markup); obj = obj_dom_set_collapsed_tags(obj, dom_collapsed, obj.heading_lev_collapsed); } @@ -2248,13 +2247,13 @@ if (the_blurb_section.length > 1) { } } /+ dom structure (marked up & collapsed) +/ - if ((opt_action["html"]) - || (opt_action["html-scroll"]) - || (opt_action["html-seg"]) - || (opt_action["epub"]) - || (opt_action["sqlite-discrete"]) - || (opt_action["sqlite-update"]) - || (opt_action["postgresql"])) { + if ((opt_action.html) + || (opt_action.html_scroll) + || (opt_action.html_seg) + || (opt_action.epub) + || (opt_action.sqlite_discrete) + || (opt_action.sqlite_update) + || (opt_action.postgresql)) { obj = obj_dom_structure_set_markup_tags(obj, dom_markedup, obj.heading_lev_markup); obj = obj_dom_set_collapsed_tags(obj, dom_collapsed, obj.heading_lev_collapsed); } @@ -2359,10 +2358,10 @@ if (document_the["blurb"].length > 1) { document_section_keys_sequenced["scroll"] ~= "blurb"; document_section_keys_sequenced["sql"] ~= "blurb"; } -if ((opt_action["html"]) -|| (opt_action["html-scroll"]) -|| (opt_action["html-seg"]) -|| (opt_action["epub"])) { +if ((opt_action.html) +|| (opt_action.html_scroll) +|| (opt_action.html_seg) +|| (opt_action.epub)) { document_section_keys_sequenced["seg"] ~= "tail"; document_section_keys_sequenced["scroll"] ~= "tail"; } @@ -3845,7 +3844,6 @@ auto _book_index_(L,I,O,T,B)( static assert(is(typeof(book_idx_tmp) == string)); static assert(is(typeof(an_object) == string[string])); static assert(is(typeof(obj_type_status) == int[string])); - static assert(is(typeof(opt_action) == bool[string])); } static auto rgx = Rgx(); if (auto m = line.match(rgx.book_index)) { @@ -3860,7 +3858,7 @@ auto _book_index_(L,I,O,T,B)( } else if (auto m = line.match(rgx.book_index_open)) { /+ match open book_index +/ obj_type_status["book_index"] = State.on; - if (opt_action["backmatter"] && opt_action["section_bookindex"]) { + if (opt_action.backmatter && opt_action.section_bookindex) { book_idx_tmp = m.captures[1].to!string; debug(bookindexmatch) { // book index writefln( @@ -3873,8 +3871,8 @@ auto _book_index_(L,I,O,T,B)( /+ book_index flag set +/ if (auto m = line.match(rgx.book_index_close)) { obj_type_status["book_index"] = State.off; - if (opt_action["backmatter"] - && opt_action["section_bookindex"]) { + if (opt_action.backmatter + && opt_action.section_bookindex) { an_object["bookindex_nugget"] = book_idx_tmp ~ m.captures[1].to!string; debug(bookindexmatch) { // book index writefln( @@ -3885,8 +3883,8 @@ auto _book_index_(L,I,O,T,B)( } book_idx_tmp = ""; } else { - if (opt_action["backmatter"] - && opt_action["section_bookindex"]) { + if (opt_action.backmatter + && opt_action.section_bookindex) { book_idx_tmp ~= line; } } @@ -6071,7 +6069,6 @@ struct BookIndexReportSection { debug(asserts) { static assert(is(typeof(bookindex_unordered_hashes) == string[][string][string])); static assert(is(typeof(obj_cite_digits.on) == int)); - static assert(is(typeof(opt_action) == bool[string])); } mixin SiSUnode; mixin InternalMarkup; @@ -6088,8 +6085,8 @@ struct BookIndexReportSection { auto node_para_int_ = node_metadata_para_int; auto node_para_str_ = node_metadata_para_str; if ((mainkeys.length > 0) - && (opt_action["backmatter"] - && opt_action["section_bookindex"])) { + && (opt_action.backmatter + && opt_action.section_bookindex)) { string bi_tmp_seg, bi_tmp_scroll; string[] bi_tmp_tags; comp_obj_heading_ = comp_obj_heading_.init; @@ -6334,9 +6331,9 @@ struct NotesSection { #+name: meta_emitters_endnotes #+BEGIN_SRC d - private auto endnote_objects(N)( + private auto endnote_objects(N,O)( N obj_cite_digits, - bool[string] opt_action, + O opt_action, ) in { } @@ -6350,7 +6347,7 @@ struct NotesSection { int[string] indent; ObjGenericComposite comp_obj_heading_; if ((endnotes_["notes"].length > 0) - && (opt_action["backmatter"] && opt_action["section_endnotes"])) { + && (opt_action.backmatter && opt_action.section_endnotes)) { comp_obj_heading_ = comp_obj_heading_.init; comp_obj_heading_.of_part = "backmatter"; comp_obj_heading_.of_section = "endnotes"; @@ -6406,7 +6403,7 @@ struct NotesSection { comp_obj_heading_.parent_lev_markup = 0; the_endnotes_section ~= comp_obj_heading_; } - if (opt_action["backmatter"] && opt_action["section_endnotes"]) { + if (opt_action.backmatter && opt_action.section_endnotes) { ObjGenericComposite comp_obj_endnote_; comp_obj_endnote_ = comp_obj_endnote_.init; comp_obj_endnote_.of_part = "backmatter"; -- cgit v1.2.3