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 --- src/sdp/meta/doc_debugs.d | 4 +- src/sdp/meta/metadoc.d | 13 +-- src/sdp/meta/metadoc_from_src.d | 175 ++++++++++++++++++++-------------------- src/sdp/meta/metadoc_summary.d | 2 +- 4 files changed, 93 insertions(+), 101 deletions(-) (limited to 'src/sdp/meta') diff --git a/src/sdp/meta/doc_debugs.d b/src/sdp/meta/doc_debugs.d index e8ed3e3..2b274a3 100644 --- a/src/sdp/meta/doc_debugs.d +++ b/src/sdp/meta/doc_debugs.d @@ -458,10 +458,10 @@ template SiSUdebugs() { ]; } debug(checkdoc) { - if ((doc_matters.opt_action["debug"])) { + if ((doc_matters.opt_action.do_debug)) { debug(checkdoc) { if (auto mfn=match(doc_matters.source_filename, rgx.src_fn)) { - if (doc_matters.opt_action["assertions"]) { + if (doc_matters.opt_action.assertions) { switch (mfn.captures[2]) { // live manual: case "live-manual.ssm": diff --git a/src/sdp/meta/metadoc.d b/src/sdp/meta/metadoc.d index 8d83340..f36af09 100644 --- a/src/sdp/meta/metadoc.d +++ b/src/sdp/meta/metadoc.d @@ -31,10 +31,9 @@ template SiSUabstraction() { enum makeMeta { make, meta } enum docAbst { doc_abstraction, section_keys, segnames, segnames_0_4, images } static auto rgx = Rgx(); - auto SiSUabstraction(Fn,O,S,E)( + auto SiSUabstraction(Fn,O,E)( Fn fn_src, - O opts, - S settings, + O _opt_action, E env, ){ auto sdl_root_config_share = configRead!()("config_share", env); @@ -73,7 +72,7 @@ template SiSUabstraction() { auto da = SiSUdocAbstraction!()( _header_body_inserts[headBody.body_content], _make_and_meta_struct, - opts + _opt_action, ); static assert(!isTypeTuple!(da)); static assert(da.length==5); @@ -116,11 +115,7 @@ template SiSUabstraction() { return _k; } auto opt_action() { - bool[string] _k = opts; - return _k; - } - auto opt_settings() { - string[string] _k = settings; + auto _k = _opt_action; return _k; } auto environment() { diff --git a/src/sdp/meta/metadoc_from_src.d b/src/sdp/meta/metadoc_from_src.d index 24c4699..917b66f 100644 --- a/src/sdp/meta/metadoc_from_src.d +++ b/src/sdp/meta/metadoc_from_src.d @@ -244,7 +244,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 +/ scope(success) { @@ -410,7 +409,7 @@ template SiSUdocAbstraction() { 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); @@ -431,7 +430,7 @@ template SiSUdocAbstraction() { 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, @@ -513,7 +512,7 @@ template SiSUdocAbstraction() { 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, @@ -563,7 +562,7 @@ template SiSUdocAbstraction() { 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"; @@ -1374,13 +1373,13 @@ template SiSUdocAbstraction() { 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); } @@ -1401,13 +1400,13 @@ template SiSUdocAbstraction() { } } /+ 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); } @@ -1429,10 +1428,10 @@ template SiSUdocAbstraction() { 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); } @@ -1459,13 +1458,13 @@ template SiSUdocAbstraction() { } } /+ 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); } @@ -1501,13 +1500,13 @@ template SiSUdocAbstraction() { } } /+ 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); } @@ -1536,13 +1535,13 @@ template SiSUdocAbstraction() { } } /+ 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); } @@ -1575,13 +1574,13 @@ template SiSUdocAbstraction() { } } /+ 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); } @@ -1619,13 +1618,13 @@ template SiSUdocAbstraction() { } } /+ 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); } @@ -1658,13 +1657,13 @@ template SiSUdocAbstraction() { } } /+ 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); } @@ -1701,13 +1700,13 @@ template SiSUdocAbstraction() { } } /+ 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); } @@ -1793,10 +1792,10 @@ template SiSUdocAbstraction() { 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"; } @@ -3012,7 +3011,6 @@ template SiSUdocAbstraction() { 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)) { @@ -3027,7 +3025,7 @@ template SiSUdocAbstraction() { } 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( @@ -3040,8 +3038,8 @@ template SiSUdocAbstraction() { /+ 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( @@ -3052,8 +3050,8 @@ template SiSUdocAbstraction() { } book_idx_tmp = ""; } else { - if (opt_action["backmatter"] - && opt_action["section_bookindex"]) { + if (opt_action.backmatter + && opt_action.section_bookindex) { book_idx_tmp ~= line; } } @@ -4870,7 +4868,6 @@ template SiSUdocAbstraction() { 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; @@ -4887,8 +4884,8 @@ template SiSUdocAbstraction() { 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; @@ -5104,9 +5101,9 @@ template SiSUdocAbstraction() { } return endnotes_; } - private auto endnote_objects(N)( + private auto endnote_objects(N,O)( N obj_cite_digits, - bool[string] opt_action, + O opt_action, ) in { } @@ -5120,7 +5117,7 @@ template SiSUdocAbstraction() { 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"; @@ -5176,7 +5173,7 @@ template SiSUdocAbstraction() { 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"; diff --git a/src/sdp/meta/metadoc_summary.d b/src/sdp/meta/metadoc_summary.d index 45fd319..c1e3f76 100644 --- a/src/sdp/meta/metadoc_summary.d +++ b/src/sdp/meta/metadoc_summary.d @@ -20,7 +20,7 @@ template SiSUabstractionSummary() { std.conv : to; mixin InternalMarkup; auto markup = InlineMarkup(); - if (doc_matters.opt_action["verbose"]) { + if (doc_matters.opt_action.verbose) { string[string] check = [ "last_obj_cite_number" : "NA [debug \"checkdoc\" not run]", "last_obj_cite_number_body" : "0", -- cgit v1.2.3