aboutsummaryrefslogtreecommitdiffhomepage
path: root/org/meta_conf_make_meta.org
diff options
context:
space:
mode:
authorRalph Amissah <ralph.amissah@gmail.com>2019-10-22 19:56:58 -0400
committerRalph Amissah <ralph.amissah@gmail.com>2019-11-19 16:55:29 -0500
commit3668f9ec6b4dd096f2109557ca523b3d774ad6d1 (patch)
tree5412fc865db231d690c095f894e7c0d2aee7f55b /org/meta_conf_make_meta.org
parentcosmetic (diff)
minor
Diffstat (limited to 'org/meta_conf_make_meta.org')
-rw-r--r--org/meta_conf_make_meta.org50
1 files changed, 35 insertions, 15 deletions
diff --git a/org/meta_conf_make_meta.org b/org/meta_conf_make_meta.org
index b6f1c7d..07befe1 100644
--- a/org/meta_conf_make_meta.org
+++ b/org/meta_conf_make_meta.org
@@ -816,16 +816,21 @@ if (_struct_composite.meta.creator_author.empty) {
= _struct_composite.meta.creator_author.split(rgx.arr_delimiter);
auto _lastname = appender!(char[])();
foreach (author_raw; authors_raw_arr) {
- author_arr ~= author_raw.replace(rgx.raw_author_munge, "$2 $1");
- authors_hash_arr["first"] ~= author_raw.replace(rgx.raw_author_munge, "$2");
- authors_hash_arr["last"] ~= author_raw.replace(rgx.raw_author_munge, "$1");
- authors_hash_arr["full"] ~= author_raw.replace(rgx.raw_author_munge, "$2 $1");
- authors_hash_arr["as_input"] ~= author_raw;
if (auto m = author_raw.match(rgx.raw_author_munge)) {
+ author_arr ~= author_raw.replace(rgx.raw_author_munge, "$2 $1");
+ authors_hash_arr["first"] ~= author_raw.replace(rgx.raw_author_munge, "$2");
+ authors_hash_arr["last"] ~= author_raw.replace(rgx.raw_author_munge, "$1");
+ authors_hash_arr["full"] ~= author_raw.replace(rgx.raw_author_munge, "$2 $1");
(m.captures[1]).map!toUpper.copy(_lastname);
authors_hash_arr["last_first"] ~= _lastname.data.to!string ~ ", " ~ m.captures[2];
_lastname = appender!(char[])();
+ } else {
+ author_arr ~= author_raw;
+ authors_hash_arr["last"] ~= author_raw;
+ authors_hash_arr["full"] ~= author_raw;
+ authors_hash_arr["last_first"] ~= author_raw;
}
+ authors_hash_arr["as_input"] ~= author_raw;
}
_struct_composite.meta.creator_author_arr = author_arr;
_struct_composite.meta.creator_author = author_arr.join(", ").chomp.chomp;
@@ -1555,16 +1560,21 @@ if (_struct_composite.meta.creator_author.empty) {
= _struct_composite.meta.creator_author.split(rgx.arr_delimiter);
auto _lastname = appender!(char[])();
foreach (author_raw; authors_raw_arr) {
- author_arr ~= author_raw.replace(rgx.raw_author_munge, "$2 $1");
- authors_hash_arr["first"] ~= author_raw.replace(rgx.raw_author_munge, "$2");
- authors_hash_arr["last"] ~= author_raw.replace(rgx.raw_author_munge, "$1");
- authors_hash_arr["full"] ~= author_raw.replace(rgx.raw_author_munge, "$2 $1");
- authors_hash_arr["as_input"] ~= author_raw;
if (auto m = author_raw.match(rgx.raw_author_munge)) {
+ author_arr ~= author_raw.replace(rgx.raw_author_munge, "$2 $1");
+ authors_hash_arr["first"] ~= author_raw.replace(rgx.raw_author_munge, "$2");
+ authors_hash_arr["last"] ~= author_raw.replace(rgx.raw_author_munge, "$1");
+ authors_hash_arr["full"] ~= author_raw.replace(rgx.raw_author_munge, "$2 $1");
(m.captures[1]).map!toUpper.copy(_lastname);
authors_hash_arr["last_first"] ~= _lastname.data.to!string ~ ", " ~ m.captures[2];
_lastname = appender!(char[])();
+ } {
+ author_arr ~= author_raw;
+ authors_hash_arr["last"] ~= author_raw;
+ authors_hash_arr["full"] ~= author_raw;
+ authors_hash_arr["last_first"] ~= author_raw;
}
+ authors_hash_arr["as_input"] ~= author_raw;
}
_struct_composite.meta.creator_author_arr = author_arr;
_struct_composite.meta.creator_author = author_arr.join(", ").chomp.chomp;
@@ -1810,9 +1820,15 @@ static template configParseYAMLreturnDocReformStruct() {
CCm _make_and_meta_struct,
M _manifested
){
- Node yaml_root = Loader.fromString(_document_struct.content).load();
- _make_and_meta_struct
- = contentYAMLtoDocReformStruct!()(_make_and_meta_struct, yaml_root, _manifested, _document_struct.filename); // struct from yaml
+ Node yaml_root;
+ try {
+ yaml_root = Loader.fromString(_document_struct.content).load();
+ _make_and_meta_struct
+ = contentYAMLtoDocReformStruct!()(_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");
+ }
return _make_and_meta_struct;
}
}
@@ -1846,8 +1862,12 @@ static template docHeaderMakeAndMetaTupYamlExtractAndConvertToStruct() {
) {
Node _yaml_root;
if (header_src.match(rgx.yaml_header_meta_title)) {
- import dyaml;
- _yaml_root = Loader.fromString(header_src).load();
+ try {
+ _yaml_root = Loader.fromString(header_src).load();
+ } catch {
+ import std.stdio;
+ writeln("ERROR failed to read document header, not parsed as yaml");
+ }
}
auto _header_and_make_and_meta_struct
= contentYAMLtoDocReformStruct!()(_make_and_meta_struct, _yaml_root, _manifested, "header");