diff options
| -rw-r--r-- | org/in_source_files.org | 2 | ||||
| -rw-r--r-- | org/meta_conf_make_meta.org | 18 | ||||
| -rw-r--r-- | org/out_src_pod.org | 7 | ||||
| -rw-r--r-- | org/spine.org | 10 | ||||
| -rw-r--r-- | src/doc_reform/io_in/read_config_files.d | 2 | ||||
| -rw-r--r-- | src/doc_reform/io_out/source_pod.d | 7 | ||||
| -rw-r--r-- | src/doc_reform/meta/conf_make_meta_json.d | 2 | ||||
| -rw-r--r-- | src/doc_reform/meta/conf_make_meta_yaml.d | 16 | ||||
| -rwxr-xr-x | src/doc_reform/spine.d | 10 | 
9 files changed, 54 insertions, 20 deletions
| diff --git a/org/in_source_files.org b/org/in_source_files.org index a4e2812..db433b0 100644 --- a/org/in_source_files.org +++ b/org/in_source_files.org @@ -133,7 +133,7 @@ webserv:        Node yaml_root;        try {          yaml_root = Loader.fromString(config_file_str).load(); -      } catch { +      } catch (Throwable) {          import std.stdio;          writeln("ERROR failed to read config file content, not parsed as yaml, program default used");          conf_filename = "VIRTUAL"; diff --git a/org/meta_conf_make_meta.org b/org/meta_conf_make_meta.org index 61e702f..dbe3cc9 100644 --- a/org/meta_conf_make_meta.org +++ b/org/meta_conf_make_meta.org @@ -1096,7 +1096,7 @@ if (_struct_composite.meta.creator_author.empty) {    }    _struct_composite.meta.creator_author_arr = author_arr;    _struct_composite.meta.creator_author     = author_arr.join(", ").chomp.chomp; -  _struct_composite.meta.creator_author_surname = authors_hash_arr["last"][0]; +  _struct_composite.meta.creator_author_surname = (authors_hash_arr["last"].length > 0) ? authors_hash_arr["last"][0] : "";    string _author_name_last_first = authors_hash_arr["last_first"].join("; ").chomp.chomp;    _struct_composite.meta.creator_author_surname_fn = (_author_name_last_first.length > 0)    ? _author_name_last_first @@ -1845,7 +1845,7 @@ if (_struct_composite.meta.creator_author.empty) {    }    _struct_composite.meta.creator_author_arr = author_arr;    _struct_composite.meta.creator_author     = author_arr.join(", ").chomp.chomp; -  _struct_composite.meta.creator_author_surname = authors_hash_arr["last"][0]; +  _struct_composite.meta.creator_author_surname = (authors_hash_arr["last"].length > 0) ? authors_hash_arr["last"][0] : "";    string _author_name_last_first = authors_hash_arr["last_first"].join("; ").chomp.chomp;    _struct_composite.meta.creator_author_surname_fn = (_author_name_last_first.length > 0)    ? _author_name_last_first @@ -2092,13 +2092,18 @@ template configParseYAMLreturnSpineStruct() {      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, _opt_action, _document_struct.filename); -      } catch { +      } catch (Throwable) {          import std.stdio;          writeln("ERROR failed to parse content as yaml: ", _document_struct.filename);          // writeln(_document_struct.content);        } +      try { +      _make_and_meta_struct +        = contentYAMLtoSpineStruct!()(_make_and_meta_struct, _yaml, _manifested, _opt_action, _document_struct.filename); +      } catch (Throwable) { +        import std.stdio; +        writeln("ERROR failed to convert yaml to struct: ", _document_struct.filename); +      }      }      return _make_and_meta_struct;    } @@ -2139,8 +2144,7 @@ template docHeaderMakeAndMetaTupYamlExtractAndConvertToStruct() {          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, _opt_action, "header"); -    } catch { -      import std.stdio; +    } catch (Throwable) {        writeln("ERROR failed to read document header, header not parsed as yaml: ", _manifested.src.filename);        return _make_and_meta_struct;      } diff --git a/org/out_src_pod.org b/org/out_src_pod.org index 071f1d7..3fc6d82 100644 --- a/org/out_src_pod.org +++ b/org/out_src_pod.org @@ -232,7 +232,12 @@ auto fn_pod = pths_pod.pod_filename(doc_matters.src.filename).zpod;        string _pm = "doc:\n  filename: " ~ doc_matters.src.filename ~ "\n  language: " ~ doc_matters.pod.manifest_list_of_languages.to!string ~ "\n";        if (doc_matters.opt.action.debug_do        && doc_matters.opt.action.verbose) { -        _pmy = Loader.fromString(_pm).load(); +        try { +          _pmy = Loader.fromString(_pm).load(); +        } catch (ErrnoException ex) { +        } catch (Throwable) { +          writeln("ERROR failed to read config file content, not parsed as yaml"); +        }          writeln("pod filename:  ", _pmy["doc"]["filename"].get!string);          writeln("pod languages: ", doc_matters.pod.manifest_list_of_languages.to!string);          writeln("pod languages: ", doc_matters.src.language); diff --git a/org/spine.org b/org/spine.org index ed575f0..82cdeb7 100644 --- a/org/spine.org +++ b/org/spine.org @@ -943,7 +943,15 @@ foreach(arg; args[1..$]) {            if (exists(sisudoc_txt_)) {              import dyaml;              try { -              Node pod_manifest_yaml = Loader.fromFile(sisudoc_txt_).load(); +              Node pod_manifest_yaml; +              try { +                pod_manifest_yaml = Loader.fromFile(sisudoc_txt_).load(); +              } catch (ErrnoException ex) { +              } catch (FileException ex) { +                writeln("ERROR failed to read config file"); +              } catch (Throwable) { +                writeln("ERROR failed to read config file content, not parsed as yaml"); +              }                if ("doc" in pod_manifest_yaml) {                  if (pod_manifest_yaml["doc"].type.mapping                    && pod_manifest_yaml["doc"].tag.match(rgx.yaml_tag_is_map) diff --git a/src/doc_reform/io_in/read_config_files.d b/src/doc_reform/io_in/read_config_files.d index 9180c20..65b5388 100644 --- a/src/doc_reform/io_in/read_config_files.d +++ b/src/doc_reform/io_in/read_config_files.d @@ -89,7 +89,7 @@ webserv:        Node yaml_root;        try {          yaml_root = Loader.fromString(config_file_str).load(); -      } catch { +      } catch (Throwable) {          import std.stdio;          writeln("ERROR failed to read config file content, not parsed as yaml, program default used");          conf_filename = "VIRTUAL"; diff --git a/src/doc_reform/io_out/source_pod.d b/src/doc_reform/io_out/source_pod.d index 5a96ed6..5a0fd47 100644 --- a/src/doc_reform/io_out/source_pod.d +++ b/src/doc_reform/io_out/source_pod.d @@ -167,7 +167,12 @@ template spinePod() {              string _pm = "doc:\n  filename: " ~ doc_matters.src.filename ~ "\n  language: " ~ doc_matters.pod.manifest_list_of_languages.to!string ~ "\n";              if (doc_matters.opt.action.debug_do              && doc_matters.opt.action.verbose) { -              _pmy = Loader.fromString(_pm).load(); +              try { +                _pmy = Loader.fromString(_pm).load(); +              } catch (ErrnoException ex) { +              } catch (Throwable) { +                writeln("ERROR failed to read config file content, not parsed as yaml"); +              }                writeln("pod filename:  ", _pmy["doc"]["filename"].get!string);                writeln("pod languages: ", doc_matters.pod.manifest_list_of_languages.to!string);                writeln("pod languages: ", doc_matters.src.language); diff --git a/src/doc_reform/meta/conf_make_meta_json.d b/src/doc_reform/meta/conf_make_meta_json.d index 5f36fb1..9befaaa 100644 --- a/src/doc_reform/meta/conf_make_meta_json.d +++ b/src/doc_reform/meta/conf_make_meta_json.d @@ -410,7 +410,7 @@ static template contentJSONtoSpineStruct() {        }        _struct_composite.meta.creator_author_arr = author_arr;        _struct_composite.meta.creator_author     = author_arr.join(", ").chomp.chomp; -      _struct_composite.meta.creator_author_surname = authors_hash_arr["last"][0]; +      _struct_composite.meta.creator_author_surname = (authors_hash_arr["last"].length > 0) ? authors_hash_arr["last"][0] : "";        string _author_name_last_first = authors_hash_arr["last_first"].join("; ").chomp.chomp;        _struct_composite.meta.creator_author_surname_fn = (_author_name_last_first.length > 0)        ? _author_name_last_first diff --git a/src/doc_reform/meta/conf_make_meta_yaml.d b/src/doc_reform/meta/conf_make_meta_yaml.d index 9dac231..1f22dc8 100644 --- a/src/doc_reform/meta/conf_make_meta_yaml.d +++ b/src/doc_reform/meta/conf_make_meta_yaml.d @@ -680,7 +680,7 @@ template contentYAMLtoSpineStruct() {        }        _struct_composite.meta.creator_author_arr = author_arr;        _struct_composite.meta.creator_author     = author_arr.join(", ").chomp.chomp; -      _struct_composite.meta.creator_author_surname = authors_hash_arr["last"][0]; +      _struct_composite.meta.creator_author_surname = (authors_hash_arr["last"].length > 0) ? authors_hash_arr["last"][0] : "";        string _author_name_last_first = authors_hash_arr["last_first"].join("; ").chomp.chomp;        _struct_composite.meta.creator_author_surname_fn = (_author_name_last_first.length > 0)        ? _author_name_last_first @@ -1008,13 +1008,18 @@ template configParseYAMLreturnSpineStruct() {      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, _opt_action, _document_struct.filename); -      } catch { +      } catch (Throwable) {          import std.stdio;          writeln("ERROR failed to parse content as yaml: ", _document_struct.filename);          // writeln(_document_struct.content);        } +      try { +      _make_and_meta_struct +        = contentYAMLtoSpineStruct!()(_make_and_meta_struct, _yaml, _manifested, _opt_action, _document_struct.filename); +      } catch (Throwable) { +        import std.stdio; +        writeln("ERROR failed to convert yaml to struct: ", _document_struct.filename); +      }      }      return _make_and_meta_struct;    } @@ -1050,8 +1055,7 @@ template docHeaderMakeAndMetaTupYamlExtractAndConvertToStruct() {          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, _opt_action, "header"); -    } catch { -      import std.stdio; +    } catch (Throwable) {        writeln("ERROR failed to read document header, header not parsed as yaml: ", _manifested.src.filename);        return _make_and_meta_struct;      } diff --git a/src/doc_reform/spine.d b/src/doc_reform/spine.d index 409f460..6e03f3d 100755 --- a/src/doc_reform/spine.d +++ b/src/doc_reform/spine.d @@ -663,7 +663,15 @@ string program_name = "spine";              if (exists(sisudoc_txt_)) {                import dyaml;                try { -                Node pod_manifest_yaml = Loader.fromFile(sisudoc_txt_).load(); +                Node pod_manifest_yaml; +                try { +                  pod_manifest_yaml = Loader.fromFile(sisudoc_txt_).load(); +                } catch (ErrnoException ex) { +                } catch (FileException ex) { +                  writeln("ERROR failed to read config file"); +                } catch (Throwable) { +                  writeln("ERROR failed to read config file content, not parsed as yaml"); +                }                  if ("doc" in pod_manifest_yaml) {                    if (pod_manifest_yaml["doc"].type.mapping                      && pod_manifest_yaml["doc"].tag.match(rgx.yaml_tag_is_map) | 
