diff options
author | Ralph Amissah <ralph@amissah.com> | 2017-06-06 17:54:49 -0400 |
---|---|---|
committer | Ralph Amissah <ralph@amissah.com> | 2019-04-10 15:14:14 -0400 |
commit | 25c30732826b75420bab6287bfe7cbbc9f75e3b5 (patch) | |
tree | 58bfa09ed313b15c79fdcfd564a357c886a0d3f0 /src/sdp | |
parent | top banner with previous next navigation bar with svg buttons (diff) |
getopt, fixes, & naming command line options related
Diffstat (limited to 'src/sdp')
-rw-r--r-- | src/sdp/ao/abstract_doc_source.d | 134 | ||||
-rw-r--r-- | src/sdp/ao/abstraction.d | 8 | ||||
-rw-r--r-- | src/sdp/ao/abstraction_summary.d | 2 | ||||
-rw-r--r-- | src/sdp/ao/doc_debugs.d | 4 | ||||
-rw-r--r-- | src/sdp/output/epub3.d | 20 | ||||
-rw-r--r-- | src/sdp/output/html.d | 36 | ||||
-rw-r--r-- | src/sdp/output/hub.d | 69 | ||||
-rw-r--r-- | src/sdp/output/source_sisupod.d | 18 | ||||
-rwxr-xr-x | src/sdp/sdp.d | 94 |
9 files changed, 192 insertions, 193 deletions
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": diff --git a/src/sdp/output/epub3.d b/src/sdp/output/epub3.d index 00814d4..25f25d5 100644 --- a/src/sdp/output/epub3.d +++ b/src/sdp/output/epub3.d @@ -356,13 +356,13 @@ template outputEPub3() { doc_epub3_endnotes[segment_filename] ~= t[1]; break; case 8: .. case 9: - if ((doc_matters.opt_action_bool["debug"])) { + if ((doc_matters.opt_action["debug"])) { writeln(__FILE__, ":", __LINE__, ": ", obj.is_a, ": ", obj.heading_lev_markup); writeln(__FILE__, ":", __LINE__, ": ", obj.text); } break; default: - if ((doc_matters.opt_action_bool["debug"])) { + if ((doc_matters.opt_action["debug"])) { writeln(__FILE__, ":", __LINE__, ": ", obj.is_a, ": ", obj.heading_lev_markup); } break; @@ -380,14 +380,14 @@ template outputEPub3() { doc_epub3_endnotes[segment_filename] ~= t[1]; break; default: - if ((doc_matters.opt_action_bool["debug"])) { + if ((doc_matters.opt_action["debug"])) { writeln(__FILE__, ":", __LINE__, ": ", obj.is_a); } break; } break; default: - if ((doc_matters.opt_action_bool["debug"])) { + if ((doc_matters.opt_action["debug"])) { writeln(__FILE__, ":", __LINE__, ": ", obj.is_of); } break; @@ -403,7 +403,7 @@ template outputEPub3() { doc_epub3_endnotes[segment_filename] ~= t[1]; break; default: - if ((doc_matters.opt_action_bool["debug"])) { + if ((doc_matters.opt_action["debug"])) { writeln(__FILE__, ":", __LINE__, ": ", obj.is_a); } break; @@ -442,14 +442,14 @@ template outputEPub3() { doc_epub3_endnotes[segment_filename] ~= t[1]; break; default: - if ((doc_matters.opt_action_bool["debug"])) { + if ((doc_matters.opt_action["debug"])) { writeln(__FILE__, ":", __LINE__, ": ", obj.is_a); } break; } break; default: - if ((doc_matters.opt_action_bool["debug"])) { + if ((doc_matters.opt_action["debug"])) { writeln(__FILE__, ":", __LINE__, ": ", obj.is_of); } break; @@ -485,14 +485,14 @@ template outputEPub3() { doc_epub3_endnotes[segment_filename] ~= t[1]; break; default: - if ((doc_matters.opt_action_bool["debug"])) { + if ((doc_matters.opt_action["debug"])) { writeln(__FILE__, ":", __LINE__, ": ", obj.is_a); } break; } break; default: - if ((doc_matters.opt_action_bool["debug"])) { + if ((doc_matters.opt_action["debug"])) { writeln(__FILE__, ":", __LINE__, ": ", obj.is_of); } break; @@ -501,7 +501,7 @@ template outputEPub3() { case "comment": break; default: - if ((doc_matters.opt_action_bool["debug"])) { + if ((doc_matters.opt_action["debug"])) { writeln(__FILE__, ":", __LINE__, ": ", obj.use); } break; diff --git a/src/sdp/output/html.d b/src/sdp/output/html.d index b12be65..8903e51 100644 --- a/src/sdp/output/html.d +++ b/src/sdp/output/html.d @@ -37,14 +37,14 @@ template outputHTML() { doc_html ~= xhtml_format.para_scroll(obj, _txt, suffix); break; default: - if ((doc_matters.opt_action_bool["debug"])) { + if ((doc_matters.opt_action["debug"])) { writeln(__FILE__, ":", __LINE__, ": ", obj.is_a); } break; } break; default: - if ((doc_matters.opt_action_bool["debug"])) { + if ((doc_matters.opt_action["debug"])) { writeln(__FILE__, ":", __LINE__, ": ", obj.is_of); } break; @@ -61,7 +61,7 @@ template outputHTML() { doc_html ~= xhtml_format.para_scroll(obj, _txt, suffix); break; default: - if ((doc_matters.opt_action_bool["debug"])) { + if ((doc_matters.opt_action["debug"])) { writeln(__FILE__, ":", __LINE__, ": ", obj.is_a); } break; @@ -90,14 +90,14 @@ template outputHTML() { doc_html ~= xhtml_format.table(obj, _txt); break; default: - if ((doc_matters.opt_action_bool["debug"])) { + if ((doc_matters.opt_action["debug"])) { writeln(__FILE__, ":", __LINE__, ": ", obj.is_a); } break; } break; default: - if ((doc_matters.opt_action_bool["debug"])) { + if ((doc_matters.opt_action["debug"])) { writeln(__FILE__, ":", __LINE__, ": ", obj.is_of); } break; @@ -127,14 +127,14 @@ template outputHTML() { doc_html ~= xhtml_format.para_scroll(obj, _txt, suffix); break; default: - if ((doc_matters.opt_action_bool["debug"])) { + if ((doc_matters.opt_action["debug"])) { writeln(__FILE__, ":", __LINE__, ": ", obj.is_a); } break; } break; default: - if ((doc_matters.opt_action_bool["debug"])) { + if ((doc_matters.opt_action["debug"])) { writeln(__FILE__, ":", __LINE__, ": ", obj.is_of); } break; @@ -143,7 +143,7 @@ template outputHTML() { case "comment": break; default: - if ((doc_matters.opt_action_bool["debug"])) { + if ((doc_matters.opt_action["debug"])) { writeln(__FILE__, ":", __LINE__, ": ", obj.use); writeln(__FILE__, ":", __LINE__, ": ", obj.is_a); writeln(__FILE__, ":", __LINE__, ": ", obj.text); @@ -251,13 +251,13 @@ template outputHTML() { doc_html_endnotes[segment_filename] ~= t[1]; break; case 8: .. case 9: - if ((doc_matters.opt_action_bool["debug"])) { + if ((doc_matters.opt_action["debug"])) { writeln(__FILE__, ":", __LINE__, ": ", obj.is_a, ": ", obj.heading_lev_markup); writeln(__FILE__, ":", __LINE__, ": ", obj.text); } break; default: - if ((doc_matters.opt_action_bool["debug"])) { + if ((doc_matters.opt_action["debug"])) { writeln(__FILE__, ":", __LINE__, ": ", obj.is_a, ": ", obj.heading_lev_markup); } break; @@ -274,14 +274,14 @@ template outputHTML() { doc_html[segment_filename] ~= to!string(t[0]); break; default: - if ((doc_matters.opt_action_bool["debug"])) { + if ((doc_matters.opt_action["debug"])) { writeln(__FILE__, ":", __LINE__, ": ", obj.is_a); } break; } break; default: - if ((doc_matters.opt_action_bool["debug"])) { + if ((doc_matters.opt_action["debug"])) { writeln(__FILE__, ":", __LINE__, ": ", obj.is_a); } break; @@ -297,7 +297,7 @@ template outputHTML() { doc_html_endnotes[segment_filename] ~= t[1]; break; default: - if ((doc_matters.opt_action_bool["debug"])) { + if ((doc_matters.opt_action["debug"])) { writeln(__FILE__, ":", __LINE__, ": ", obj.is_a); } break; @@ -335,14 +335,14 @@ template outputHTML() { doc_html_endnotes[segment_filename] ~= ""; break; default: - if ((doc_matters.opt_action_bool["debug"])) { + if ((doc_matters.opt_action["debug"])) { writeln(__FILE__, ":", __LINE__, ": ", obj.is_a); } break; } break; default: - if ((doc_matters.opt_action_bool["debug"])) { + if ((doc_matters.opt_action["debug"])) { writeln(__FILE__, ":", __LINE__, ": ", obj.is_of); } break; @@ -378,14 +378,14 @@ template outputHTML() { doc_html_endnotes[segment_filename] ~= t[1]; break; default: - if ((doc_matters.opt_action_bool["debug"])) { + if ((doc_matters.opt_action["debug"])) { writeln(__FILE__, ":", __LINE__, ": ", obj.is_a); } break; } break; default: - if ((doc_matters.opt_action_bool["debug"])) { + if ((doc_matters.opt_action["debug"])) { writeln(__FILE__, ":", __LINE__, ": ", obj.is_of); } break; @@ -394,7 +394,7 @@ template outputHTML() { case "comment": break; default: - if ((doc_matters.opt_action_bool["debug"])) { + if ((doc_matters.opt_action["debug"])) { writeln(__FILE__, ":", __LINE__, ": ", obj.use); } break; diff --git a/src/sdp/output/hub.d b/src/sdp/output/hub.d index 79b8996..fd64851 100644 --- a/src/sdp/output/hub.d +++ b/src/sdp/output/hub.d @@ -14,64 +14,63 @@ template outputHub() { void outputHub(D,I)(D doc_abstraction, I doc_matters) { mixin SiSUoutputRgxInit; auto rgx = Rgx(); - if ((doc_matters.opt_action_bool["verbose"])) { + if ((doc_matters.opt_action["verbose"])) { writeln(doc_matters.keys_seq.seg); } - if ((doc_matters.opt_action_bool["source"]) - || (doc_matters.opt_action_bool["sisupod"])) { - if ((doc_matters.opt_action_bool["verbose"]) - && (doc_matters.opt_action_bool["source"])) - { write("sisu source processing... "); } - if ((doc_matters.opt_action_bool["verbose"]) - && (doc_matters.opt_action_bool["sisupod"])) - { write("sisupod source processing... "); } + if ((doc_matters.opt_action["source"]) + || (doc_matters.opt_action["sisupod"])) { + if ((doc_matters.opt_action["verbose"]) + && (doc_matters.opt_action["source"])) + { writeln("sisu source processing... "); } + if ((doc_matters.opt_action["verbose"]) + && (doc_matters.opt_action["sisupod"])) + { writeln("sisupod source processing... "); } SiSUpod!()(doc_matters); - if ((doc_matters.opt_action_bool["verbose"]) - && (doc_matters.opt_action_bool["source"])) + if ((doc_matters.opt_action["verbose"]) + && (doc_matters.opt_action["source"])) { writeln("sisu source done"); } - if ((doc_matters.opt_action_bool["verbose"]) - && (doc_matters.opt_action_bool["sisupod"])) + if ((doc_matters.opt_action["verbose"]) + && (doc_matters.opt_action["sisupod"])) { writeln("sisupod done"); } } - if (doc_matters.opt_action_bool["text"]) { + if (doc_matters.opt_action["text"]) { /+ mixin outputText; +/ - writeln("text processing"); + if ((doc_matters.opt_action["verbose"])) { writeln("text processing... "); } } - if (doc_matters.opt_action_bool["html"]) { - if ((doc_matters.opt_action_bool["verbose"])) { write("html scroll processing... "); } + if (doc_matters.opt_action["html"]) { + if ((doc_matters.opt_action["verbose"])) { writeln("html scroll processing... "); } outputHTML!().scroll(doc_abstraction, doc_matters); - if ((doc_matters.opt_action_bool["verbose"])) { writeln("html scroll done"); } - if ((doc_matters.opt_action_bool["verbose"])) { write("html seg processing... "); } + if ((doc_matters.opt_action["verbose"])) { writeln("html scroll done"); } + if ((doc_matters.opt_action["verbose"])) { writeln("html seg processing... "); } outputHTML!().seg(doc_abstraction, doc_matters); - if ((doc_matters.opt_action_bool["verbose"])) { writeln("html seg done"); } - } else if (doc_matters.opt_action_bool["html_seg"]) { - if ((doc_matters.opt_action_bool["verbose"])) { write("html seg processing... "); } + if ((doc_matters.opt_action["verbose"])) { writeln("html seg done"); } + } else if (doc_matters.opt_action["html-seg"]) { + if ((doc_matters.opt_action["verbose"])) { writeln("html seg processing... "); } outputHTML!().seg(doc_abstraction, doc_matters); - if ((doc_matters.opt_action_bool["verbose"])) { writeln("html seg done"); } - } else if (doc_matters.opt_action_bool["html_scroll"]) { - if ((doc_matters.opt_action_bool["verbose"])) { write("html scroll processing... "); } + if ((doc_matters.opt_action["verbose"])) { writeln("html seg done"); } + } else if (doc_matters.opt_action["html-scroll"]) { + if ((doc_matters.opt_action["verbose"])) { writeln("html scroll processing... "); } outputHTML!().scroll(doc_abstraction, doc_matters); - if ((doc_matters.opt_action_bool["verbose"])) { writeln("html scroll done"); } + if ((doc_matters.opt_action["verbose"])) { writeln("html scroll done"); } } - if (doc_matters.opt_action_bool["epub"]) { - if ((doc_matters.opt_action_bool["verbose"])) { write("epub3 processing... "); } + if (doc_matters.opt_action["epub"]) { + if ((doc_matters.opt_action["verbose"])) { writeln("epub3 processing... "); } outputEPub3!()(doc_abstraction, doc_matters); // epub.css_write; - if ((doc_matters.opt_action_bool["verbose"])) { writeln("epub3 done"); } + if ((doc_matters.opt_action["verbose"])) { writeln("epub3 done"); } } - if (doc_matters.opt_action_bool["pdf"]) { + if (doc_matters.opt_action["pdf"]) { /+ mixin outputPDF; +/ writeln("pdf processing"); } - if (doc_matters.opt_action_bool["odt"]) { + if (doc_matters.opt_action["odt"]) { /+ mixin outputODT; +/ writeln("odt processing"); } - if (doc_matters.opt_action_bool["sqlite"]) { - /+ mixin outputSQLite; +/ - writeln("sqlite processing"); + if (doc_matters.opt_action["sqlite"]) { + if ((doc_matters.opt_action["verbose"])) { writeln("sqlite processing... "); } } - if (doc_matters.opt_action_bool["postgresql"]) { + if (doc_matters.opt_action["postgresql"]) { /+ mixin outputPostgreSQL; +/ writeln("pgsql processing"); } diff --git a/src/sdp/output/source_sisupod.d b/src/sdp/output/source_sisupod.d index 6c326ac..bb8ea80 100644 --- a/src/sdp/output/source_sisupod.d +++ b/src/sdp/output/source_sisupod.d @@ -27,7 +27,7 @@ template SiSUpod() { assert (doc_matters.source_filename.match(rgx.src_fn)); try { /+ create directory structure +/ - if (doc_matters.opt_action_bool["source"]) { + if (doc_matters.opt_action["source"]) { if (!exists(pth_sisupod_filesystem.text_root(doc_matters.source_filename))) { pth_sisupod_filesystem.text_root(doc_matters.source_filename).mkdirRecurse; } @@ -68,10 +68,10 @@ template SiSUpod() { auto fn_out = pth_sisupod.image_root(doc_matters.source_filename).to!string ~ "/" ~ image; auto fn_out_filesystem = pth_sisupod_filesystem.image_root(doc_matters.source_filename).to!string ~ "/" ~ image; if (exists(fn_src)) { - if (doc_matters.opt_action_bool["source"]) { + if (doc_matters.opt_action["source"]) { fn_src.copy(fn_out_filesystem); } - if (doc_matters.opt_action_bool["sisupod"]) { + if (doc_matters.opt_action["sisupod"]) { auto zip_arc_member_file = new ArchiveMember(); zip_arc_member_file.name = fn_out; auto zip_data = new OutBuffer(); @@ -88,10 +88,10 @@ template SiSUpod() { auto fn_out = pth_sisupod.conf_root(doc_matters.source_filename).to!string ~ "/" ~ "sisu_document_make"; auto fn_out_filesystem = pth_sisupod_filesystem.conf_root(doc_matters.source_filename).to!string ~ "/" ~ "sisu_document_make"; if (exists(fn_src)) { - if (doc_matters.opt_action_bool["source"]) { + if (doc_matters.opt_action["source"]) { fn_src.copy(fn_out_filesystem); } - if (doc_matters.opt_action_bool["sisupod"]) { + if (doc_matters.opt_action["sisupod"]) { auto zip_arc_member_file = new ArchiveMember(); zip_arc_member_file.name = fn_out; auto zip_data = new OutBuffer(); @@ -107,10 +107,10 @@ template SiSUpod() { auto fn_out = pth_sisupod.fn_doc(doc_matters.source_filename).to!string; auto fn_out_filesystem = pth_sisupod_filesystem.fn_doc(doc_matters.source_filename).to!string; if (exists(fn_src)) { - if (doc_matters.opt_action_bool["source"]) { + if (doc_matters.opt_action["source"]) { fn_src.copy(fn_out_filesystem); } - if (doc_matters.opt_action_bool["sisupod"]) { + if (doc_matters.opt_action["sisupod"]) { auto zip_arc_member_file = new ArchiveMember(); zip_arc_member_file.name = fn_out; auto zip_data = new OutBuffer(); @@ -142,10 +142,10 @@ template SiSUpod() { insert_file, ).to!string; if (exists(fn_src)) { - if (doc_matters.opt_action_bool["source"]) { + if (doc_matters.opt_action["source"]) { fn_src.copy(fn_out_filesystem); } - if (doc_matters.opt_action_bool["sisupod"]) { + if (doc_matters.opt_action["sisupod"]) { auto zip_arc_member_file = new ArchiveMember(); zip_arc_member_file.name = insert_file; auto zip_data = new OutBuffer(); diff --git a/src/sdp/sdp.d b/src/sdp/sdp.d index 234bc3f..3816f9b 100755 --- a/src/sdp/sdp.d +++ b/src/sdp/sdp.d @@ -59,7 +59,7 @@ void main(string[] args) { ); } } - bool[string] _opt_action_bool = [ + bool[string] opts = [ "assertions" : false, "concordance" : false, "debug" : false, @@ -67,8 +67,8 @@ void main(string[] args) { "docbook" : false, "epub" : false, "html" : false, - "html_seg" : false, - "html_scroll" : false, + "html-seg" : false, + "html-scroll" : false, "manifest" : false, "ocn" : true, "odt" : false, @@ -81,8 +81,8 @@ void main(string[] args) { "text" : false, "verbose" : false, "xhtml" : false, - "xml_dom" : false, - "xml_sax" : false, + "xml-dom" : false, + "xml-sax" : false, "section_toc" : true, "section_body" : true, "section_endnotes" : true, @@ -91,50 +91,50 @@ void main(string[] args) { "section_bookindex" : true, "section_blurb" : true, "backmatter" : true, - "skip_output" : false, + "skip-output" : false, ]; auto helpInfo = getopt(args, std.getopt.config.passThrough, - "assert", "--assert set optional assertions on", &_opt_action_bool["assertions"], - "concordance", "--concordance file for document", &_opt_action_bool["concordance"], - "debug", "--debug only relevant when debug options compiled in", &_opt_action_bool["debug"], - "digest", "--digest hash digest for each object", &_opt_action_bool["digest"], - "docbook", "--docbook process docbook output", &_opt_action_bool["docbook"], - "epub", "--epub process epub output", &_opt_action_bool["epub"], - "html", "--html process html output", &_opt_action_bool["html"], - "html_seg", "--html-seg process html output", &_opt_action_bool["html_seg"], - "html_scroll", "--html-seg process html output", &_opt_action_bool["html_scroll"], - "manifest", "--manifest process manifest output", &_opt_action_bool["manifest"], - "ocn", "--ocn object cite numbers (default)", &_opt_action_bool["ocn"], - "odf", "--odf process odf:odt output", &_opt_action_bool["odt"], - "odt", "--odt process odf:odt output", &_opt_action_bool["odt"], - "pdf", "--pdf process pdf output", &_opt_action_bool["pdf"], - "pg", "--pg process postgresql output", &_opt_action_bool["postgresql"], - "postgresql", "--postgresql process postgresql output", &_opt_action_bool["postgresql"], - "qrcode", "--qrcode with document metadata", &_opt_action_bool["qrcode"], - "sisupod", "--sisupod sisupod source content bundled", &_opt_action_bool["sisupod"], - "source", "--source markup source text content", &_opt_action_bool["source"], - "sqlite", "--sqlite process sqlite output", &_opt_action_bool["sqlite"], - "text", "--text process text output", &_opt_action_bool["text"], - "txt", "--txt process text output", &_opt_action_bool["text"], - "verbose|v", "--verbose output to terminal", &_opt_action_bool["verbose"], - "xhtml", "--xhtml process xhtml output", &_opt_action_bool["xhtml"], - "xml-dom", "--xml-dom process xml dom output", &_opt_action_bool["xml_dom"], - "xml-sax", "--xml-sax process xml sax output", &_opt_action_bool["xml_sax"], - "section-toc", "--section-toc process table of contents (default)", &_opt_action_bool["section_toc"], - "section-body", "--section-body process document body (default)", &_opt_action_bool["section_body"], - "section-endnotes", "--section-endnotes process document endnotes (default)", &_opt_action_bool["section_endnotes"], - "section-glossary", "--section-glossary process document glossary (default)", &_opt_action_bool["section_glossary"], - "section-biblio", "--section-biblio process document biblio (default)", &_opt_action_bool["section_biblio"], - "section-bookindex", "--section-bookindex process document bookindex (default)", &_opt_action_bool["section_bookindex"], - "section-blurb", "--section-blurb process document blurb (default)", &_opt_action_bool["section_blurb"], - "backmatter", "--section-backmatter process document backmatter (default)", &_opt_action_bool["backmatter"], - "skip_output", "--skip-output", &_opt_action_bool["skip_output"], + "assert", "--assert set optional assertions on", &opts["assertions"], + "concordance", "--concordance file for document", &opts["concordance"], + "debug", "--debug only relevant when debug options compiled in", &opts["debug"], + "digest", "--digest hash digest for each object", &opts["digest"], + "docbook", "--docbook process docbook output", &opts["docbook"], + "epub", "--epub process epub output", &opts["epub"], + "html", "--html process html output", &opts["html"], + "html-seg", "--html-seg process html output", &opts["html-seg"], + "html-scroll", "--html-seg process html output", &opts["html-scroll"], + "manifest", "--manifest process manifest output", &opts["manifest"], + "ocn", "--ocn object cite numbers (default)", &opts["ocn"], + "odf", "--odf process odf:odt output", &opts["odt"], + "odt", "--odt process odf:odt output", &opts["odt"], + "pdf", "--pdf process pdf output", &opts["pdf"], + "pg", "--pg process postgresql output", &opts["postgresql"], + "postgresql", "--postgresql process postgresql output", &opts["postgresql"], + "qrcode", "--qrcode with document metadata", &opts["qrcode"], + "sisupod", "--sisupod sisupod source content bundled", &opts["sisupod"], + "source", "--source markup source text content", &opts["source"], + "sqlite", "--sqlite process sqlite output", &opts["sqlite"], + "text", "--text process text output", &opts["text"], + "txt", "--txt process text output", &opts["text"], + "verbose|v", "--verbose output to terminal", &opts["verbose"], + "xhtml", "--xhtml process xhtml output", &opts["xhtml"], + "xml-dom", "--xml-dom process xml dom output", &opts["xml-dom"], + "xml-sax", "--xml-sax process xml sax output", &opts["xml-sax"], + "section-toc", "--section-toc process table of contents (default)", &opts["section_toc"], + "section-body", "--section-body process document body (default)", &opts["section_body"], + "section-endnotes", "--section-endnotes process document endnotes (default)", &opts["section_endnotes"], + "section-glossary", "--section-glossary process document glossary (default)", &opts["section_glossary"], + "section-biblio", "--section-biblio process document biblio (default)", &opts["section_biblio"], + "section-bookindex", "--section-bookindex process document bookindex (default)", &opts["section_bookindex"], + "section-blurb", "--section-blurb process document blurb (default)", &opts["section_blurb"], + "backmatter", "--section-backmatter process document backmatter (default)", &opts["backmatter"], + "skip-output", "--skip-output", &opts["skip-output"], ); if (helpInfo.helpWanted) { defaultGetoptPrinter("Some information about the program.", helpInfo.options); } - foreach(arg; args) { + foreach(arg; args[1..$]) { if (arg.match(rgx.flag_action)) { flag_action ~= " " ~ arg; // flags not taken by getopt } else if (arg.match(rgx.src_pth)) { @@ -177,23 +177,23 @@ void main(string[] args) { "not a sisu markup filename" ); auto t = - SiSUabstraction!()(fn_src, _opt_action_bool, env); + SiSUabstraction!()(fn_src, opts, env); static assert(!isTypeTuple!(t)); static assert(t.length==2); auto doc_abstraction = t[dAM.abstraction]; auto doc_matters = t[dAM.matters]; /+ ↓ debugs +/ - if (doc_matters.opt_action_bool["verbose"]) { + if (doc_matters.opt_action["verbose"]) { SiSUabstractionSummary!()(doc_abstraction, doc_matters); } /+ ↓ debugs +/ - if ((doc_matters.opt_action_bool["debug"]) - || (doc_matters.opt_action_bool["verbose"]) + if ((doc_matters.opt_action["debug"]) + || (doc_matters.opt_action["verbose"]) ) { SiSUdebugs!()(doc_abstraction, doc_matters); } /+ ↓ output hub +/ - if (!(_opt_action_bool["skip_output"])) { + if (!(opts["skip-output"])) { outputHub!()(doc_abstraction, doc_matters); } scope(exit) { |