diff options
author | Ralph Amissah <ralph.amissah@gmail.com> | 2019-10-02 15:17:02 -0400 |
---|---|---|
committer | Ralph Amissah <ralph.amissah@gmail.com> | 2019-10-17 19:07:20 -0400 |
commit | 5e23b12e0cdc531554e21ca464d2d0a2f8205645 (patch) | |
tree | 010335171b2331269d21cbcda3f169c36a09c4db /src/doc_reform/source | |
parent | document headers & config: yaml introduced (diff) |
path related, mostly cosmetic code
Diffstat (limited to 'src/doc_reform/source')
-rw-r--r-- | src/doc_reform/source/paths_source.d | 102 | ||||
-rw-r--r-- | src/doc_reform/source/read_config_files.d | 8 |
2 files changed, 55 insertions, 55 deletions
diff --git a/src/doc_reform/source/paths_source.d b/src/doc_reform/source/paths_source.d index 1bf3af1..b1622bd 100644 --- a/src/doc_reform/source/paths_source.d +++ b/src/doc_reform/source/paths_source.d @@ -104,7 +104,7 @@ template PathMatters() { return (_manifest.pod_manifest_path.length > 0) ? true : false; } auto collection_root() { - auto _collection_root = asNormalizedPath(chainPath(_manifest.pod_manifest_path, "..")).array; + auto _collection_root = ((chainPath(_manifest.pod_manifest_path, "..")).asNormalizedPath).array; return _collection_root; } string manifest_filename() { @@ -252,10 +252,10 @@ template PathMatters() { auto m = (absolute_path_to_src) .match(regex(r"[/](?P<dir>(?:[a-zA-Z0-9._-]+))/pod/" ~ filename.stripExtension)) ) { - _dir = asNormalizedPath(path_and_fn.chainPath("../../")).array; + _dir = ((path_and_fn.chainPath("../../")).asNormalizedPath).array; assert(_dir == m.captures["dir"]); } else { - _dir = asNormalizedPath(path_and_fn.chainPath("../../../")).array; + _dir = ((path_and_fn.chainPath("../../../")).asNormalizedPath).array; assert(_dir == absolute_path_to_src .match(rgx.src_base_parent_dir_name).captures["dir"]); } @@ -270,9 +270,9 @@ template PathMatters() { auto m = (absolute_path_to_src) .match(regex(r"[/](?P<dir>(?:[a-zA-Z0-9._-]+))/pod/" ~ filename.stripExtension)) ) { - _dir = asNormalizedPath(path_and_fn.chainPath("../../")).array; + _dir = ((path_and_fn.chainPath("../../")).asNormalizedPath).array; } else { - _dir = asNormalizedPath(path_and_fn.chainPath("../../../")).array; + _dir = ((path_and_fn.chainPath("../../../")).asNormalizedPath).array; } return _dir; } @@ -282,14 +282,14 @@ template PathMatters() { auto m = (absolute_path_to_src) .match(rgx.src_formalised_file_path_parts) ) { - _dir = asNormalizedPath(m.captures["pth"]).array; + _dir = ((m.captures["pth"]).asNormalizedPath).array; } else if ( auto m = (absolute_path_to_src) .match(regex(r"[/](?P<dir>(?:[a-zA-Z0-9._-]+))/pod/" ~ filename.stripExtension)) ) { - _dir = asNormalizedPath(path_and_fn.chainPath("../")).array; + _dir = ((path_and_fn.chainPath("../")).asNormalizedPath).array; } else { - _dir = asNormalizedPath(path_and_fn.chainPath("../../")).array; + _dir = ((path_and_fn.chainPath("../../")).asNormalizedPath).array; } if (_opt_actions.debug_do) { writeln("--> (base_dir_path) ", _dir); @@ -297,7 +297,7 @@ template PathMatters() { return _dir; } string media_dir_path() { - string _dir = asNormalizedPath(base_dir_path.chainPath("media")).array; + string _dir = ((base_dir_path.chainPath("media")).asNormalizedPath).array; return _dir; } string image_dir_path() { @@ -305,10 +305,10 @@ template PathMatters() { string[] _possible_img_pths = [ "./image", "../image", "../../image" ]; string _img_pth_found = ""; if (is_pod) { - _img_pth_found = asNormalizedPath(file_with_absolute_path.dirName ~ "/../../image").array; + _img_pth_found = ((file_with_absolute_path.dirName ~ "/../../image").asNormalizedPath).array; } else { string _img_pth(string _possible_img_pth) { - return asNormalizedPath(file_with_absolute_path.dirName ~ "/" ~ _possible_img_pth).array; + return ((file_with_absolute_path.dirName ~ "/" ~ _possible_img_pth).asNormalizedPath).array; } foreach(_possible_img_pth; _possible_img_pths) { if (exists(_img_pth(_possible_img_pth))) { @@ -325,7 +325,7 @@ template PathMatters() { return _img_pth_found; } auto conf_dir_path() { - return asNormalizedPath(base_dir_path.chainPath("conf")).array; + return ((base_dir_path.chainPath("conf")).asNormalizedPath).array; } auto base_parent_dir() { string _dir; @@ -366,7 +366,7 @@ template PathMatters() { if ((_opt_actions.output_dir_set.length > 0) && isValidPath(_opt_actions.output_dir_set) ) { - _output_path = asNormalizedPath(_opt_actions.output_dir_set).array; + _output_path = ((_opt_actions.output_dir_set).asNormalizedPath).array; if (!exists(_output_path)) { try { _output_path.mkdirRecurse; @@ -429,11 +429,11 @@ template ConfigFilePaths() { ]; } else { /+ config document (& or local site) on filesystem +/ - string _dr_doc_conf_pwd = asNormalizedPath(chainPath(to!string(_env["pwd"]), "dr_doc/conf")).array; // think about - string _dr_doc_conf_pwd_a = asNormalizedPath(chainPath(to!string(_env["pwd"]), "conf")).array; - string _dr_doc_conf_pwd_b = asNormalizedPath(chainPath(to!string(_env["pwd"]), "../conf")).array; - string _dr_doc_conf_pwd_c = asNormalizedPath(chainPath(to!string(_env["pwd"]), "../../conf")).array; - string _dr_doc_conf_pwd_d = asNormalizedPath(chainPath(to!string(_env["pwd"]), "../../../conf")).array; + string _dr_doc_conf_pwd = ((chainPath(to!string(_env["pwd"]), "dr_doc/conf")).asNormalizedPath).array; // think about + string _dr_doc_conf_pwd_a = ((chainPath(to!string(_env["pwd"]), "conf")).asNormalizedPath).array; + string _dr_doc_conf_pwd_b = ((chainPath(to!string(_env["pwd"]), "../conf")).asNormalizedPath).array; + string _dr_doc_conf_pwd_c = ((chainPath(to!string(_env["pwd"]), "../../conf")).asNormalizedPath).array; + string _dr_doc_conf_pwd_d = ((chainPath(to!string(_env["pwd"]), "../../../conf")).asNormalizedPath).array; /+ return paths +/ _possible_config_path_locations = [ _dr_doc_conf_pwd, @@ -451,14 +451,14 @@ template ConfigFilePaths() { string[] config_local_site() { /+ FIX clean up conf paths ↓ +/ /+ config local site (file system only, not in pod) +/ - string _dot_pwd = asNormalizedPath(chainPath(to!string(_env["pwd"]), ".dr")).array; - string _underscore_pwd = asNormalizedPath(chainPath(to!string(_env["pwd"]), "_dr")).array; - string _dot_home = asNormalizedPath(chainPath(to!string(_env["home"]), ".dr")).array; + string _dot_pwd = ((chainPath(to!string(_env["pwd"]), ".dr")).asNormalizedPath).array; + string _underscore_pwd = ((chainPath(to!string(_env["pwd"]), "_dr")).asNormalizedPath).array; + string _dot_home = ((chainPath(to!string(_env["home"]), ".dr")).asNormalizedPath).array; /+ return paths +/ string[] _possible_config_path_locations; if (_manifest.src.is_pod) { - string _collection_root_a = asNormalizedPath(chainPath(to!string(_manifest.pod.collection_root.to!string), ".dr")).array; - string _collection_root_b = asNormalizedPath(chainPath(to!string(_manifest.pod.collection_root.to!string), "_dr")).array; + string _collection_root_a = ((chainPath(to!string(_manifest.pod.collection_root.to!string), ".dr")).asNormalizedPath).array; + string _collection_root_b = ((chainPath(to!string(_manifest.pod.collection_root.to!string), "_dr")).asNormalizedPath).array; _possible_config_path_locations = [ _dot_pwd, _underscore_pwd, @@ -469,11 +469,11 @@ template ConfigFilePaths() { ]; } else { /+ config document (& or local site) on filesystem +/ - string _dr_doc_conf_pwd = asNormalizedPath(chainPath(to!string(_env["pwd"]), "dr_doc/conf")).array; - string _dr_doc_conf_pwd_a = asNormalizedPath(chainPath(to!string(_env["pwd"]), "conf")).array; - string _dr_doc_conf_pwd_b = asNormalizedPath(chainPath(to!string(_env["pwd"]), "../conf")).array; - string _dr_doc_conf_pwd_c = asNormalizedPath(chainPath(to!string(_env["pwd"]), "../../conf")).array; - string _dr_doc_conf_pwd_d = asNormalizedPath(chainPath(to!string(_env["pwd"]), "../../../conf")).array; + string _dr_doc_conf_pwd = ((chainPath(to!string(_env["pwd"]), "dr_doc/conf")).asNormalizedPath).array; + string _dr_doc_conf_pwd_a = ((chainPath(to!string(_env["pwd"]), "conf")).asNormalizedPath).array; + string _dr_doc_conf_pwd_b = ((chainPath(to!string(_env["pwd"]), "../conf")).asNormalizedPath).array; + string _dr_doc_conf_pwd_c = ((chainPath(to!string(_env["pwd"]), "../../conf")).asNormalizedPath).array; + string _dr_doc_conf_pwd_d = ((chainPath(to!string(_env["pwd"]), "../../../conf")).asNormalizedPath).array; _possible_config_path_locations = [ _dr_doc_conf_pwd, _dr_doc_conf_pwd_a, @@ -523,25 +523,25 @@ template DocReformPathsSRC() { return "dr_doc"; } auto media_root() { - return asNormalizedPath(doc_root.chainPath("media")).array; + return ((doc_root.chainPath("media")).asNormalizedPath).array; } auto conf_root() { - return asNormalizedPath(doc_root.chainPath("conf")).array; + return ((doc_root.chainPath("conf")).asNormalizedPath).array; } auto text_root() { - return asNormalizedPath(media_root.chainPath("text")).array; + return ((media_root.chainPath("text")).asNormalizedPath).array; } auto image_root() { - return asNormalizedPath(media_root.chainPath("image")).array; + return ((media_root.chainPath("image")).asNormalizedPath).array; } auto doc_src_fn_with_path_for_text_root_and_lng() { - return asNormalizedPath(text_root.chainPath(language)).array; + return ((text_root.chainPath(language)).asNormalizedPath).array; } auto doc_src_fn() { - return asNormalizedPath(_fn_src_and_path.baseName).array; + return ((_fn_src_and_path.baseName).asNormalizedPath).array; } auto doc_src_with_path() { - return asNormalizedPath(pwd.chainPath(_fn_src_and_path)).array; + return ((pwd.chainPath(_fn_src_and_path)).asNormalizedPath).array; } } return drSrcPaths(); @@ -626,7 +626,7 @@ template DocReformPathsPods() { } auto pod_root(string fn_src) { auto pth_1_ = ""; - auto pth_2_ = asNormalizedPath(base(fn_src).filesystem_open_zpod.chainPath("")).array; + auto pth_2_ = ((base(fn_src).filesystem_open_zpod.chainPath("")).asNormalizedPath).array; struct _pods { auto zpod() { return pth_1_; @@ -640,7 +640,7 @@ template DocReformPathsPods() { auto conf_root(string fn_src) { auto pod_root_ = pod_root(fn_src); auto pth_1_ = "conf"; - auto pth_2_ = asNormalizedPath(pod_root(fn_src).filesystem_open_zpod.chainPath("conf")).array; + auto pth_2_ = ((pod_root(fn_src).filesystem_open_zpod.chainPath("conf")).asNormalizedPath).array; struct _pods { auto zpod() { return pth_1_; @@ -654,8 +654,8 @@ template DocReformPathsPods() { } auto css(string fn_src) { auto pod_root_ = pod_root(fn_src); - auto pth_1_ = asNormalizedPath(conf_root(fn_src).zpod.chainPath("css")).array; - auto pth_2_ = asNormalizedPath(conf_root(fn_src).filesystem_open_zpod.chainPath("css")).array; + auto pth_1_ = ((conf_root(fn_src).zpod.chainPath("css")).asNormalizedPath).array; + auto pth_2_ = ((conf_root(fn_src).filesystem_open_zpod.chainPath("css")).asNormalizedPath).array; struct _pods { auto zpod() { return pth_1_; @@ -670,7 +670,7 @@ template DocReformPathsPods() { auto media_root(string fn_src) { auto pod_root_ = pod_root(fn_src); auto pth_1_ = "media"; - auto pth_2_ = asNormalizedPath(pod_root(fn_src).filesystem_open_zpod.chainPath("media")).array; + auto pth_2_ = ((pod_root(fn_src).filesystem_open_zpod.chainPath("media")).asNormalizedPath).array; struct _pods { auto zpod() { return pth_1_; @@ -684,8 +684,8 @@ template DocReformPathsPods() { } auto text_root(string fn_src) { auto pod_root_ = pod_root(fn_src); - auto pth_1_ = asNormalizedPath(media_root(fn_src).zpod.chainPath("text")).array; - auto pth_2_ = asNormalizedPath(media_root(fn_src).filesystem_open_zpod.chainPath("text")).array; + auto pth_1_ = ((media_root(fn_src).zpod.chainPath("text")).asNormalizedPath).array; + auto pth_2_ = ((media_root(fn_src).filesystem_open_zpod.chainPath("text")).asNormalizedPath).array; struct _pods { auto zpod() { return pth_1_; @@ -714,8 +714,8 @@ template DocReformPathsPods() { } auto doc_lng(string fn_src, string lng) { auto pod_root_ = pod_root(fn_src); - auto pth_1_ = asNormalizedPath(text_root(fn_src).zpod.chainPath(lng)).array; - auto pth_2_ = asNormalizedPath(text_root(fn_src).filesystem_open_zpod.chainPath(lng)).array; + auto pth_1_ = ((text_root(fn_src).zpod.chainPath(lng)).asNormalizedPath).array; + auto pth_2_ = ((text_root(fn_src).filesystem_open_zpod.chainPath(lng)).asNormalizedPath).array; struct _pods { auto zpod() { return pth_1_; @@ -729,8 +729,8 @@ template DocReformPathsPods() { } auto image_root(string fn_src) { auto pod_root_ = pod_root(fn_src); - auto pth_1_ = asNormalizedPath(media_root(fn_src).zpod.chainPath("image")).array; - auto pth_2_ = asNormalizedPath(media_root(fn_src).filesystem_open_zpod.chainPath("image")).array; + auto pth_1_ = ((media_root(fn_src).zpod.chainPath("image")).asNormalizedPath).array; + auto pth_2_ = ((media_root(fn_src).filesystem_open_zpod.chainPath("image")).asNormalizedPath).array; struct _pods { auto zpod() { return pth_1_; @@ -746,7 +746,7 @@ template DocReformPathsPods() { auto pod_root_ = pod_root(fn_src); auto _manifest = PodManifest!()(fn_src).pod_manifest_filename; auto pth_1_ = _manifest; - auto pth_2_ = asNormalizedPath(pod_root(fn_src).filesystem_open_zpod.chainPath(_manifest)).array; + auto pth_2_ = ((pod_root(fn_src).filesystem_open_zpod.chainPath(_manifest)).asNormalizedPath).array; struct _pods { auto zpod() { return pth_1_; @@ -760,8 +760,8 @@ template DocReformPathsPods() { } auto fn_doc(string fn_src, string lng) { auto pod_root_ = pod_root(fn_src); - auto pth_1_ = asNormalizedPath(doc_lng(fn_src, lng).zpod.chainPath(fn_src.baseName)).array; - auto pth_2_ = asNormalizedPath(doc_lng(fn_src, lng).filesystem_open_zpod.chainPath(fn_src.baseName)).array; + auto pth_1_ = ((doc_lng(fn_src, lng).zpod.chainPath(fn_src.baseName)).asNormalizedPath).array; + auto pth_2_ = ((doc_lng(fn_src, lng).filesystem_open_zpod.chainPath(fn_src.baseName)).asNormalizedPath).array; struct _pods { auto zpod() { return pth_1_; @@ -775,8 +775,8 @@ template DocReformPathsPods() { } auto fn_doc_insert(string fn_src, string fn_insert, string lng) { auto pod_root_ = pod_root(fn_src); - auto pth_1_ = asNormalizedPath(doc_lng(fn_src, lng).zpod.chainPath(fn_insert.baseName)).array; - auto pth_2_ = asNormalizedPath(doc_lng(fn_src, lng).filesystem_open_zpod.chainPath(fn_insert.baseName)).array; + auto pth_1_ = ((doc_lng(fn_src, lng).zpod.chainPath(fn_insert.baseName)).asNormalizedPath).array; + auto pth_2_ = ((doc_lng(fn_src, lng).filesystem_open_zpod.chainPath(fn_insert.baseName)).asNormalizedPath).array; struct _pods { auto zpod() { return pth_1_; diff --git a/src/doc_reform/source/read_config_files.d b/src/doc_reform/source/read_config_files.d index 96f604b..93f8a35 100644 --- a/src/doc_reform/source/read_config_files.d +++ b/src/doc_reform/source/read_config_files.d @@ -20,7 +20,7 @@ static template configReadInSiteSTR() { writeln("WARNING (io debug) in config possible path locations: ", possible_config_path_locations); } foreach(pth; possible_config_path_locations) { - auto conf_file = asNormalizedPath(chainPath(pth.to!string, conf_toml)).array; + auto conf_file = ((chainPath(pth.to!string, conf_toml)).asNormalizedPath).array; if (config_file_str.length > 0) { break; } @@ -55,7 +55,7 @@ static template configReadInDocSTR() { writeln("WARNING (io debug) in config possible path locations: ", possible_config_path_locations); } foreach(pth; possible_config_path_locations) { - auto conf_file = asNormalizedPath(chainPath(pth.to!string, conf_toml)).array; + auto conf_file = ((chainPath(pth.to!string, conf_toml)).asNormalizedPath).array; if (config_file_str.length > 0) { break; } @@ -109,7 +109,7 @@ static template readConfigSite() { string[] possible_config_path_locations = _conf_file_details.possible_config_path_locations.config_local_site; foreach(conf_fn; [_conf_file_details.config_filename_site]) { foreach(pth; possible_config_path_locations) { - char[] conf_file = asNormalizedPath(chainPath(pth.to!string, conf_fn)).array; + char[] conf_file = ((chainPath(pth.to!string, conf_fn)).asNormalizedPath).array; conf_filename = conf_fn; if (config_file_str.length > 0) { // conf_filename = conf_fn; @@ -166,7 +166,7 @@ static template readConfigDoc() { string[] possible_config_path_locations = _conf_file_details.possible_config_path_locations.dr_document_make; foreach(conf_fn; [_conf_file_details.config_filename_document]) { foreach(pth; possible_config_path_locations) { - auto conf_file = asNormalizedPath(chainPath(pth.to!string, conf_fn)).array; + auto conf_file = ((chainPath(pth.to!string, conf_fn)).asNormalizedPath).array; conf_filename = conf_fn; if (config_file_str.length > 0) { // conf_filename = conf_fn; |