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 --- org/ao_doc_abstraction.org | 134 ++++++++++++++++++++++----------------------- 1 file changed, 67 insertions(+), 67 deletions(-) (limited to 'org/ao_doc_abstraction.org') diff --git a/org/ao_doc_abstraction.org b/org/ao_doc_abstraction.org index 6a807a2..dae2285 100644 --- a/org/ao_doc_abstraction.org +++ b/org/ao_doc_abstraction.org @@ -128,14 +128,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 +/ <> @@ -665,7 +665,7 @@ if (line.matchFirst(rgx.heading_biblio) 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); @@ -699,7 +699,7 @@ if there is a glossary section you need to: 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, @@ -781,7 +781,7 @@ if there is a blurb section you need to: 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, @@ -821,7 +821,7 @@ if there is a blurb section you need to: 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"; @@ -981,7 +981,7 @@ if (line.matchFirst(rgx.book_index) || 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); #+END_SRC ******* not book index [+1] @@ -1342,7 +1342,7 @@ if (the_document_body_section.length > 0) { #+name: abs_post #+BEGIN_SRC d 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]; @@ -1530,7 +1530,7 @@ auto bi_tuple = 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)); @@ -1843,10 +1843,10 @@ foreach (ref obj; the_document_head_section) { 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 = @@ -1867,10 +1867,10 @@ if (the_table_of_contents_section["scroll"].length > 1) { 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 = @@ -1893,10 +1893,10 @@ if (the_table_of_contents_section["scroll"].length > 1) { 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 = @@ -1924,10 +1924,10 @@ if (the_document_body_section.length > 1) { 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 = @@ -1961,10 +1961,10 @@ if (the_endnotes_section.length > 1) { 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 = @@ -1991,10 +1991,10 @@ if (the_glossary_section.length > 1) { 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 = @@ -2021,10 +2021,10 @@ if (the_bibliography_section.length > 1) { 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 = @@ -2052,10 +2052,10 @@ if (the_bookindex_section["scroll"].length > 1) { 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 = @@ -2081,10 +2081,10 @@ if (the_bookindex_section["scroll"].length > 1) { 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 = @@ -2111,10 +2111,10 @@ if (the_blurb_section.length > 1) { 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 = @@ -2202,10 +2202,10 @@ if (document_the["blurb"].length > 1) { 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"; } @@ -3647,14 +3647,14 @@ auto _book_index_(L,I,O,T,B)( 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)) { @@ -3669,7 +3669,7 @@ auto _book_index_(L,I,O,T,B)( } 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( @@ -3682,8 +3682,8 @@ auto _book_index_(L,I,O,T,B)( /+ 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( @@ -3694,8 +3694,8 @@ auto _book_index_(L,I,O,T,B)( } 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; } } @@ -5852,12 +5852,12 @@ struct BookIndexReportSection { 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; @@ -5874,8 +5874,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_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; @@ -6114,7 +6114,7 @@ struct NotesSection { #+BEGIN_SRC d private auto endnote_objects( int obj_cite_number, - bool[string] opt_action_bool, + bool[string] opt_action, ) in { } @@ -6128,7 +6128,7 @@ struct NotesSection { 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"; @@ -6177,7 +6177,7 @@ struct NotesSection { 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"; -- cgit v1.2.3