diff options
author | Ralph Amissah <ralph.amissah@gmail.com> | 2025-09-23 11:04:12 -0400 |
---|---|---|
committer | Ralph Amissah <ralph.amissah@gmail.com> | 2025-09-23 11:04:12 -0400 |
commit | a4af8d0d60d07c7d72e977b06aa3b796fc43892c (patch) | |
tree | 85726ac84062c41bd82e25dc40aad979975293b9 | |
parent | dub_describe.json + other minor misc (diff) |
spine.d tidy
-rw-r--r-- | org/spine.org | 197 | ||||
-rwxr-xr-x | src/sisudoc/spine.d | 197 |
2 files changed, 176 insertions, 218 deletions
diff --git a/org/spine.org b/org/spine.org index 4b66835..74fe0a0 100644 --- a/org/spine.org +++ b/org/spine.org @@ -874,30 +874,14 @@ struct OptActions { } auto output_task_scheduler() { int[] schedule; - if (source_or_pod) { - schedule ~= outTask.source_or_pod; - } - if (sqlite_discrete) { - schedule ~= outTask.sqlite; - } - if (epub) { - schedule ~= outTask.epub; - } - if (html_scroll) { - schedule ~= outTask.html_scroll; - } - if (html_seg) { - schedule ~= outTask.html_seg; - } - if (html_stuff) { - schedule ~= outTask.html_stuff; - } - if (odt) { - schedule ~= outTask.odt; - } - if (latex) { - schedule ~= outTask.latex; - } + if (source_or_pod) { schedule ~= outTask.source_or_pod; } + if (sqlite_discrete) { schedule ~= outTask.sqlite; } + if (epub) { schedule ~= outTask.epub; } + if (html_scroll) { schedule ~= outTask.html_scroll; } + if (html_seg) { schedule ~= outTask.html_seg; } + if (html_stuff) { schedule ~= outTask.html_stuff; } + if (odt) { schedule ~= outTask.odt; } + if (latex) { schedule ~= outTask.latex; } return schedule.sort().uniq; } @trusted bool abstraction() { @@ -1095,94 +1079,53 @@ foreach(arg; args[1..$]) { ); if (exists(sisudoc_txt_)) { try { - if (exists(sisudoc_txt_)) { - import dyaml; - try { - 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_y.yaml_tag_is_map) - ) { - if ("path" in pod_manifest_yaml["doc"]) { - if (pod_manifest_yaml["doc"]["path"].tag.match(rgx_y.yaml_tag_is_seq)) { - foreach (string _path; pod_manifest_yaml["doc"]["path"]) { - markup_contents_location_ ~= _path ~ "\n"; - pod_manifest_root_content_paths_to_markup_location_raw_ ~= - _path ~ "\n"; - } - } else if ( - pod_manifest_yaml["doc"]["path"].type.string - && pod_manifest_yaml["doc"]["path"].tag.match(rgx_y.yaml_tag_is_str) - ) { - markup_contents_location_ = pod_manifest_yaml["doc"]["path"].get!string; - pod_manifest_root_content_paths_to_markup_location_raw_ = - pod_manifest_yaml["doc"]["path"].get!string; - } + import dyaml; + 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_y.yaml_tag_is_map) + ) { + if ("path" in pod_manifest_yaml["doc"]) { + if (pod_manifest_yaml["doc"]["path"].tag.match(rgx_y.yaml_tag_is_seq)) { + foreach (string _path; pod_manifest_yaml["doc"]["path"]) { + markup_contents_location_ ~= _path ~ "\n"; + pod_manifest_root_content_paths_to_markup_location_raw_ ~= + _path ~ "\n"; } - if ("filename" in pod_manifest_yaml["doc"]) { - if (pod_manifest_yaml["doc"]["filename"].tag.match(rgx_y.yaml_tag_is_seq)) { - foreach (string _filename; pod_manifest_yaml["doc"]["filename"]) { - if ("language" in pod_manifest_yaml["doc"]) { - if (pod_manifest_yaml["doc"]["language"].tag.match(rgx_y.yaml_tag_is_seq)) { - foreach (string _lang; pod_manifest_yaml["doc"]["language"]) { - markup_contents_location_ ~= - "media/text/" - ~ _lang ~ "/" - ~ _filename ~ "\n"; - } - } else if (pod_manifest_yaml["doc"]["language"].tag.match(rgx_y.yaml_tag_is_str) - ) { - markup_contents_location_ = - "media/text/" - ~ pod_manifest_yaml["doc"]["language"].get!string - ~ "/" ~ _filename ~ "\n"; - } else { - string _lang_default = "en"; - markup_contents_location_ ~= - "media/text/" - ~ _lang_default ~ "/" - ~ pod_manifest_yaml["doc"]["filename"].get!string ~ "\n"; - } - } else { - string _lang_default = "en"; - markup_contents_location_ ~= - "media/text/" - ~ _lang_default ~ "/" - ~ pod_manifest_yaml["doc"]["filename"].get!string ~ "\n"; - } - } - } else if ( - pod_manifest_yaml["doc"]["filename"].type.string - && pod_manifest_yaml["doc"]["filename"].tag.match(rgx_y.yaml_tag_is_str) - ) { - if ("language" in pod_manifest_yaml["doc"]) { - if (pod_manifest_yaml["doc"]["language"].tag.match(rgx_y.yaml_tag_is_seq)) { - foreach (string _lang; pod_manifest_yaml["doc"]["language"]) { - markup_contents_location_ ~= - "media/text/" - ~ _lang ~ "/" - ~ pod_manifest_yaml["doc"]["filename"].get!string ~ "\n"; - } - } else if (pod_manifest_yaml["doc"]["language"].tag.match(rgx_y.yaml_tag_is_str)) { - markup_contents_location_ = - "media/text/" - ~ pod_manifest_yaml["doc"]["language"].get!string - ~ "/" ~ pod_manifest_yaml["doc"]["filename"].get!string ~ "\n"; - } else { - string _lang_default = "en"; + } else if ( + pod_manifest_yaml["doc"]["path"].type.string + && pod_manifest_yaml["doc"]["path"].tag.match(rgx_y.yaml_tag_is_str) + ) { + markup_contents_location_ = pod_manifest_yaml["doc"]["path"].get!string; + pod_manifest_root_content_paths_to_markup_location_raw_ = + pod_manifest_yaml["doc"]["path"].get!string; + } + } + if ("filename" in pod_manifest_yaml["doc"]) { + if (pod_manifest_yaml["doc"]["filename"].tag.match(rgx_y.yaml_tag_is_seq)) { + foreach (string _filename; pod_manifest_yaml["doc"]["filename"]) { + if ("language" in pod_manifest_yaml["doc"]) { + if (pod_manifest_yaml["doc"]["language"].tag.match(rgx_y.yaml_tag_is_seq)) { + foreach (string _lang; pod_manifest_yaml["doc"]["language"]) { markup_contents_location_ ~= "media/text/" - ~ _lang_default ~ "/" - ~ pod_manifest_yaml["doc"]["filename"].get!string ~ "\n"; + ~ _lang ~ "/" + ~ _filename ~ "\n"; } + } else if (pod_manifest_yaml["doc"]["language"].tag.match(rgx_y.yaml_tag_is_str) + ) { + markup_contents_location_ = + "media/text/" + ~ pod_manifest_yaml["doc"]["language"].get!string + ~ "/" ~ _filename ~ "\n"; } else { string _lang_default = "en"; markup_contents_location_ ~= @@ -1190,11 +1133,47 @@ foreach(arg; args[1..$]) { ~ _lang_default ~ "/" ~ pod_manifest_yaml["doc"]["filename"].get!string ~ "\n"; } + } else { + string _lang_default = "en"; + markup_contents_location_ ~= + "media/text/" + ~ _lang_default ~ "/" + ~ pod_manifest_yaml["doc"]["filename"].get!string ~ "\n"; + } + } + } else if ( + pod_manifest_yaml["doc"]["filename"].type.string + && pod_manifest_yaml["doc"]["filename"].tag.match(rgx_y.yaml_tag_is_str) + ) { + if ("language" in pod_manifest_yaml["doc"]) { + if (pod_manifest_yaml["doc"]["language"].tag.match(rgx_y.yaml_tag_is_seq)) { + foreach (string _lang; pod_manifest_yaml["doc"]["language"]) { + markup_contents_location_ ~= + "media/text/" + ~ _lang ~ "/" + ~ pod_manifest_yaml["doc"]["filename"].get!string ~ "\n"; + } + } else if (pod_manifest_yaml["doc"]["language"].tag.match(rgx_y.yaml_tag_is_str)) { + markup_contents_location_ = + "media/text/" + ~ pod_manifest_yaml["doc"]["language"].get!string + ~ "/" ~ pod_manifest_yaml["doc"]["filename"].get!string ~ "\n"; + } else { + string _lang_default = "en"; + markup_contents_location_ ~= + "media/text/" + ~ _lang_default ~ "/" + ~ pod_manifest_yaml["doc"]["filename"].get!string ~ "\n"; } + } else { + string _lang_default = "en"; + markup_contents_location_ ~= + "media/text/" + ~ _lang_default ~ "/" + ~ pod_manifest_yaml["doc"]["filename"].get!string ~ "\n"; } } } - } catch (ErrnoException ex) { } } } catch (ErrnoException ex) { diff --git a/src/sisudoc/spine.d b/src/sisudoc/spine.d index 75cd9d5..2b6096b 100755 --- a/src/sisudoc/spine.d +++ b/src/sisudoc/spine.d @@ -686,30 +686,14 @@ string program_name = "spine"; } auto output_task_scheduler() { int[] schedule; - if (source_or_pod) { - schedule ~= outTask.source_or_pod; - } - if (sqlite_discrete) { - schedule ~= outTask.sqlite; - } - if (epub) { - schedule ~= outTask.epub; - } - if (html_scroll) { - schedule ~= outTask.html_scroll; - } - if (html_seg) { - schedule ~= outTask.html_seg; - } - if (html_stuff) { - schedule ~= outTask.html_stuff; - } - if (odt) { - schedule ~= outTask.odt; - } - if (latex) { - schedule ~= outTask.latex; - } + if (source_or_pod) { schedule ~= outTask.source_or_pod; } + if (sqlite_discrete) { schedule ~= outTask.sqlite; } + if (epub) { schedule ~= outTask.epub; } + if (html_scroll) { schedule ~= outTask.html_scroll; } + if (html_seg) { schedule ~= outTask.html_seg; } + if (html_stuff) { schedule ~= outTask.html_stuff; } + if (odt) { schedule ~= outTask.odt; } + if (latex) { schedule ~= outTask.latex; } return schedule.sort().uniq; } @trusted bool abstraction() { @@ -882,94 +866,53 @@ string program_name = "spine"; ); if (exists(sisudoc_txt_)) { try { - if (exists(sisudoc_txt_)) { - import dyaml; - try { - 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_y.yaml_tag_is_map) - ) { - if ("path" in pod_manifest_yaml["doc"]) { - if (pod_manifest_yaml["doc"]["path"].tag.match(rgx_y.yaml_tag_is_seq)) { - foreach (string _path; pod_manifest_yaml["doc"]["path"]) { - markup_contents_location_ ~= _path ~ "\n"; - pod_manifest_root_content_paths_to_markup_location_raw_ ~= - _path ~ "\n"; - } - } else if ( - pod_manifest_yaml["doc"]["path"].type.string - && pod_manifest_yaml["doc"]["path"].tag.match(rgx_y.yaml_tag_is_str) - ) { - markup_contents_location_ = pod_manifest_yaml["doc"]["path"].get!string; - pod_manifest_root_content_paths_to_markup_location_raw_ = - pod_manifest_yaml["doc"]["path"].get!string; - } + import dyaml; + 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_y.yaml_tag_is_map) + ) { + if ("path" in pod_manifest_yaml["doc"]) { + if (pod_manifest_yaml["doc"]["path"].tag.match(rgx_y.yaml_tag_is_seq)) { + foreach (string _path; pod_manifest_yaml["doc"]["path"]) { + markup_contents_location_ ~= _path ~ "\n"; + pod_manifest_root_content_paths_to_markup_location_raw_ ~= + _path ~ "\n"; } - if ("filename" in pod_manifest_yaml["doc"]) { - if (pod_manifest_yaml["doc"]["filename"].tag.match(rgx_y.yaml_tag_is_seq)) { - foreach (string _filename; pod_manifest_yaml["doc"]["filename"]) { - if ("language" in pod_manifest_yaml["doc"]) { - if (pod_manifest_yaml["doc"]["language"].tag.match(rgx_y.yaml_tag_is_seq)) { - foreach (string _lang; pod_manifest_yaml["doc"]["language"]) { - markup_contents_location_ ~= - "media/text/" - ~ _lang ~ "/" - ~ _filename ~ "\n"; - } - } else if (pod_manifest_yaml["doc"]["language"].tag.match(rgx_y.yaml_tag_is_str) - ) { - markup_contents_location_ = - "media/text/" - ~ pod_manifest_yaml["doc"]["language"].get!string - ~ "/" ~ _filename ~ "\n"; - } else { - string _lang_default = "en"; - markup_contents_location_ ~= - "media/text/" - ~ _lang_default ~ "/" - ~ pod_manifest_yaml["doc"]["filename"].get!string ~ "\n"; - } - } else { - string _lang_default = "en"; - markup_contents_location_ ~= - "media/text/" - ~ _lang_default ~ "/" - ~ pod_manifest_yaml["doc"]["filename"].get!string ~ "\n"; - } - } - } else if ( - pod_manifest_yaml["doc"]["filename"].type.string - && pod_manifest_yaml["doc"]["filename"].tag.match(rgx_y.yaml_tag_is_str) - ) { - if ("language" in pod_manifest_yaml["doc"]) { - if (pod_manifest_yaml["doc"]["language"].tag.match(rgx_y.yaml_tag_is_seq)) { - foreach (string _lang; pod_manifest_yaml["doc"]["language"]) { - markup_contents_location_ ~= - "media/text/" - ~ _lang ~ "/" - ~ pod_manifest_yaml["doc"]["filename"].get!string ~ "\n"; - } - } else if (pod_manifest_yaml["doc"]["language"].tag.match(rgx_y.yaml_tag_is_str)) { - markup_contents_location_ = - "media/text/" - ~ pod_manifest_yaml["doc"]["language"].get!string - ~ "/" ~ pod_manifest_yaml["doc"]["filename"].get!string ~ "\n"; - } else { - string _lang_default = "en"; + } else if ( + pod_manifest_yaml["doc"]["path"].type.string + && pod_manifest_yaml["doc"]["path"].tag.match(rgx_y.yaml_tag_is_str) + ) { + markup_contents_location_ = pod_manifest_yaml["doc"]["path"].get!string; + pod_manifest_root_content_paths_to_markup_location_raw_ = + pod_manifest_yaml["doc"]["path"].get!string; + } + } + if ("filename" in pod_manifest_yaml["doc"]) { + if (pod_manifest_yaml["doc"]["filename"].tag.match(rgx_y.yaml_tag_is_seq)) { + foreach (string _filename; pod_manifest_yaml["doc"]["filename"]) { + if ("language" in pod_manifest_yaml["doc"]) { + if (pod_manifest_yaml["doc"]["language"].tag.match(rgx_y.yaml_tag_is_seq)) { + foreach (string _lang; pod_manifest_yaml["doc"]["language"]) { markup_contents_location_ ~= "media/text/" - ~ _lang_default ~ "/" - ~ pod_manifest_yaml["doc"]["filename"].get!string ~ "\n"; + ~ _lang ~ "/" + ~ _filename ~ "\n"; } + } else if (pod_manifest_yaml["doc"]["language"].tag.match(rgx_y.yaml_tag_is_str) + ) { + markup_contents_location_ = + "media/text/" + ~ pod_manifest_yaml["doc"]["language"].get!string + ~ "/" ~ _filename ~ "\n"; } else { string _lang_default = "en"; markup_contents_location_ ~= @@ -977,11 +920,47 @@ string program_name = "spine"; ~ _lang_default ~ "/" ~ pod_manifest_yaml["doc"]["filename"].get!string ~ "\n"; } + } else { + string _lang_default = "en"; + markup_contents_location_ ~= + "media/text/" + ~ _lang_default ~ "/" + ~ pod_manifest_yaml["doc"]["filename"].get!string ~ "\n"; + } + } + } else if ( + pod_manifest_yaml["doc"]["filename"].type.string + && pod_manifest_yaml["doc"]["filename"].tag.match(rgx_y.yaml_tag_is_str) + ) { + if ("language" in pod_manifest_yaml["doc"]) { + if (pod_manifest_yaml["doc"]["language"].tag.match(rgx_y.yaml_tag_is_seq)) { + foreach (string _lang; pod_manifest_yaml["doc"]["language"]) { + markup_contents_location_ ~= + "media/text/" + ~ _lang ~ "/" + ~ pod_manifest_yaml["doc"]["filename"].get!string ~ "\n"; + } + } else if (pod_manifest_yaml["doc"]["language"].tag.match(rgx_y.yaml_tag_is_str)) { + markup_contents_location_ = + "media/text/" + ~ pod_manifest_yaml["doc"]["language"].get!string + ~ "/" ~ pod_manifest_yaml["doc"]["filename"].get!string ~ "\n"; + } else { + string _lang_default = "en"; + markup_contents_location_ ~= + "media/text/" + ~ _lang_default ~ "/" + ~ pod_manifest_yaml["doc"]["filename"].get!string ~ "\n"; } + } else { + string _lang_default = "en"; + markup_contents_location_ ~= + "media/text/" + ~ _lang_default ~ "/" + ~ pod_manifest_yaml["doc"]["filename"].get!string ~ "\n"; } } } - } catch (ErrnoException ex) { } } } catch (ErrnoException ex) { |