aboutsummaryrefslogtreecommitdiffhomepage
path: root/org/meta_conf_make_meta.org
diff options
context:
space:
mode:
authorRalph Amissah <ralph.amissah@gmail.com>2019-12-08 19:26:13 -0500
committerRalph Amissah <ralph.amissah@gmail.com>2020-01-13 16:06:43 -0500
commit99de6c56f71bcc0588aa1d888a5278aba15ec237 (patch)
treedc064ccaafafac75d40f2022829b10de9d14bec4 /org/meta_conf_make_meta.org
parentsrc without pod.manifest, report on verbose (diff)
yaml doc headers, protect harvest
- protect harvest from missing doc header metadata - title & author required - removed crude rgx yaml check (rely on yaml parser)
Diffstat (limited to 'org/meta_conf_make_meta.org')
-rw-r--r--org/meta_conf_make_meta.org34
1 files changed, 19 insertions, 15 deletions
diff --git a/org/meta_conf_make_meta.org b/org/meta_conf_make_meta.org
index 67bbebe..7075995 100644
--- a/org/meta_conf_make_meta.org
+++ b/org/meta_conf_make_meta.org
@@ -1825,14 +1825,17 @@ static template configParseYAMLreturnSpineStruct() {
CCm _make_and_meta_struct,
M _manifested
){
- Node yaml_root;
- try {
- yaml_root = Loader.fromString(_document_struct.content).load();
- _make_and_meta_struct
- = contentYAMLtoSpineStruct!()(_make_and_meta_struct, yaml_root, _manifested, _document_struct.filename); // struct from yaml
- } catch {
- import std.stdio;
- writeln("ERROR failed to read content, not parsed as yaml");
+ Node _yaml;
+ if (_document_struct.content.length > 0) {
+ try {
+ _yaml = Loader.fromString(_document_struct.content).load();
+ _make_and_meta_struct
+ = contentYAMLtoSpineStruct!()(_make_and_meta_struct, _yaml, _manifested, _document_struct.filename); // struct from yaml
+ } catch {
+ import std.stdio;
+ writeln("ERROR failed to parse content as yaml: ", _document_struct.filename);
+ // writeln(_document_struct.content);
+ }
}
return _make_and_meta_struct;
}
@@ -1865,17 +1868,18 @@ static template docHeaderMakeAndMetaTupYamlExtractAndConvertToStruct() {
CCm _make_and_meta_struct,
M _manifested,
) {
- Node _yaml_root;
+ Node _yaml;
try {
- _yaml_root = Loader.fromString(header_src).load();
+ _yaml = Loader.fromString(header_src).load();
+ if (("title" in _yaml) && ("creator" in _yaml)) {} else { // need test for _yaml content (does not work)
+ writeln("ERROR failed to read document header, yaml header does not contain essential information related to title and author");
+ }
+ return contentYAMLtoSpineStruct!()(_make_and_meta_struct, _yaml, _manifested, "header");
} catch {
import std.stdio;
- writeln("ERROR failed to read document header, not parsed as yaml");
+ writeln("ERROR failed to read document header, header not parsed as yaml: ", _manifested.src.filename);
+ return _make_and_meta_struct;
}
- // need test for _yaml_root content
- auto _header_and_make_and_meta_struct
- = contentYAMLtoSpineStruct!()(_make_and_meta_struct, _yaml_root, _manifested, "header");
- return _header_and_make_and_meta_struct;
}
}
#+END_SRC