From 99de6c56f71bcc0588aa1d888a5278aba15ec237 Mon Sep 17 00:00:00 2001 From: Ralph Amissah Date: Sun, 8 Dec 2019 19:26:13 -0500 Subject: yaml doc headers, protect harvest - protect harvest from missing doc header metadata - title & author required - removed crude rgx yaml check (rely on yaml parser) --- org/spine.org | 57 ++++++++++++++++++++++++++++++--------------------------- 1 file changed, 30 insertions(+), 27 deletions(-) (limited to 'org/spine.org') diff --git a/org/spine.org b/org/spine.org index 42030c7..ced7e3b 100644 --- a/org/spine.org +++ b/org/spine.org @@ -136,7 +136,7 @@ void main(string[] args) { writeln("- ", out_pth.harvest("topics.html")); } } - } + } else { writeln("NO HARVESTS"); } } #+END_SRC @@ -773,21 +773,17 @@ if (_opt_action.config_path_set.empty) { { /+ local site config +/ _conf_file_details = ConfigFilePaths!()(_manifested, _env, _opt_action.config_path_set); auto _config_local_site_struct = readConfigSite!()(_conf_file_details); - if (_config_local_site_struct.filetype == "yaml") { - 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 - break; - } + 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 + break; } } } } else { { /+ local site config +/ auto _config_local_site_struct = readConfigSite!()(_conf_file_details); - if (_config_local_site_struct.filetype == "yaml") { - 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 - } + 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 } } 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, @@ -901,7 +897,6 @@ foreach(arg; args[1..$]) { // refigure how args relate to _opt_action, need path } } } - } catch (ErrnoException ex) { } } @@ -952,10 +947,8 @@ foreach(arg; args[1..$]) { // refigure how args relate to _opt_action, need path #+BEGIN_SRC d { /+ document config/make file +/ auto _config_document_struct = readConfigDoc!()(_manifest, _env); - if (_config_document_struct.filetype == "yaml") { - import doc_reform.meta.conf_make_meta_yaml; - _make_and_meta_struct = _config_document_struct.configParseYAMLreturnSpineStruct!()(_make_and_meta_struct, _manifest); - } + import doc_reform.meta.conf_make_meta_yaml; + _make_and_meta_struct = _config_document_struct.configParseYAMLreturnSpineStruct!()(_make_and_meta_struct, _manifest); } #+END_SRC @@ -1094,7 +1087,19 @@ if (doc_matters.opt.action.show_config #+NAME: spine_each_file_do_debugs_checkdoc #+BEGIN_SRC d if (doc_matters.opt.action.harvest) { - hvst.harvests ~= spineMetaDocHarvest!()(doc_matters, hvst); + auto _hvst = spineMetaDocHarvest!()(doc_matters, hvst); + if ( + _hvst.title.length > 0 + && _hvst.author_surname_fn.length > 0 + ) { + hvst.harvests ~= _hvst; + } else { + if ((doc_matters.opt.action.debug_do) + || (doc_matters.opt.action.very_verbose) + ) { + writeln("WARNING harvest: document header yaml does not contain information related to: title or author: ", _hvst.path_html_segtoc); + } + } } #+END_SRC @@ -1164,7 +1169,7 @@ module doc_reform.meta.metadoc; template spineAbstraction() { <> <> - enum headBody { header, body_content, header_type, insert_file_list, image_list } + enum headBody { header, body_content, insert_file_list, image_list } enum makeMeta { make, meta } enum docAbst { doc_abstract_obj, doc_has } static auto rgx = Rgx(); @@ -1227,7 +1232,7 @@ if ((_opt_action.debug_do) auto _header_body_insertfilelist_imagelist = spineRawMarkupContent!()(_opt_action, _manifest.src.path_and_fn); static assert(!isTypeTuple!(_header_body_insertfilelist_imagelist)); -static assert(_header_body_insertfilelist_imagelist.length==5); +static assert(_header_body_insertfilelist_imagelist.length==4); if ((_opt_action.debug_do) || (_opt_action.very_verbose) ) { @@ -1261,15 +1266,13 @@ if ((_opt_action.debug_do) ) { writeln("step2 commence → (read document header (yaml) return struct)"); } -if (_header_body_insertfilelist_imagelist[headBody.header_type] == "yaml") { - import doc_reform.meta.conf_make_meta_yaml; - _make_and_meta_struct = - docHeaderMakeAndMetaTupYamlExtractAndConvertToStruct!()( - _header_body_insertfilelist_imagelist[headBody.header], - _make_and_meta_struct, - _manifest, - ); -} +import doc_reform.meta.conf_make_meta_yaml; +_make_and_meta_struct = + docHeaderMakeAndMetaTupYamlExtractAndConvertToStruct!()( + _header_body_insertfilelist_imagelist[headBody.header], + _make_and_meta_struct, + _manifest, + ); if ((_opt_action.debug_do) || (_opt_action.very_verbose) ) { -- cgit v1.2.3