diff options
Diffstat (limited to 'src/doc_reform/spine.d')
-rwxr-xr-x | src/doc_reform/spine.d | 113 |
1 files changed, 68 insertions, 45 deletions
diff --git a/src/doc_reform/spine.d b/src/doc_reform/spine.d index 3a64726..7539149 100755 --- a/src/doc_reform/spine.d +++ b/src/doc_reform/spine.d @@ -184,7 +184,9 @@ string program_name = "spine"; "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"], @@ -197,6 +199,7 @@ string program_name = "spine"; "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"], @@ -205,8 +208,9 @@ string program_name = "spine"; "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"], @@ -236,16 +240,12 @@ string program_name = "spine"; "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); @@ -505,6 +505,28 @@ string program_name = "spine"; || 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"] @@ -556,33 +578,53 @@ string program_name = "spine"; ]; 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); + } + 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); + 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 @@ -731,19 +773,6 @@ string program_name = "spine"; } } } - 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"); - } - } if (_manifests.length > 1 // _manifests[0] initialized dummy element && _opt_action.abstraction) { if (_opt_action.parallelise) { // see else @@ -795,20 +824,17 @@ string program_name = "spine"; spineMetaDocSummary!()(doc_abstraction, doc_matters); } /+ ↓ 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); } /+ ↓ 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); } /+ ↓ 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); } @@ -910,20 +936,17 @@ string program_name = "spine"; spineMetaDocSummary!()(doc_abstraction, doc_matters); } /+ ↓ 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); } /+ ↓ 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); } /+ ↓ 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); } |