aboutsummaryrefslogtreecommitdiffhomepage
path: root/org/spine.org
diff options
context:
space:
mode:
authorRalph Amissah <ralph.amissah@gmail.com>2020-04-04 17:25:56 -0400
committerRalph Amissah <ralph.amissah@gmail.com>2020-05-20 11:27:25 -0400
commitdb96528baa55151826442f61ddfea2cd006ef68d (patch)
tree1325fd983b466d8157248648b6ef8a33beee5a93 /org/spine.org
parentsql, sqlite internal site links (diff)
config, where used without document processing
Diffstat (limited to 'org/spine.org')
-rw-r--r--org/spine.org149
1 files changed, 99 insertions, 50 deletions
diff --git a/org/spine.org b/org/spine.org
index 253720f..f530703 100644
--- a/org/spine.org
+++ b/org/spine.org
@@ -98,7 +98,6 @@ string program_name = "spine";
<<spine_mixin>>
<<spine_init>>
<<spine_args>>
- <<spine_do_selected>>
if (_manifests.length > 1 // _manifests[0] initialized dummy element
&& _opt_action.abstraction) {
if (_opt_action.parallelise) { // see else
@@ -425,7 +424,9 @@ auto helpInfo = getopt(args,
"abstraction", "--abstraction document abstraction ", &opts["abstraction"],
"assert", "--assert set optional assertions on", &opts["assertions"],
"cgi-search-form-codegen", "--cgi-search-form-codegen pre-compiled d code search of specified db", &opts["cgi-search-form-codegen"],
+ "cgi-sqlite-search-filename", "--cgi-sqlite-search-filename=[filename]", &settings["cgi-sqlite-search-filename"],
"concordance", "--concordance file for document", &opts["concordance"],
+ "config", "--config=/path/to/config/file/including/filename", &settings["config"],
"dark", "--dark alternative dark theme", &opts["dark"],
"debug", "--debug", &opts["debug"],
"digest", "--digest hash digest for each object", &opts["digest"],
@@ -438,6 +439,7 @@ auto helpInfo = getopt(args,
"html-link-search", "--html-link-search html embedded search submission", &opts["html-link-search"],
"html-seg", "--html-seg process html output", &opts["html-seg"],
"html-scroll", "--html-seg process html output", &opts["html-scroll"],
+ "lang", "--lang=[lang code e.g. =en or =en,es]", &settings["lang"],
"latex", "--latex output for pdfs", &opts["latex"],
"latex-color-links", "--latex-color-links mono or color links for pdfs", &opts["latex-color-links"],
"light", "--light default light theme", &opts["light"],
@@ -446,8 +448,9 @@ auto helpInfo = getopt(args,
"ocn-off", "--ocn-off object cite numbers", &opts["ocn-off"],
"odf", "--odf open document format text (--odt)", &opts["odf"],
"odt", "--odt open document format text", &opts["odt"],
+ "output", "--output=/path/to/output/dir specify where to place output", &settings["output"],
"parallel", "--parallel parallelisation", &opts["parallel"],
- "parallel-subprocesses", "--parallel-subprocesses nested parallelisation", &opts["parallel-subprocesses"],
+ "parallel-subprocesses", "--parallel-subprocesses nested parallelisation", &opts["parallel-subprocesses"],
"quiet|q", "--quiet output to terminal", &opts["quiet"],
"pdf", "--pdf latex output for pdfs", &opts["pdf"],
"pdf-color-links", "--pdf-color-links mono or color links for pdfs", &opts["pdf-color-links"],
@@ -477,16 +480,12 @@ auto helpInfo = getopt(args,
"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"],
+ "sqlite-db-filename", "--sqlite-db-filename=[filename].sql.db", &settings["sqlite-filename"],
"backmatter", "--section-backmatter process document backmatter (default)", &opts["backmatter"],
"skip-output", "--skip-output", &opts["skip-output"],
"theme-dark", "--theme-dark alternative dark theme", &opts["theme-dark"],
"theme-light", "--theme-light default light theme", &opts["theme-light"],
"workon", "--workon (reserved for some matters under development & testing)", &opts["workon"],
- "cgi-sqlite-search-filename", "--cgi-sqlite-search-filename=[filename]", &settings["cgi-sqlite-search-filename"],
- "config", "--config=/path/to/config/file/including/filename", &settings["config"],
- "output", "--output=/path/to/output/dir specify where to place output", &settings["output"],
- "sqlite-db-filename", "--sqlite-db-filename=[filename].sql.db", &settings["sqlite-db-filename"],
- "lang", "--lang=[lang code e.g. =en or =en,es]", &settings["lang"],
);
if (helpInfo.helpWanted) {
defaultGetoptPrinter("Some information about the program.", helpInfo.options);
@@ -753,6 +752,28 @@ struct OptActions {
|| sqlite_update
) ? true : false;
}
+ @trusted bool require_processing_files() {
+ return (
+ opts["abstraction"]
+ || epub
+ || html
+ || html_seg
+ || html_scroll
+ || latex
+ || odt
+ || manifest
+ || pod
+ || show_make
+ || show_metadata
+ || show_summary
+ || source
+ || source_or_pod
+ || sqlite_discrete
+ || sqlite_update
+ || text
+ || xhtml
+ ) ? true : false;
+ }
@trusted bool meta_processing_general() {
return (
opts["abstraction"]
@@ -811,39 +832,71 @@ auto _env = [
];
#+END_SRC
-*** opt actions on processing files & file paths (pods, src etc.)
+*** get/read site config
#+NAME: spine_args
#+BEGIN_SRC d
auto _manifested = PathMatters!()(_opt_action, _env, "");
auto _manifests = [ _manifested ];
-auto _conf_file_details = ConfigFilePaths!()(_manifested, _env, _opt_action.config_path_set);
-ConfComposite _make_and_meta_struct;
-if (_opt_action.config_path_set.empty) {
+auto _conf_file_details = configFilePaths!()(_manifested, _env, _opt_action.config_path_set);
+ConfComposite _config;
+if (
+ _opt_action.require_processing_files
+ && _opt_action.config_path_set.empty
+) {
foreach(arg; args[1..$]) {
if (!(arg.match(rgx.flag_action))) { /+ cli markup source path +/ // get first input markup source file names for processing
_manifested = PathMatters!()(_opt_action, _env, arg);
{ /+ local site config +/
- _conf_file_details = ConfigFilePaths!()(_manifested, _env, _opt_action.config_path_set);
- auto _config_local_site_struct = readConfigSite!()(_conf_file_details);
+ _conf_file_details = configFilePaths!()(_manifested, _env, _opt_action.config_path_set);
+ auto _config_local_site_struct = readConfigSite!()(_conf_file_details, _opt_action);
import doc_reform.meta.conf_make_meta_yaml;
- _make_and_meta_struct = _config_local_site_struct.configParseYAMLreturnSpineStruct!()(_make_and_meta_struct, _manifested); // - get local site config
+ _config = _config_local_site_struct.configParseYAMLreturnSpineStruct!()(_config, _manifested); // - get local site config
break;
}
}
}
-} else {
- { /+ local site config +/
- auto _config_local_site_struct = readConfigSite!()(_conf_file_details);
- import doc_reform.meta.conf_make_meta_yaml;
- _make_and_meta_struct = _config_local_site_struct.configParseYAMLreturnSpineStruct!()(_make_and_meta_struct, _manifested); // - get local site config
+} else { /+ local site config +/
+ auto _config_local_site_struct = readConfigSite!()(_conf_file_details, _opt_action);
+ import doc_reform.meta.conf_make_meta_yaml;
+ _config = _config_local_site_struct.configParseYAMLreturnSpineStruct!()(_config, _manifested); // - get local site config
+}
+if (_opt_action.show_config) {
+ import doc_reform.meta.metadoc_show_config;
+ spineShowSiteConfig!()(_opt_action, _config);
+}
+#+END_SRC
+
+*** use config for operations that do not require file processing
+
+#+NAME: spine_args
+#+BEGIN_SRC d
+if (!(_opt_action.skip_output)) {
+ if ((_opt_action.debug_do)
+ || (_opt_action.very_verbose)
+ ) {
+ writeln("step0 commence → (without processing files)");
+ }
+ outputHubOp!()(_env, _opt_action, _config);
+ if ((_opt_action.debug_do)
+ || (_opt_action.very_verbose)
+ ) {
+ writeln("- step0 complete");
}
}
-foreach(arg; args[1..$]) { // refigure how args relate to _opt_action, need path from _opt_action or args early _manifested too late, work on (search for PathMatters and .harvest,
- auto _manifest_start = PodManifest!()(_opt_action, arg);
+#+END_SRC
+
+*** opt action on processing files (loop args)
+
+#+NAME: spine_args
+#+BEGIN_SRC d
+ConfComposite _make_and_meta_struct = _config;
+destroy(_config);
+foreach(arg; args[1..$]) {
if (arg.match(rgx.flag_action)) { /+ cli instruction, flag do +/
flag_action ~= " " ~ arg; // flags not taken by getopt
- } else { /+ cli, assumed to be path to source files +/
+ } else if (_opt_action.require_processing_files) { /+ cli, assumed to be path to source files +/
+ auto _manifest_start = PodManifest!()(_opt_action, arg);
if ( /+ pod files +/
!(arg.match(rgx.src_pth_sst_or_ssm))
&& _manifest_start.pod_manifest_file_with_path
@@ -1005,25 +1058,6 @@ foreach(arg; args[1..$]) { // refigure how args relate to _opt_action, need path
}
#+END_SRC
-*** opt actions independent of processing files (no files no processing loop)
-
-#+NAME: spine_do_selected
-#+BEGIN_SRC d
-if (!(_opt_action.skip_output)) {
- if ((_opt_action.debug_do)
- || (_opt_action.very_verbose)
- ) {
- writeln("step0 commence → (without processing files)");
- }
- outputHubOp!()(_env, _opt_action, _make_and_meta_struct);
- if ((_opt_action.debug_do)
- || (_opt_action.very_verbose)
- ) {
- writeln("- step0 complete");
- }
-}
-#+END_SRC
-
** _2. processing: (loop each file)_ [+2] :loop:files:
*** scope (loop) :scope:
@@ -1100,8 +1134,7 @@ if (doc_matters.opt.action.verbose
#+NAME: spine_each_file_do_debugs_checkdoc
#+BEGIN_SRC d
/+ ↓ debugs +/
-if (doc_matters.opt.action.show_metadata
-) {
+if (doc_matters.opt.action.show_metadata) {
import doc_reform.meta.metadoc_show_metadata;
spineShowMetaData!()(doc_matters);
}
@@ -1113,8 +1146,7 @@ if (doc_matters.opt.action.show_metadata
#+NAME: spine_each_file_do_debugs_checkdoc
#+BEGIN_SRC d
/+ ↓ debugs +/
-if (doc_matters.opt.action.show_make
-) {
+if (doc_matters.opt.action.show_make) {
import doc_reform.meta.metadoc_show_make;
spineShowMake!()(doc_matters);
}
@@ -1126,8 +1158,7 @@ if (doc_matters.opt.action.show_make
#+NAME: spine_each_file_do_debugs_checkdoc
#+BEGIN_SRC d
/+ ↓ debugs +/
-if (doc_matters.opt.action.show_config
-) {
+if (doc_matters.opt.action.show_config) {
import doc_reform.meta.metadoc_show_config;
spineShowConfig!()(doc_matters);
}
@@ -1504,13 +1535,31 @@ struct DocumentMatters {
@safe auto sqlite() {
struct SQLite_ {
@safe string filename() {
- return _opt_action.sqlite_filename;
+ string _fn = "";
+ if (_opt_action.sqlite_filename.length > 0) {
+ _fn = _opt_action.sqlite_filename;
+ } else if (_make_and_meta_struct.conf.w_srv_db_sqlite.length > 0) {
+ _fn = _make_and_meta_struct.conf.w_srv_db_sqlite;
+ }
+ return _fn;
}
@safe string cgi_filename() {
- return _opt_action.cgi_sqlite_search_filename;
+ string _fn = "";
+ if (_opt_action.cgi_sqlite_search_filename.length > 0) {
+ _fn = _opt_action.cgi_sqlite_search_filename;
+ } else if (_make_and_meta_struct.conf.w_srv_cgi_search_script.length > 0) {
+ _fn = _make_and_meta_struct.conf.w_srv_cgi_search_script;
+ }
+ return _fn;
}
@safe string cgi_filename_d() {
- return _opt_action.cgi_sqlite_search_filename_d;
+ string _fn = "";
+ if (_opt_action.cgi_sqlite_search_filename_d.length > 0) {
+ _fn = _opt_action.cgi_sqlite_search_filename_d;
+ } else if (_make_and_meta_struct.conf.w_srv_cgi_search_script_raw_fn_d.length > 0) {
+ _fn = _make_and_meta_struct.conf.w_srv_cgi_search_script_raw_fn_d;
+ }
+ return _fn;
}
}
return SQLite_();