From d61236952f19c1a1107a11cf11874104c0fe1a9b Mon Sep 17 00:00:00 2001 From: Ralph Amissah Date: Thu, 14 Nov 2019 11:16:09 -0500 Subject: 0.8.3 (if exists) get site config & output path - read once & read early: - once per batch processing - early (needed by metadata --harvest) --- src/doc_reform/doc_reform.d | 45 ++++++++++++++++++++++++++++++--------------- 1 file changed, 30 insertions(+), 15 deletions(-) (limited to 'src/doc_reform/doc_reform.d') diff --git a/src/doc_reform/doc_reform.d b/src/doc_reform/doc_reform.d index 369c91b..f5b2b86 100755 --- a/src/doc_reform/doc_reform.d +++ b/src/doc_reform/doc_reform.d @@ -532,20 +532,35 @@ void main(string[] args) { ]; auto _manifested = PathMatters!()(_opt_action, _env, ""); auto _manifests = [ _manifested ]; - ConfCompositePlus _make_and_meta_struct_tst; - foreach(arg; args[1..$]) { + ConfComposite _make_and_meta_struct; + if (_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 +/ + auto _config_local_site_struct = readConfigSite!()(_manifested, _env); + if (_config_local_site_struct.filetype == "yaml") { + import doc_reform.meta.conf_make_meta_yaml; + _make_and_meta_struct = _config_local_site_struct.configParseYAMLreturnDocReformStruct!()(_make_and_meta_struct, _manifested); // - get local site config + break; + } + } + } + } + } else { + { /+ local site config +/ + auto _config_local_site_struct = readConfigSite!()(_manifested, _env, _opt_action.config_path_set); + if (_config_local_site_struct.filetype == "yaml") { + import doc_reform.meta.conf_make_meta_yaml; + _make_and_meta_struct = _config_local_site_struct.configParseYAMLreturnDocReformStruct!()(_make_and_meta_struct, _manifested); // - get local site config + } + } + } + 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!()(arg); 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 +/ - _manifested = PathMatters!()(_opt_action, _env, arg); // gather input markup source file names for processing - auto _config_local_site_struct = readConfigSite!()(_manifested, _env); - { /+ local site config +/ - if (_config_local_site_struct.filetype == "yaml") { - import doc_reform.meta.conf_make_meta_yaml; - _make_and_meta_struct_tst = _config_local_site_struct.configParseYAMLreturnDocReformStruct!()(_make_and_meta_struct_tst, _manifested); - } - } if ( /+ pod files +/ !(arg.match(rgx.src_pth_sst_or_ssm)) && _manifest_start.pod_manifest_file_with_path @@ -741,7 +756,7 @@ void main(string[] args) { ) { writeln("--->\nstepX commence → (document abstraction)"); } - auto t = DocReformAbstraction!()(_env, program_info, _opt_action, manifest); + auto t = DocReformAbstraction!()(_env, program_info, _opt_action, manifest, _make_and_meta_struct); static assert(!isTypeTuple!(t)); static assert(t.length==2); auto doc_abstraction = t[dAM.abstraction]; @@ -845,7 +860,7 @@ void main(string[] args) { ) { writeln("--->\nstepX commence → (document abstraction)"); } - auto t = DocReformAbstraction!()(_env, program_info, _opt_action, manifest); + auto t = DocReformAbstraction!()(_env, program_info, _opt_action, manifest, _make_and_meta_struct); static assert(!isTypeTuple!(t)); static assert(t.length==2); auto doc_abstraction = t[dAM.abstraction]; @@ -921,14 +936,14 @@ void main(string[] args) { } if (hvst.harvests.length > 0) { if (_opt_action.harvest_topics) { - DocReformMetaDocHarvestsTopics!()(hvst, _opt_action); + DocReformMetaDocHarvestsTopics!()(hvst, _make_and_meta_struct, _opt_action); } if (_opt_action.harvest_authors) { - DocReformMetaDocHarvestsAuthors!()(hvst.harvests, _opt_action); + DocReformMetaDocHarvestsAuthors!()(hvst.harvests, _make_and_meta_struct, _opt_action); } if (!(_opt_action.quiet)) { import doc_reform.output.paths_output; - auto out_pth = DocReformPathsHTML!()(_opt_action.output_dir_set, ""); + auto out_pth = DocReformPathsHTML!()(_make_and_meta_struct.conf.output_path, ""); if (_opt_action.harvest_authors) { writeln("- ", out_pth.harvest("authors.html")); } -- cgit v1.2.3