aboutsummaryrefslogtreecommitdiffhomepage
path: root/org/doc_reform.org
diff options
context:
space:
mode:
authorRalph Amissah <ralph.amissah@gmail.com>2019-10-09 15:21:34 -0400
committerRalph Amissah <ralph.amissah@gmail.com>2019-10-17 19:07:20 -0400
commit433f0b2ed0f9d5461c0fdf2b49e41eb26802cc2e (patch)
tree6f8855ab401dc146161ac104608828a3e302f57a /org/doc_reform.org
parent0.8.1 conf, make, meta: yaml only (toml removed) (diff)
0.8.2 yaml pod.manifest, read site config first
- yaml (configuration & metadata) site config, pod: pod.manifest, doc header: make, meta - pod.manifest in yaml breaks - older program reading new pod and - newer program reading old pod - read config first, - get site default language in case it is absent in pod.manifest - ensure config is not read too many times (it is at present, revisit)
Diffstat (limited to 'org/doc_reform.org')
-rw-r--r--org/doc_reform.org114
1 files changed, 103 insertions, 11 deletions
diff --git a/org/doc_reform.org b/org/doc_reform.org
index abba098..6b08fd2 100644
--- a/org/doc_reform.org
+++ b/org/doc_reform.org
@@ -28,7 +28,7 @@ struct Version {
int minor;
int patch;
}
-enum _ver = Version(0, 8, 1);
+enum _ver = Version(0, 8, 2);
#+END_SRC
** compilation restrictions (supported compilers)
@@ -807,7 +807,16 @@ auto _env = [
#+BEGIN_SRC d
auto _manifest_matter = PathMatters!()(_opt_action, _env, "");
auto _manifests = [ _manifest_matter ];
+ConfCompositePlus _make_and_meta_struct_tst;
foreach(arg; args[1..$]) {
+ _manifest_matter = PathMatters!()(_opt_action, _env, arg); // gather input markup source file names for processing
+ auto _config_local_site_struct = readConfigSite!()(_manifest_matter, _env);
+ { /+ local site config +/
+ if (_config_local_site_struct.filetype == "yaml") {
+ import doc_reform.meta.conf_make_meta_yaml;
+ _make_and_meta_struct_tst = _config_local_site_struct.configParseYAMLreturnDocReformStruct!()(_make_and_meta_struct_tst, _manifest_matter);
+ }
+ }
auto _manifest_start = PodManifest!()(arg);
if (arg.match(rgx.flag_action)) {
flag_action ~= " " ~ arg; // flags not taken by getopt
@@ -827,21 +836,104 @@ foreach(arg; args[1..$]) {
if (exists(sisudoc_txt_)) {
try {
if (exists(sisudoc_txt_)) {
- pod_manifest_root_content_paths_to_markup_location_raw_ = sisudoc_txt_.readText;
+ import dyaml;
+ try {
+ Node pod_manifest_yaml = Loader.fromFile(sisudoc_txt_).load();
+ if ("doc" in pod_manifest_yaml) {
+ if (pod_manifest_yaml["doc"].type.mapping
+ && pod_manifest_yaml["doc"].tag.match(rgx.yaml_tag_is_map)
+ ) {
+ if ("path" in pod_manifest_yaml["doc"]) {
+ if (pod_manifest_yaml["doc"]["path"].tag.match(rgx.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.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.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.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.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.yaml_tag_is_str)
+ ) {
+ if ("language" in pod_manifest_yaml["doc"]) {
+ if (pod_manifest_yaml["doc"]["language"].tag.match(rgx.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.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) {
} catch (FileException ex) {
// Handle errors
}
- if (pod_manifest_root_content_paths_to_markup_location_raw_.match(rgx.pod_content_location)) { // (file name followed by language codes \n)+
- foreach (m; pod_manifest_root_content_paths_to_markup_location_raw_.matchAll(rgx.pod_content_location)) {
- foreach (n; m.captures[2].matchAll(rgx.language_codes)) {
- markup_contents_location_ ~= "media/text/" ~ n.captures[1].to!string ~ "/" ~ m.captures[1].to!string ~ "\n";
- }
- }
- } else { // (file name with path \n)+
- markup_contents_location_ = pod_manifest_root_content_paths_to_markup_location_raw_;
- }
} else {
writeln("manifest not found: ", sisudoc_txt_);
}