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_debugs.org | 4 +- org/ao_doc_abstraction.org | 134 +++++++++++++++++++-------------------- org/output_hub.org | 69 ++++++++++---------- org/output_sisupod.org | 18 +++--- org/output_xmls.org | 56 ++++++++-------- org/sdp.org | 104 +++++++++++++++--------------- 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 +- src/sdp/output/epub3.d | 20 +++--- src/sdp/output/html.d | 36 +++++------ src/sdp/output/hub.d | 69 ++++++++++---------- src/sdp/output/source_sisupod.d | 18 +++--- src/sdp/sdp.d | 94 +++++++++++++-------------- 15 files changed, 384 insertions(+), 386 deletions(-) diff --git a/org/ao_debugs.org b/org/ao_debugs.org index ee73d1d..be525c3 100644 --- a/org/ao_debugs.org +++ b/org/ao_debugs.org @@ -34,7 +34,7 @@ template SiSUdebugs() { <> <> debug(checkdoc) { - if ((doc_matters.opt_action_bool["debug"])) { + if ((doc_matters.opt_action["debug"])) { <> <> } @@ -745,7 +745,7 @@ debug(summary) { #+BEGIN_SRC d 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/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"; diff --git a/org/output_hub.org b/org/output_hub.org index 0cf300a..5855810 100644 --- a/org/output_hub.org +++ b/org/output_hub.org @@ -52,7 +52,7 @@ import sdp.output, #+name: output_options #+BEGIN_SRC d -if ((doc_matters.opt_action_bool["verbose"])) { +if ((doc_matters.opt_action["verbose"])) { writeln(doc_matters.keys_seq.seg); } #+END_SRC @@ -62,20 +62,20 @@ if ((doc_matters.opt_action_bool["verbose"])) { #+name: output_options #+BEGIN_SRC d -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"); } } #+END_SRC @@ -85,9 +85,9 @@ if ((doc_matters.opt_action_bool["source"]) #+name: output_options #+BEGIN_SRC d -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... "); } } #+END_SRC @@ -96,21 +96,21 @@ if (doc_matters.opt_action_bool["text"]) { #+name: output_options #+BEGIN_SRC d -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"); } } #+END_SRC @@ -119,11 +119,11 @@ if (doc_matters.opt_action_bool["html"]) { #+name: output_options #+BEGIN_SRC d -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"); } } #+END_SRC @@ -131,7 +131,7 @@ if (doc_matters.opt_action_bool["epub"]) { #+name: output_options #+BEGIN_SRC d -if (doc_matters.opt_action_bool["pdf"]) { +if (doc_matters.opt_action["pdf"]) { /+ mixin outputPDF; +/ writeln("pdf processing"); } @@ -141,7 +141,7 @@ if (doc_matters.opt_action_bool["pdf"]) { #+name: output_options #+BEGIN_SRC d -if (doc_matters.opt_action_bool["odt"]) { +if (doc_matters.opt_action["odt"]) { /+ mixin outputODT; +/ writeln("odt processing"); } @@ -151,9 +151,8 @@ if (doc_matters.opt_action_bool["odt"]) { #+name: output_options #+BEGIN_SRC d -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... "); } } #+END_SRC @@ -161,7 +160,7 @@ if (doc_matters.opt_action_bool["sqlite"]) { #+name: output_options #+BEGIN_SRC d -if (doc_matters.opt_action_bool["postgresql"]) { +if (doc_matters.opt_action["postgresql"]) { /+ mixin outputPostgreSQL; +/ writeln("pgsql processing"); } diff --git a/org/output_sisupod.org b/org/output_sisupod.org index f8047e9..338fc33 100644 --- a/org/output_sisupod.org +++ b/org/output_sisupod.org @@ -76,7 +76,7 @@ assert (doc_matters.source_filename.match(rgx.src_fn)); #+name: source_sisupod_mkdirs #+BEGIN_SRC d /+ 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; } @@ -123,10 +123,10 @@ auto fn_sisupod = pth_sisupod.sisupod_filename(doc_matters.source_filename); 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(); @@ -143,10 +143,10 @@ auto fn_sisupod = pth_sisupod.sisupod_filename(doc_matters.source_filename); 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(); @@ -162,10 +162,10 @@ auto fn_sisupod = pth_sisupod.sisupod_filename(doc_matters.source_filename); 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(); @@ -197,10 +197,10 @@ auto fn_sisupod = pth_sisupod.sisupod_filename(doc_matters.source_filename); 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/org/output_xmls.org b/org/output_xmls.org index d8681fb..ae58b4b 100644 --- a/org/output_xmls.org +++ b/org/output_xmls.org @@ -1321,14 +1321,14 @@ void scroll(D,I)( 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; @@ -1345,7 +1345,7 @@ void scroll(D,I)( 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; @@ -1374,14 +1374,14 @@ void scroll(D,I)( 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; @@ -1411,14 +1411,14 @@ void scroll(D,I)( 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; @@ -1427,7 +1427,7 @@ void scroll(D,I)( 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); @@ -1548,13 +1548,13 @@ void seg(D,I)( 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; @@ -1571,14 +1571,14 @@ void seg(D,I)( 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; @@ -1594,7 +1594,7 @@ void seg(D,I)( 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; @@ -1632,14 +1632,14 @@ void seg(D,I)( 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; @@ -1675,14 +1675,14 @@ void seg(D,I)( 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; @@ -1691,7 +1691,7 @@ void seg(D,I)( case "comment": break; default: - if ((doc_matters.opt_action_bool["debug"])) { + if ((doc_matters.opt_action["debug"])) { writeln(__FILE__, ":", __LINE__, ": ", obj.use); } break; @@ -2193,13 +2193,13 @@ void outputEPub3(D,I)( 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; @@ -2217,14 +2217,14 @@ void outputEPub3(D,I)( 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; @@ -2240,7 +2240,7 @@ void outputEPub3(D,I)( 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; @@ -2279,14 +2279,14 @@ void outputEPub3(D,I)( 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; @@ -2322,14 +2322,14 @@ void outputEPub3(D,I)( 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; @@ -2338,7 +2338,7 @@ void outputEPub3(D,I)( 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/org/sdp.org b/org/sdp.org index 9280f1d..4a7e848 100644 --- a/org/sdp.org +++ b/org/sdp.org @@ -208,7 +208,7 @@ look into using getopt #+NAME: sdp_args #+BEGIN_SRC d -bool[string] _opt_action_bool = [ +bool[string] opts = [ "assertions" : false, "concordance" : false, "debug" : false, @@ -216,8 +216,8 @@ bool[string] _opt_action_bool = [ "docbook" : false, "epub" : false, "html" : false, - "html_seg" : false, - "html_scroll" : false, + "html-seg" : false, + "html-scroll" : false, "manifest" : false, "ocn" : true, "odt" : false, @@ -230,8 +230,8 @@ bool[string] _opt_action_bool = [ "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, @@ -240,50 +240,50 @@ bool[string] _opt_action_bool = [ "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)) { @@ -353,7 +353,7 @@ enforce( #+NAME: sdp_abstraction #+BEGIN_SRC d 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]; @@ -366,7 +366,7 @@ auto doc_matters = t[dAM.matters]; #+NAME: sdp_each_file_do_debugs_checkdoc #+BEGIN_SRC d /+ ↓ debugs +/ -if (doc_matters.opt_action_bool["verbose"]) { +if (doc_matters.opt_action["verbose"]) { SiSUabstractionSummary!()(doc_abstraction, doc_matters); } #+END_SRC @@ -376,8 +376,8 @@ if (doc_matters.opt_action_bool["verbose"]) { #+NAME: sdp_each_file_do_debugs_checkdoc #+BEGIN_SRC d /+ ↓ 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); } @@ -389,7 +389,7 @@ if ((doc_matters.opt_action_bool["debug"]) #+NAME: sdp_each_file_do_selected_output #+BEGIN_SRC d /+ ↓ output hub +/ -if (!(_opt_action_bool["skip_output"])) { +if (!(opts["skip-output"])) { outputHub!()(doc_abstraction, doc_matters); } #+END_SRC @@ -510,9 +510,9 @@ static assert(_make_and_meta.length==2); #+BEGIN_SRC d /+ ↓ 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)); @@ -579,7 +579,7 @@ struct DocumentMatters { auto _k = _images; return _k; } - auto opt_action_bool() { + auto opt_action() { bool[string] _k = opts; return _k; } @@ -604,7 +604,7 @@ template SiSUabstractionSummary() { <> mixin InternalMarkup; <> - if (doc_matters.opt_action_bool["verbose"]) { + if (doc_matters.opt_action["verbose"]) { <> } } 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) { -- cgit v1.2.3