aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/doc_reform/meta
diff options
context:
space:
mode:
Diffstat (limited to 'src/doc_reform/meta')
-rw-r--r--src/doc_reform/meta/conf_make_meta_yaml.d34
-rw-r--r--src/doc_reform/meta/metadoc.d26
2 files changed, 30 insertions, 30 deletions
diff --git a/src/doc_reform/meta/conf_make_meta_yaml.d b/src/doc_reform/meta/conf_make_meta_yaml.d
index 8f1f885..5576b1c 100644
--- a/src/doc_reform/meta/conf_make_meta_yaml.d
+++ b/src/doc_reform/meta/conf_make_meta_yaml.d
@@ -794,14 +794,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;
}
@@ -829,16 +832,17 @@ 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;
}
}
diff --git a/src/doc_reform/meta/metadoc.d b/src/doc_reform/meta/metadoc.d
index b81dfb2..e45139d 100644
--- a/src/doc_reform/meta/metadoc.d
+++ b/src/doc_reform/meta/metadoc.d
@@ -26,7 +26,7 @@ template spineAbstraction() {
mixin spineBiblio;
mixin spineRgxInitFlags;
mixin outputHub;
- 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();
@@ -39,10 +39,8 @@ template spineAbstraction() {
){
{ /+ 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);
}
/+ ↓ read file (filename with path) +/
/+ ↓ file tuple of header and content +/
@@ -55,7 +53,7 @@ template spineAbstraction() {
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)
) {
@@ -72,15 +70,13 @@ template spineAbstraction() {
) {
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)
) {