From 25c30732826b75420bab6287bfe7cbbc9f75e3b5 Mon Sep 17 00:00:00 2001 From: Ralph Amissah Date: Tue, 6 Jun 2017 17:54:49 -0400 Subject: getopt, fixes, & naming command line options related --- src/sdp/ao/abstract_doc_source.d | 134 +++++++++++++++++++-------------------- src/sdp/ao/abstraction.d | 8 +-- src/sdp/ao/abstraction_summary.d | 2 +- src/sdp/ao/doc_debugs.d | 4 +- 4 files changed, 74 insertions(+), 74 deletions(-) (limited to 'src/sdp/ao') diff --git a/src/sdp/ao/abstract_doc_source.d b/src/sdp/ao/abstract_doc_source.d index 8b95cc0..f935df3 100644 --- a/src/sdp/ao/abstract_doc_source.d +++ b/src/sdp/ao/abstract_doc_source.d @@ -219,14 +219,14 @@ template SiSUdocAbstraction() { Src markup_sourcefile_content, Make dochead_make_aa, Meta dochead_meta_aa, - Opt opt_action_bool, + Opt opt_action, ) { auto rgx = Rgx(); debug(asserts) { static assert(is(typeof(markup_sourcefile_content) == char[][])); static assert(is(typeof(dochead_make_aa) == string[string][string])); static assert(is(typeof(dochead_meta_aa) == string[string][string])); - static assert(is(typeof(opt_action_bool) == bool[string])); + static assert(is(typeof(opt_action) == bool[string])); } /+ ↓ abstraction init +/ scope(success) { @@ -386,7 +386,7 @@ template SiSUdocAbstraction() { type["glossary_section"] = State.off; type["biblio_section"] = State.on; type["blurb_section"] = State.off; - if (opt_action_bool["backmatter"] && opt_action_bool["section_biblio"]) { + if (opt_action["backmatter"] && opt_action["section_biblio"]) { _biblio_block_(line, type, bib_entry, biblio_entry_str_json, biblio_arr_json); debug(bibliobuild) { writeln("- ", biblio_entry_str_json); @@ -407,7 +407,7 @@ template SiSUdocAbstraction() { type["glossary_section"] = State.on; type["biblio_section"] = State.off; type["blurb_section"] = State.off; - if (opt_action_bool["backmatter"] && opt_action_bool["section_glossary"]) { + if (opt_action["backmatter"] && opt_action["section_glossary"]) { indent=[ "hang_position" : 0, "base_position" : 0, @@ -476,7 +476,7 @@ template SiSUdocAbstraction() { type["glossary_section"] = State.off; type["biblio_section"] = State.off; type["blurb_section"] = State.on; - if (opt_action_bool["backmatter"] && opt_action_bool["section_blurb"]) { + if (opt_action["backmatter"] && opt_action["section_blurb"]) { indent=[ "hang_position" : 0, "base_position" : 0, @@ -516,7 +516,7 @@ template SiSUdocAbstraction() { comp_obj_heading_.anchor_tags = ["blurb"]; the_blurb_section ~= comp_obj_heading_; } else if (line.matchFirst(rgx.heading) - && (opt_action_bool["backmatter"] && opt_action_bool["section_blurb"])) { + && (opt_action["backmatter"] && opt_action["section_blurb"])) { comp_obj_heading_ = comp_obj_heading_.init; comp_obj_heading_.use = "backmatter"; comp_obj_heading_.is_of = "para"; @@ -625,7 +625,7 @@ template SiSUdocAbstraction() { || line.matchFirst(rgx.book_index_open) || type["book_index"] == State.on ) { /+ book_index +/ - _book_index_(line, book_idx_tmp, an_object, type, opt_action_bool); + _book_index_(line, book_idx_tmp, an_object, type, opt_action); } else { /+ not book_index +/ an_object_key="body_nugget"; @@ -915,7 +915,7 @@ template SiSUdocAbstraction() { } /+ ← closed: loop markup document/text line by line +/ /+ ↓ post loop markup document/text +/ auto en_tuple = - note_section.endnote_objects(obj_cite_number, opt_action_bool); + note_section.endnote_objects(obj_cite_number, opt_action); static assert(!isTypeTuple!(en_tuple)); auto the_endnotes_section = en_tuple[0]; obj_cite_number = en_tuple[1]; @@ -1039,7 +1039,7 @@ template SiSUdocAbstraction() { bi.bookindex_build_abstraction_section( bookindex_unordered_hashes, obj_cite_number, - opt_action_bool, + opt_action, ); destroy(bookindex_unordered_hashes); static assert(!isTypeTuple!(bi_tuple)); @@ -1288,10 +1288,10 @@ template SiSUdocAbstraction() { if (obj.heading_lev_markup <= 4) { segnames_0_4 ~= obj.segment_anchor_tag; } - if ((opt_action_bool["html"]) - || (opt_action_bool["html_scroll"]) - || (opt_action_bool["html_seg"]) - || (opt_action_bool["epub"])) { + if ((opt_action["html"]) + || (opt_action["html-scroll"]) + || (opt_action["html-seg"]) + || (opt_action["epub"])) { obj.dom_markedup = dom_set_markup_tags(dom_markedup, obj.heading_lev_markup).dup; obj.dom_collapsed = @@ -1312,10 +1312,10 @@ template SiSUdocAbstraction() { assert(obj.segment_anchor_tag == html_segnames[obj.ptr_html_segnames]); } } - if ((opt_action_bool["html"]) - || (opt_action_bool["html_scroll"]) - || (opt_action_bool["html_seg"]) - || (opt_action_bool["epub"])) { + if ((opt_action["html"]) + || (opt_action["html-scroll"]) + || (opt_action["html-seg"]) + || (opt_action["epub"])) { obj.dom_markedup = dom_set_markup_tags(dom_markedup, obj.heading_lev_markup).dup; obj.dom_collapsed = @@ -1338,10 +1338,10 @@ template SiSUdocAbstraction() { assert(obj.segment_anchor_tag == html_segnames[obj.ptr_html_segnames]); } } - if ((opt_action_bool["html"]) - || (opt_action_bool["html_scroll"]) - || (opt_action_bool["html_seg"]) - || (opt_action_bool["epub"])) { + if ((opt_action["html"]) + || (opt_action["html-scroll"]) + || (opt_action["html-seg"]) + || (opt_action["epub"])) { obj.dom_markedup = dom_set_markup_tags(dom_markedup, obj.heading_lev_markup).dup; obj.dom_collapsed = @@ -1369,10 +1369,10 @@ template SiSUdocAbstraction() { assert(obj.segment_anchor_tag == html_segnames[obj.ptr_html_segnames]); } } - if ((opt_action_bool["html"]) - || (opt_action_bool["html_scroll"]) - || (opt_action_bool["html_seg"]) - || (opt_action_bool["epub"])) { + if ((opt_action["html"]) + || (opt_action["html-scroll"]) + || (opt_action["html-seg"]) + || (opt_action["epub"])) { obj.dom_markedup = dom_set_markup_tags(dom_markedup, obj.heading_lev_markup).dup; obj.dom_collapsed = @@ -1406,10 +1406,10 @@ template SiSUdocAbstraction() { assert(obj.segment_anchor_tag == html_segnames[obj.ptr_html_segnames]); } } - if ((opt_action_bool["html"]) - || (opt_action_bool["html_scroll"]) - || (opt_action_bool["html_seg"]) - || (opt_action_bool["epub"])) { + if ((opt_action["html"]) + || (opt_action["html-scroll"]) + || (opt_action["html-seg"]) + || (opt_action["epub"])) { obj.dom_markedup = dom_set_markup_tags(dom_markedup, obj.heading_lev_markup).dup; obj.dom_collapsed = @@ -1436,10 +1436,10 @@ template SiSUdocAbstraction() { assert(obj.segment_anchor_tag == html_segnames[obj.ptr_html_segnames]); } } - if ((opt_action_bool["html"]) - || (opt_action_bool["html_scroll"]) - || (opt_action_bool["html_seg"]) - || (opt_action_bool["epub"])) { + if ((opt_action["html"]) + || (opt_action["html-scroll"]) + || (opt_action["html-seg"]) + || (opt_action["epub"])) { obj.dom_markedup = dom_set_markup_tags(dom_markedup, obj.heading_lev_markup).dup; obj.dom_collapsed = @@ -1466,10 +1466,10 @@ template SiSUdocAbstraction() { assert(obj.segment_anchor_tag == html_segnames[obj.ptr_html_segnames]); } } - if ((opt_action_bool["html"]) - || (opt_action_bool["html_scroll"]) - || (opt_action_bool["html_seg"]) - || (opt_action_bool["epub"])) { + if ((opt_action["html"]) + || (opt_action["html-scroll"]) + || (opt_action["html-seg"]) + || (opt_action["epub"])) { obj.dom_markedup = dom_set_markup_tags(dom_markedup, obj.heading_lev_markup).dup; obj.dom_collapsed = @@ -1497,10 +1497,10 @@ template SiSUdocAbstraction() { assert(obj.segment_anchor_tag == html_segnames[obj.ptr_html_segnames]); } } - if ((opt_action_bool["html"]) - || (opt_action_bool["html_scroll"]) - || (opt_action_bool["html_seg"]) - || (opt_action_bool["epub"])) { + if ((opt_action["html"]) + || (opt_action["html-scroll"]) + || (opt_action["html-seg"]) + || (opt_action["epub"])) { obj.dom_markedup = dom_set_markup_tags(dom_markedup, obj.heading_lev_markup).dup; obj.dom_collapsed = @@ -1526,10 +1526,10 @@ template SiSUdocAbstraction() { assert(obj.segment_anchor_tag == html_segnames[obj.ptr_html_segnames]); } } - if ((opt_action_bool["html"]) - || (opt_action_bool["html_scroll"]) - || (opt_action_bool["html_seg"]) - || (opt_action_bool["epub"])) { + if ((opt_action["html"]) + || (opt_action["html-scroll"]) + || (opt_action["html-seg"]) + || (opt_action["epub"])) { obj.dom_markedup = dom_set_markup_tags(dom_markedup, obj.heading_lev_markup).dup; obj.dom_collapsed = @@ -1556,10 +1556,10 @@ template SiSUdocAbstraction() { assert(obj.segment_anchor_tag == html_segnames[obj.ptr_html_segnames]); } } - if ((opt_action_bool["html"]) - || (opt_action_bool["html_scroll"]) - || (opt_action_bool["html_seg"]) - || (opt_action_bool["epub"])) { + if ((opt_action["html"]) + || (opt_action["html-scroll"]) + || (opt_action["html-seg"]) + || (opt_action["epub"])) { obj.dom_markedup = dom_set_markup_tags(dom_markedup, obj.heading_lev_markup).dup; obj.dom_collapsed = @@ -1634,10 +1634,10 @@ template SiSUdocAbstraction() { document_section_keys_sequenced["seg"] ~= "blurb"; document_section_keys_sequenced["scroll"] ~= "blurb"; } - if ((opt_action_bool["html"]) - || (opt_action_bool["html_scroll"]) - || (opt_action_bool["html_seg"]) - || (opt_action_bool["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"; } @@ -2812,14 +2812,14 @@ template SiSUdocAbstraction() { return ref I book_idx_tmp, return ref O an_object, return ref T type, - B opt_action_bool, + B opt_action, ) { debug(asserts) { static assert(is(typeof(line) == char[])); static assert(is(typeof(book_idx_tmp) == string)); static assert(is(typeof(an_object) == string[string])); static assert(is(typeof(type) == int[string])); - static assert(is(typeof(opt_action_bool) == bool[string])); + static assert(is(typeof(opt_action) == bool[string])); } auto rgx = Rgx(); if (auto m = line.match(rgx.book_index)) { @@ -2834,7 +2834,7 @@ template SiSUdocAbstraction() { } else if (auto m = line.match(rgx.book_index_open)) { /+ match open book_index +/ type["book_index"] = State.on; - if (opt_action_bool["backmatter"] && opt_action_bool["section_bookindex"]) { + if (opt_action["backmatter"] && opt_action["section_bookindex"]) { book_idx_tmp = m.captures[1].to!string; debug(bookindexmatch) { // book index writefln( @@ -2847,8 +2847,8 @@ template SiSUdocAbstraction() { /+ book_index flag set +/ if (auto m = line.match(rgx.book_index_close)) { type["book_index"] = State.off; - if (opt_action_bool["backmatter"] - && opt_action_bool["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( @@ -2859,8 +2859,8 @@ template SiSUdocAbstraction() { } book_idx_tmp = ""; } else { - if (opt_action_bool["backmatter"] - && opt_action_bool["section_bookindex"]) { + if (opt_action["backmatter"] + && opt_action["section_bookindex"]) { book_idx_tmp ~= line; } } @@ -4648,12 +4648,12 @@ template SiSUdocAbstraction() { auto bookindex_build_abstraction_section(BI,N,B)( BI bookindex_unordered_hashes, N obj_cite_number, - B opt_action_bool, + B opt_action, ) { debug(asserts) { static assert(is(typeof(bookindex_unordered_hashes) == string[][string][string])); static assert(is(typeof(obj_cite_number) == int)); - static assert(is(typeof(opt_action_bool) == bool[string])); + static assert(is(typeof(opt_action) == bool[string])); } mixin SiSUnode; mixin InternalMarkup; @@ -4670,8 +4670,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_bool["backmatter"] - && opt_action_bool["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; @@ -4881,7 +4881,7 @@ template SiSUdocAbstraction() { } private auto endnote_objects( int obj_cite_number, - bool[string] opt_action_bool, + bool[string] opt_action, ) in { } @@ -4895,7 +4895,7 @@ template SiSUdocAbstraction() { int[string] indent; ObjGenericComposite comp_obj_heading_; if ((endnotes_["notes"].length > 0) - && (opt_action_bool["backmatter"] && opt_action_bool["section_endnotes"])) { + && (opt_action["backmatter"] && opt_action["section_endnotes"])) { comp_obj_heading_ = comp_obj_heading_.init; comp_obj_heading_.use = "backmatter"; comp_obj_heading_.is_of = "para"; @@ -4944,7 +4944,7 @@ template SiSUdocAbstraction() { comp_obj_heading_.parent_lev_markup = 0; the_endnotes_section ~= comp_obj_heading_; } - if (opt_action_bool["backmatter"] && opt_action_bool["section_endnotes"]) { + if (opt_action["backmatter"] && opt_action["section_endnotes"]) { ObjGenericComposite comp_obj_endnote_; comp_obj_endnote_ = comp_obj_endnote_.init; comp_obj_endnote_.use = "backmatter"; diff --git a/src/sdp/ao/abstraction.d b/src/sdp/ao/abstraction.d index 483ceb8..c592436 100644 --- a/src/sdp/ao/abstraction.d +++ b/src/sdp/ao/abstraction.d @@ -53,9 +53,9 @@ template SiSUabstraction() { static assert(_make_and_meta.length==2); /+ ↓ document abstraction: process document, return abstraction as tuple +/ auto da = SiSUdocAbstraction!()( - (_header_body_inserts[headBody.body_content]), - (_make_and_meta[makeMeta.make]), - (_make_and_meta[makeMeta.meta]), + _header_body_inserts[headBody.body_content], + _make_and_meta[makeMeta.make], + _make_and_meta[makeMeta.meta], opts ); static assert(!isTypeTuple!(da)); @@ -113,7 +113,7 @@ template SiSUabstraction() { auto _k = _images; return _k; } - auto opt_action_bool() { + auto opt_action() { bool[string] _k = opts; return _k; } diff --git a/src/sdp/ao/abstraction_summary.d b/src/sdp/ao/abstraction_summary.d index 2cc6967..2b909c7 100644 --- a/src/sdp/ao/abstraction_summary.d +++ b/src/sdp/ao/abstraction_summary.d @@ -20,7 +20,7 @@ template SiSUabstractionSummary() { std.conv : to; mixin InternalMarkup; auto markup = InlineMarkup(); - if (doc_matters.opt_action_bool["verbose"]) { + if (doc_matters.opt_action["verbose"]) { string[string] check = [ "last_obj_cite_number" : "NA [debug \"checkdoc\" not run]", ]; diff --git a/src/sdp/ao/doc_debugs.d b/src/sdp/ao/doc_debugs.d index d42d903..419f5cd 100644 --- a/src/sdp/ao/doc_debugs.d +++ b/src/sdp/ao/doc_debugs.d @@ -458,10 +458,10 @@ template SiSUdebugs() { ]; } debug(checkdoc) { - if ((doc_matters.opt_action_bool["debug"])) { + if ((doc_matters.opt_action["debug"])) { debug(checkdoc) { if (auto mfn=match(doc_matters.source_filename, rgx.src_fn)) { - if (doc_matters.opt_action_bool["assertions"]) { + if (doc_matters.opt_action["assertions"]) { switch (mfn.captures[2]) { // live manual: case "live-manual.ssm": -- cgit v1.2.3