diff options
author | Ralph Amissah <ralph.amissah@gmail.com> | 2022-02-22 14:23:35 -0500 |
---|---|---|
committer | Ralph Amissah <ralph.amissah@gmail.com> | 2022-02-23 11:00:55 -0500 |
commit | 614e44ad155e693f82a8228897bba2f4869167dd (patch) | |
tree | 4ba674ba60fb3b00460c37bf7b3f30d3cc9da49d /org/spine.org | |
parent | pod org file, minor (diff) |
rethink verbose & debug flags, introduce show
Diffstat (limited to 'org/spine.org')
-rw-r--r-- | org/spine.org | 175 |
1 files changed, 118 insertions, 57 deletions
diff --git a/org/spine.org b/org/spine.org index ae78e86..1e382e3 100644 --- a/org/spine.org +++ b/org/spine.org @@ -334,13 +334,18 @@ bool[string] opts = [ "concordance" : false, "dark" : false, "debug" : false, - "debug-pod" : false, + "debug-curate" : false, + "debug-curate-authors" : false, + "debug-curate-topics" : false, "debug-epub" : false, "debug-harvest" : false, "debug-html" : false, "debug-latex" : false, "debug-manifest" : false, + "debug-metadata" : false, + "debug-pod" : false, "debug-sqlite" : false, + "debug-stages" : false, "digest" : false, "epub" : false, "curate" : false, @@ -366,10 +371,19 @@ bool[string] opts = [ "quiet" : false, "pod" : false, "serial" : false, - "show-summary" : false, - "show-metadata" : false, - "show-make" : false, "show-config" : false, + "show-curate" : false, + "show-curate-authors" : false, + "show-curate-topics" : false, + "show-epub" : false, + "show-html" : false, + "show-latex" : false, + "show-make" : false, + "show-manifest" : false, + "show-metadata" : false, + "show-pod" : false, + "show-sqlite" : false, + "show-summary" : false, "source" : false, "sqlite-discrete" : false, "sqlite-db-create" : false, @@ -445,14 +459,6 @@ auto helpInfo = getopt(args, "curate-authors", "extract info on authors from document header metadata", &opts["curate-authors"], "curate-topics", "extract info on topics from document header metadata", &opts["curate-topics"], "dark", "alternative dark theme", &opts["dark"], - "debug", "debug", &opts["debug"], - "debug-pod", "debug pod", &opts["debug-pod"], - "debug-epub", "debug epub", &opts["debug-epub"], - "debug-harvest", "debug harvest", &opts["debug-harvest"], - "debug-html", "debug html", &opts["debug-html"], - "debug-latex", "debug latex", &opts["debug-latex"], - "debug-manifest", "debug manifest", &opts["debug-manifest"], - "debug-sqlite", "debug sqlite", &opts["debug-sqlite"], "digest", "hash digest for each object", &opts["digest"], "epub", "process epub output", &opts["epub"], "hide-ocn", "object cite numbers", &opts["hide-ocn"], @@ -487,8 +493,17 @@ auto helpInfo = getopt(args, "serial", "serial processing", &opts["serial"], "skip-output", "skip output", &opts["skip-output"], "show-config", "show config", &opts["show-config"], + "show-curate", "show curate", &opts["show-curate"], + "show-curate-authors", "show curate authors", &opts["show-curate-authors"], + "show-curate-topics", "show curate topics", &opts["show-curate-topics"], + "show-epub", "show epub", &opts["show-epub"], + "show-html", "show html", &opts["show-html"], + "show-latex", "show latex", &opts["show-latex"], "show-make", "show make", &opts["show-make"], + "show-manifest", "show manifest", &opts["show-manifest"], "show-metadata", "show metadata", &opts["show-metadata"], + "show-pod", "show pod", &opts["show-pod"], + "show-sqlite", "show sqlite", &opts["show-sqlite"], "show-summary", "show summary", &opts["show-summary"], "source", "document markup source", &opts["source"], "set-digest", "default hash digest type (e.g. sha256)", &settings["set-digest"], @@ -516,6 +531,19 @@ auto helpInfo = getopt(args, "workon", "(reserved for some matters under development & testing)", &opts["workon"], "xhtml", "xhtml output", &opts["xhtml"], "config", "=/path/to/config/file/including/filename", &settings["config"], + "debug", "debug", &opts["debug"], + "debug-curate", "debug curate", &opts["debug-curate"], + "debug-curate-authors", "debug curate authors", &opts["debug-curate-authors"], + "debug-curate-topics", "debug curate topics", &opts["debug-curate-topics"], + "debug-epub", "debug epub", &opts["debug-epub"], + "debug-harvest", "debug harvest", &opts["debug-harvest"], + "debug-html", "debug html", &opts["debug-html"], + "debug-latex", "debug latex", &opts["debug-latex"], + "debug-manifest", "debug manifest", &opts["debug-manifest"], + "debug-metadata", "debug metadata", &opts["debug-metadata"], + "debug-pod", "debug pod", &opts["debug-pod"], + "debug-sqlite", "debug sqlite", &opts["debug-sqlite"], + "debug-stages", "debug stages", &opts["debug-stages"], // "sqlite-db-filename", "=[filename].sql.db", &settings["sqlite-db-filename"], ); if (helpInfo.helpWanted) { @@ -555,20 +583,19 @@ struct OptActions { } @trusted bool debug_do() { bool _dbg; - if (opts["debug"] - ||opts["debug-epub"] - ||opts["debug-harvest"] - ||opts["debug-html"] - ||opts["debug-latex"] - ||opts["debug-manifest"] - ||opts["debug-sqlite"] - ) { + if (opts["debug"]) { _dbg = true; } else { _dbg = false; } return _dbg; } - @trusted bool debug_do_pod() { - return (opts["debug"] || opts["debug-pod"]) ? true : false; + @trusted bool debug_do_curate() { + return (opts["debug"] || opts["debug-curate"]) ? true : false; + } + @trusted bool debug_do_curate_authors() { + return (opts["debug"] || opts["debug-curate"] || opts["debug-curate-authors"]) ? true : false; + } + @trusted bool debug_do_curate_topics() { + return (opts["debug"] || opts["debug-curate"] || opts["debug-curate-topics"]) ? true : false; } @trusted bool debug_do_epub() { return (opts["debug"] || opts["debug-epub"]) ? true : false; @@ -585,9 +612,18 @@ struct OptActions { @trusted bool debug_do_manifest() { return (opts["debug"] || opts["debug-manifest"]) ? true : false; } + @trusted bool debug_do_metadata() { + return (opts["debug"] || opts["debug-metadata"]) ? true : false; + } + @trusted bool debug_do_pod() { + return (opts["debug"] || opts["debug-pod"]) ? true : false; + } @trusted bool debug_do_sqlite() { return (opts["debug"] || opts["debug-sqlite"]) ? true : false; } + @trusted bool debug_do_stages() { + return (opts["debug"] || opts["debug-stages"]) ? true : false; + } @trusted bool debug_do_xmls() { return (opts["debug"] || opts["debug-html"] || opts["debug-epub"]) ? true : false; } @@ -648,17 +684,44 @@ struct OptActions { @trusted bool pod() { return opts["pod"]; } - @trusted bool show_summary() { - return opts["show-summary"]; + @trusted bool show_config() { + return opts["show-config"]; + } + @trusted bool show_curate() { + return opts["show-curate"]; + } + @trusted bool show_curate_authors() { + return (opts["show-curate"] || opts["show-curate-authors"] || opts["verbose"] || opts["very-verbose"]) ? true : false; + } + @trusted bool show_curate_topics() { + return (opts["show-curate"] || opts["show-curate-topics"] || opts["very-verbose"]) ? true : false; + } + @trusted bool show_epub() { + return opts["show-epub"]; + } + @trusted bool show_html() { + return opts["show-html"]; + } + @trusted bool show_latex() { + return opts["show-latex"]; } @trusted bool show_make() { return opts["show-make"]; } + @trusted bool show_manifest() { + return opts["show-manifest"]; + } @trusted bool show_metadata() { return opts["show-metadata"]; } - @trusted bool show_config() { - return opts["show-config"]; + @trusted bool show_pod() { + return opts["show-pod"]; + } + @trusted bool show_sqlite() { + return (opts["show-sqlite"] || opts["very-verbose"]) ? true : false; + } + @trusted bool show_summary() { + return (opts["show-summary"] || opts["verbose"] || opts["very-verbose"]) ? true : false; } @trusted bool source() { return opts["source"]; @@ -978,13 +1041,13 @@ if (_opt_action.show_config) { #+BEGIN_SRC d if (!(_opt_action.skip_output)) { if ((_opt_action.debug_do) - || (_opt_action.very_verbose) + || (_opt_action.debug_do_stages) ) { writeln("step0 commence → (without processing files)"); } outputHubOp!()(_env, _opt_action, _siteConfig); if ((_opt_action.debug_do) - || (_opt_action.very_verbose) + || (_opt_action.debug_do_stages) ) { writeln("- step0 complete"); } @@ -1210,18 +1273,18 @@ enforce( #+NAME: spine_each_file_do_abstraction #+BEGIN_SRC d if ((_opt_action.debug_do) -|| (_opt_action.very_verbose) + || (_opt_action.debug_do_stages) ) { - writeln("--->\nstepX commence → (document abstraction)"); + writeln("--->\nstepX commence → (document abstraction) [", manifest.src.filename, "]"); } auto t = spineAbstraction!()(_env, program_info, _opt_action, _cfg, manifest, _make_and_meta_struct); static assert(t.length==2); auto doc_abstraction = t[dAM.abstraction]; auto doc_matters = t[dAM.matters]; if ((doc_matters.opt.action.debug_do) -|| (doc_matters.opt.action.very_verbose) + || (_opt_action.debug_do_stages) ) { - writeln("- stepX complete"); + writeln("- stepX complete for [", manifest.src.filename, "]"); } #+END_SRC @@ -1244,9 +1307,7 @@ if ((doc_matters.opt.action.debug_do) #+NAME: spine_each_file_do_debugs_checkdoc_0 #+BEGIN_SRC d /+ ↓ debugs +/ -if (doc_matters.opt.action.verbose - || doc_matters.opt.action.show_summary -) { +if (doc_matters.opt.action.show_summary) { import doc_reform.meta.metadoc_show_summary; spineMetaDocSummary!()(doc_abstraction, doc_matters); } @@ -1302,7 +1363,8 @@ if (doc_matters.opt.action.curate) { hvst.curates ~= _hvst; } else { if ((doc_matters.opt.action.debug_do) - || (doc_matters.opt.action.very_verbose) + || (_opt_action.debug_do_curate) + || (doc_matters.opt.action.very_verbose) ) { writeln("WARNING curate: document header yaml does not contain information related to: title or author: ", _hvst.path_html_segtoc); } @@ -1329,15 +1391,15 @@ if (doc_matters.opt.action.debug_do) { /+ ↓ output hub +/ if (!(doc_matters.opt.action.skip_output)) { if ((_opt_action.debug_do) - || (_opt_action.very_verbose) + || (_opt_action.debug_do_stages) ) { - writeln("step5 commence → (process outputs)"); + writeln("step5 commence → (process outputs) [", manifest.src.filename, "]"); } doc_abstraction.outputHub!()(doc_matters); if ((_opt_action.debug_do) - || (_opt_action.very_verbose) + || (_opt_action.debug_do_stages) ) { - writeln("- step5 complete"); + writeln("- step5 complete for [", manifest.src.filename, "]"); } } #+END_SRC @@ -1440,18 +1502,17 @@ if build source pod requested all information needed to build it available at th /+ ↓ read file (filename with path) +/ /+ ↓ file tuple of header and content +/ if ((_opt_action.debug_do) -|| (_opt_action.very_verbose) + || (_opt_action.debug_do_stages) ) { - writeln("step1 commence → (get document header & body & insert file list & if needed image list)" - ); + writeln("step1 commence → (get document header & body & insert file list & if needed image list) [", _manifest.src.filename, "]"); } auto _header_body_insertfilelist_imagelist = spineRawMarkupContent!()(_opt_action, _manifest.src.path_and_fn); static assert(_header_body_insertfilelist_imagelist.length==4); if ((_opt_action.debug_do) -|| (_opt_action.very_verbose) + || (_opt_action.debug_do_stages) ) { - writeln("- step1 complete"); + writeln("- step1 complete for [", _manifest.src.filename, "]"); } debug(header_and_body) { writeln(header); @@ -1477,9 +1538,9 @@ debug(header_and_body) { #+BEGIN_SRC d /+ ↓ split header into make and meta +/ if ((_opt_action.debug_do) -|| (_opt_action.very_verbose) + || (_opt_action.debug_do_stages) ) { - writeln("step2 commence → (read document header (yaml) return struct)"); + writeln("step2 commence → (read document header (yaml) return struct) [", _manifest.src.filename, "]"); } import doc_reform.meta.conf_make_meta_yaml; _make_and_meta_struct = @@ -1491,9 +1552,9 @@ _make_and_meta_struct = _cfg, ); if ((_opt_action.debug_do) -|| (_opt_action.very_verbose) + || (_opt_action.debug_do_stages) ) { - writeln("- step2 complete"); + writeln("- step2 complete for [", _manifest.src.filename, "]"); } #+END_SRC @@ -1514,9 +1575,9 @@ if ((_opt_action.debug_do) #+BEGIN_SRC d /+ ↓ document abstraction: process document, return abstraction as tuple +/ if ((_opt_action.debug_do) -|| (_opt_action.very_verbose) + || (_opt_action.debug_do_stages) ) { - writeln("step3 commence → (document abstraction (da); da keys; segnames; doc_matters)"); + writeln("step3 commence → (document abstraction (da); da keys; segnames; doc_matters) [", _manifest.src.filename, "]"); } auto da = docAbstraction!()( _header_body_insertfilelist_imagelist[headBody.body_content], @@ -1529,9 +1590,9 @@ static assert(da.length==2); auto doc_abstraction = da[docAbst.doc_abstract_obj]; /+ head ~ toc ~ body ~ endnotes_seg ~ glossary ~ bibliography ~ bookindex ~ blurb; +/ auto _doc_has_struct = da[docAbst.doc_has]; if ((_opt_action.debug_do) -|| (_opt_action.very_verbose) + || (_opt_action.debug_do_stages) ) { - writeln("- step3 complete"); + writeln("- step3 complete for [", _manifest.src.filename, "]"); } #+END_SRC @@ -1545,9 +1606,9 @@ if ((_opt_action.debug_do) #+NAME: spine_each_file_do_document_matters_msg_step4_start #+BEGIN_SRC d if ((_opt_action.debug_do) -|| (_opt_action.very_verbose) + || (_opt_action.debug_do_stages) ) { - writeln("step4 commence → (doc_matters)"); + writeln("step4 commence → (doc_matters) [", _manifest.src.filename, "]"); } #+END_SRC @@ -1738,9 +1799,9 @@ auto doc_matters = DocumentMatters(); #+NAME: spine_each_file_do_document_matters_msg_step4_end #+BEGIN_SRC d if ((_opt_action.debug_do) -|| (_opt_action.very_verbose) + || (_opt_action.debug_do_stages) ) { - writeln("- step4 complete"); + writeln("- step4 complete for [", _manifest.src.filename, "]"); } #+END_SRC |