diff options
Diffstat (limited to 'src/sdp/sdp.d')
-rwxr-xr-x | src/sdp/sdp.d | 169 |
1 files changed, 160 insertions, 9 deletions
diff --git a/src/sdp/sdp.d b/src/sdp/sdp.d index 330fe7a..ac022ba 100755 --- a/src/sdp/sdp.d +++ b/src/sdp/sdp.d @@ -148,6 +148,157 @@ void main(string[] args) { if (helpInfo.helpWanted) { defaultGetoptPrinter("Some information about the program.", helpInfo.options); } + struct OptActions { + auto assertions() { + auto _k = opts["assertions"]; + return _k; + } + auto concordance() { + auto _k = opts["concordance"]; + return _k; + } + auto debug_do() { + auto _k = opts["debug"]; + return _k; + } + auto digest() { + auto _k = opts["digest"]; + return _k; + } + auto docbook() { + auto _k = opts["docbook"]; + return _k; + } + auto epub() { + auto _k = opts["epub"]; + return _k; + } + auto html() { + auto _k = opts["html"]; + return _k; + } + auto html_seg() { + auto _k = opts["html-seg"]; + return _k; + } + auto html_scroll() { + auto _k = opts["html-scroll"]; + return _k; + } + auto manifest() { + auto _k = opts["manifest"]; + return _k; + } + auto ocn() { + auto _k = opts["ocn"]; + return _k; + } + auto odt() { + auto _k = opts["odt"]; + return _k; + } + auto pdf() { + auto _k = opts["pdf"]; + return _k; + } + auto postgresql() { + auto _k = opts["postgresql"]; + return _k; + } + auto qrcode() { + auto _k = opts["qrcode"]; + return _k; + } + auto sisupod() { + auto _k = opts["sisupod"]; + return _k; + } + auto source() { + auto _k = opts["source"]; + return _k; + } + auto sqlite_discrete() { + auto _k = opts["sqlite-discrete"]; + return _k; + } + auto sqlite_update() { + auto _k = opts["sqlite-update"]; + return _k; + } + auto sqlite_create() { + auto _k = opts["sqlite-create"]; + return _k; + } + auto sqlite_drop() { + auto _k = opts["sqlite-drop"]; + return _k; + } + auto text() { + auto _k = opts["text"]; + return _k; + } + auto verbose() { + auto _k = opts["verbose"]; + return _k; + } + auto xhtml() { + auto _k = opts["xhtml"]; + return _k; + } + auto xml_dom() { + auto _k = opts["xml-dom"]; + return _k; + } + auto xml_sax() { + auto _k = opts["xml-sax"]; + return _k; + } + auto section_toc() { + auto _k = opts["section_toc"]; + return _k; + } + auto section_body() { + auto _k = opts["section_body"]; + return _k; + } + auto section_endnotes() { + auto _k = opts["section_endnotes"]; + return _k; + } + auto section_glossary() { + auto _k = opts["section_glossary"]; + return _k; + } + auto section_biblio() { + auto _k = opts["section_biblio"]; + return _k; + } + auto section_bookindex() { + auto _k = opts["section_bookindex"]; + return _k; + } + auto section_blurb() { + auto _k = opts["section_blurb"]; + return _k; + } + auto backmatter() { + auto _k = opts["backmatter"]; + return _k; + } + auto skip_output() { + auto _k = opts["skip-output"]; + return _k; + } + auto languages_set() { + auto _k = settings["lang"].split(","); + return _k; + } + auto output_dir_set() { + auto _k = settings["output-dir"]; + return _k; + } + } + auto _opt_action = OptActions(); foreach(arg; args[1..$]) { if (arg.match(rgx.flag_action)) { flag_action ~= " " ~ arg; // flags not taken by getopt @@ -183,8 +334,8 @@ void main(string[] args) { contents_location ~ "»" ); auto contents_location_pth_ = (contents_location).to!string; - auto lang_rgx_ = regex(r"/(" ~ settings["lang"].split(",").join("|") ~ ")/"); - if (settings["lang"] == "all" + auto lang_rgx_ = regex(r"/(" ~ _opt_action.languages_set.join("|") ~ ")/"); + if (_opt_action.languages_set[0] == "all" || (contents_location_pth_).match(lang_rgx_) ) { fns_src ~= (((tmp_dir_).chainPath(contents_location_pth_)).array).to!(char[]); @@ -200,8 +351,8 @@ void main(string[] args) { "pwd" : environment["PWD"], "home" : environment["HOME"], ]; - if (!(opts["skip-output"])) { - outputHubOp!()(opts); + if (!(_opt_action.skip_output)) { + outputHubOp!()(_opt_action); } if (fns_src.length > 0) { foreach(fn_src; fns_src) { @@ -229,23 +380,23 @@ void main(string[] args) { "not a sisu markup filename: «" ~ fn_src ~ "»" ); - auto t = SiSUabstraction!()(fn_src, opts, settings, env); + auto t = SiSUabstraction!()(fn_src, _opt_action, 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["verbose"]) { + if (doc_matters.opt_action.verbose) { SiSUabstractionSummary!()(doc_abstraction, doc_matters); } /+ ↓ debugs +/ - if ((doc_matters.opt_action["debug"]) - || (doc_matters.opt_action["verbose"]) + if ((doc_matters.opt_action.debug_do) + || (doc_matters.opt_action.verbose) ) { SiSUdebugs!()(doc_abstraction, doc_matters); } /+ ↓ output hub +/ - if (!(opts["skip-output"])) { + if (!(doc_matters.opt_action.skip_output)) { outputHub!()(doc_abstraction, doc_matters); } scope(exit) { |