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) --- org/doc_reform.org | 58 +++++++++++++++++++++++++++++++----------------------- 1 file changed, 33 insertions(+), 25 deletions(-) (limited to 'org/doc_reform.org') diff --git a/org/doc_reform.org b/org/doc_reform.org index 5b44538..0b98147 100644 --- a/org/doc_reform.org +++ b/org/doc_reform.org @@ -28,7 +28,7 @@ struct Version { int minor; int patch; } -enum _ver = Version(0, 8, 2); +enum _ver = Version(0, 8, 3); #+END_SRC ** compilation restrictions (supported compilers) @@ -121,14 +121,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")); } @@ -759,20 +759,35 @@ auto _env = [ #+BEGIN_SRC d 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 @@ -928,7 +943,6 @@ foreach(arg; args[1..$]) { #+NAME: doc_reform_conf_files_in_yaml #+BEGIN_SRC d -ConfCompositePlus _make_and_meta_struct; { /+ document config/make file +/ auto _config_document_struct = readConfigDoc!()(_manifest, _env); if (_config_document_struct.filetype == "yaml") { @@ -936,13 +950,6 @@ ConfCompositePlus _make_and_meta_struct; _make_and_meta_struct = _config_document_struct.configParseYAMLreturnDocReformStruct!()(_make_and_meta_struct, _manifest); } } -{ /+ local site config +/ - auto _config_local_site_struct = readConfigSite!()(_manifest, _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, _manifest); - } -} #+END_SRC *** opt actions independent of processing files (no files no processing loop) @@ -1007,7 +1014,7 @@ if ((_opt_action.debug_do) ) { 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]; @@ -1154,11 +1161,12 @@ template DocReformAbstraction() { enum makeMeta { make, meta } enum docAbst { doc_abstract_obj, doc_has } static auto rgx = Rgx(); - auto DocReformAbstraction(E,P,O,M)( + auto DocReformAbstraction(E,P,O,M,S)( E _env, P program_info, O _opt_action, - M _manifest + M _manifest, + S _make_and_meta_struct ){ <> <> -- cgit v1.2.3