From 5e23b12e0cdc531554e21ca464d2d0a2f8205645 Mon Sep 17 00:00:00 2001 From: Ralph Amissah Date: Wed, 2 Oct 2019 15:17:02 -0400 Subject: path related, mostly cosmetic code --- src/doc_reform/doc_reform.d | 3 +- src/doc_reform/meta/rgx.d | 4 +- src/doc_reform/output/paths_output.d | 136 +++++++++++++++--------------- src/doc_reform/output/rgx.d | 4 +- src/doc_reform/source/paths_source.d | 102 +++++++++++----------- src/doc_reform/source/read_config_files.d | 8 +- 6 files changed, 128 insertions(+), 129 deletions(-) (limited to 'src/doc_reform') diff --git a/src/doc_reform/doc_reform.d b/src/doc_reform/doc_reform.d index 58c55c8..9c41895 100755 --- a/src/doc_reform/doc_reform.d +++ b/src/doc_reform/doc_reform.d @@ -563,11 +563,10 @@ void main(string[] args) { "pwd" : environment["PWD"], "home" : environment["HOME"], ]; - auto _manifest_start = PodManifest!()(""); auto _manifest_matter = PathMatters!()(_opt_action, _env, ""); auto _manifests = [ _manifest_matter ]; foreach(arg; args[1..$]) { - _manifest_start = PodManifest!()(arg); + auto _manifest_start = PodManifest!()(arg); if (arg.match(rgx.flag_action)) { flag_action ~= " " ~ arg; // flags not taken by getopt } else if ( diff --git a/src/doc_reform/meta/rgx.d b/src/doc_reform/meta/rgx.d index bad5b52..0168a08 100644 --- a/src/doc_reform/meta/rgx.d +++ b/src/doc_reform/meta/rgx.d @@ -221,8 +221,8 @@ static template DocReformRgxInit() { static nbsp_char_and_space = ctRegex!(`░[ ]`, "mg"); static special_markup_chars = ctRegex!(`[【】〖〗┥┝┤├¤░┘┙┚┼┿╂┊┏┚┆■]`, "mg"); static src_pth_sst_or_ssm = ctRegex!(`^(?P[/]?(?:[a-zA-Z0-9._-]+/)*)(?P[a-zA-Z0-9._-]+[.](?Pss[tm]))$`); - static src_pth_pod_sst_or_ssm = ctRegex!(`^(?P[/]?(?:[a-zA-Z0-9._-]+/)*)media/text/[a-z]{2}/(?P[a-zA-Z0-9._-]+[.]ss[tm])$`); - static src_pth_contents = ctRegex!(`^(?P[/]?(?:[a-zA-Z0-9._-]+/)*)(?P[a-zA-Z0-9._-]+)/pod[.]manifest$`); + static src_pth_pod_sst_or_ssm = ctRegex!(`^(?P[/]?(?:[a-zA-Z0-9._-]+/)*)media/text/[a-z]{2}/(?P[a-zA-Z0-9][a-zA-Z0-9._-]*?[.]ss[tm])$`); + static src_pth_contents = ctRegex!(`^(?P[/]?(?:[a-zA-Z0-9._-]+/)*)(?P[a-zA-Z0-9][a-zA-Z0-9._-]*)/pod[.]manifest$`); static src_pth_zip = ctRegex!(`^(?P[/]?(?:[a-zA-Z0-9._-]+/)*)(?P[a-zA-Z0-9._-]+[.]zip)$`); static src_pth_unzip_pod = ctRegex!(`^(?Pmedia/text/[a-z]{2}/)*(?P[a-zA-Z0-9._-]+[.]ss[im])$`); static src_pth_types = diff --git a/src/doc_reform/output/paths_output.d b/src/doc_reform/output/paths_output.d index ba72bfb..048f9e9 100644 --- a/src/doc_reform/output/paths_output.d +++ b/src/doc_reform/output/paths_output.d @@ -18,7 +18,7 @@ template DocReformOutPaths() { ? output_pth_root : ""; } string output_base() { - return asNormalizedPath(output_root.chainPath(lng)).array; + return ((output_root.chainPath(lng)).asNormalizedPath).array; } } return _PathsStruct(); @@ -34,7 +34,7 @@ template DocReformOutPathSQLite() { ? output_pth_root : ""; } string output_base() { - return asNormalizedPath(output_root).array; + return ((output_root).asNormalizedPath).array; } } return _PathsStruct(); @@ -90,37 +90,37 @@ template DocReformDocRootTreeHTML() { return fn_src.baseName.stripExtension; } string base_filename_scroll(string fn_src) { - return base_filename(fn_src) ~ "." ~ lng; + return base_filename(fn_src); } string base_filename_seg(string fn_src) { - return base_filename(fn_src) ~ "." ~ lng; + return base_filename(fn_src); } string doc_root() { - return asNormalizedPath(lng_pth.output_root).array; + return ((lng_pth.output_root).asNormalizedPath).array; } string base() { - return asNormalizedPath((lng).chainPath(base_dir)).array; + return (((lng).chainPath(base_dir)).asNormalizedPath).array; } string image() { - return asNormalizedPath("image").array; + return (("image").asNormalizedPath).array; } string css() { - return asNormalizedPath("css").array; + return (("css").asNormalizedPath).array; } string fn_seg_css() { - return asNormalizedPath(css.chainPath("html_seg.css")).array; + return ((css.chainPath("html_seg.css")).asNormalizedPath).array; } string fn_scroll_css() { - return asNormalizedPath(css.chainPath("html_scroll.css")).array; + return ((css.chainPath("html_scroll.css")).asNormalizedPath).array; } string seg(string fn_src) { - return asNormalizedPath(base.chainPath(base_filename_seg(fn_src))).array; + return ((base.chainPath(base_filename_seg(fn_src))).asNormalizedPath).array; } string fn_scroll(string fn_src) { - return asNormalizedPath(base.chainPath(base_filename_scroll(fn_src) ~ suffix)).array; + return ((base.chainPath(base_filename_scroll(fn_src) ~ suffix)).asNormalizedPath).array; } string fn_seg(string fn_src, string seg_filename) { - return asNormalizedPath(seg(fn_src).chainPath(seg_filename ~ suffix)).array; + return ((seg(fn_src).chainPath(seg_filename ~ suffix)).asNormalizedPath).array; } string tail_seg(string fn_src) { return lng ~ "/html/" ~ base_filename_seg(fn_src); @@ -147,34 +147,34 @@ template DocReformPathsHTML() { string suffix = ".html"; struct _PathsStruct { string doc_root() { - return asNormalizedPath(root_pth.chainPath(doc_tree.doc_root)).array; + return ((root_pth.chainPath(doc_tree.doc_root)).asNormalizedPath).array; } string harvest(string fn_harvest) { return doc_root ~ "/" ~ fn_harvest; } string base() { - return asNormalizedPath(root_pth.chainPath(doc_tree.base)).array; + return ((root_pth.chainPath(doc_tree.base)).asNormalizedPath).array; } string image() { - return asNormalizedPath(root_pth.chainPath(doc_tree.image)).array; + return ((root_pth.chainPath(doc_tree.image)).asNormalizedPath).array; } string css() { - return asNormalizedPath(root_pth.chainPath(doc_tree.css)).array; + return ((root_pth.chainPath(doc_tree.css)).asNormalizedPath).array; } string fn_seg_css() { - return asNormalizedPath(root_pth.chainPath(doc_tree.fn_seg_css)).array; + return ((root_pth.chainPath(doc_tree.fn_seg_css)).asNormalizedPath).array; } string fn_scroll_css() { - return asNormalizedPath(root_pth.chainPath(doc_tree.fn_scroll_css)).array; + return ((root_pth.chainPath(doc_tree.fn_scroll_css)).asNormalizedPath).array; } string seg(string fn_src) { - return asNormalizedPath(root_pth.chainPath(doc_tree.seg(fn_src))).array; + return ((root_pth.chainPath(doc_tree.seg(fn_src))).asNormalizedPath).array; } string fn_scroll(string fn_src) { - return asNormalizedPath(root_pth.chainPath(doc_tree.fn_scroll(fn_src))).array; + return ((root_pth.chainPath(doc_tree.fn_scroll(fn_src))).asNormalizedPath).array; } string fn_seg(string fn_src, string seg_filename) { - return asNormalizedPath(root_pth.chainPath(doc_tree.fn_seg(fn_src, seg_filename))).array; + return ((root_pth.chainPath(doc_tree.fn_seg(fn_src, seg_filename))).asNormalizedPath).array; } string tail_seg(string fn_src) { return doc_tree.tail_seg(fn_src); @@ -202,7 +202,7 @@ template DocReformUrlsHTML() { string suffix = ".html"; struct _PathsStruct { string doc_root() { - return url_doc_root ~ asNormalizedPath(doc_tree.doc_root).array; + return url_doc_root ~ ((doc_tree.doc_root).asNormalizedPath).array; } string harvest(string fn_harvest) { return format(q"┃%s/%s┃", @@ -213,62 +213,62 @@ template DocReformUrlsHTML() { string base() { return format(q"┃%s/%s┃", url_doc_root, - asNormalizedPath(doc_tree.base).array, + ((doc_tree.base).asNormalizedPath).array, ); } string image() { return format(q"┃%s/%s┃", url_doc_root, - asNormalizedPath(doc_tree.image).array, + ((doc_tree.image).asNormalizedPath).array, ); } string css() { return format(q"┃%s/%s┃", url_doc_root, - asNormalizedPath(doc_tree.css).array, + ((doc_tree.css).asNormalizedPath).array, ); } string fn_seg_css() { return format(q"┃%s/%s┃", url_doc_root, - asNormalizedPath(doc_tree.fn_seg_css).array, + ((doc_tree.fn_seg_css).asNormalizedPath).array, ); } string fn_scroll_css() { return format(q"┃%s/%s┃", url_doc_root, - asNormalizedPath(doc_tree.fn_scroll_css).array, + ((doc_tree.fn_scroll_css).asNormalizedPath).array, ); } string seg(string fn_src) { return format(q"┃%s/%s┃", url_doc_root, - asNormalizedPath(doc_tree.seg(fn_src)).array, + ((doc_tree.seg(fn_src)).asNormalizedPath).array, ); } string fn_scroll(string fn_src) { return format(q"┃%s/%s┃", url_doc_root, - asNormalizedPath(doc_tree.fn_scroll(fn_src)).array, + ((doc_tree.fn_scroll(fn_src)).asNormalizedPath).array, ); } string fn_seg(string fn_src, string seg_filename) { return format(q"┃%s/%s┃", url_doc_root, - asNormalizedPath(doc_tree.fn_seg(fn_src, seg_filename)).array, + ((doc_tree.fn_seg(fn_src, seg_filename)).asNormalizedPath).array, ); } string fn_scroll_obj_num(string fn_src, string obj_num) { return format(q"┃%s/%s#%s┃", url_doc_root, - asNormalizedPath(doc_tree.fn_scroll(fn_src)).array, + ((doc_tree.fn_scroll(fn_src)).asNormalizedPath).array, obj_num, ); } string fn_seg_obj_num(string fn_src, string seg_filename, string obj_num) { return format(q"┃%s/%s#%s┃", url_doc_root, - asNormalizedPath(doc_tree.fn_seg(fn_src, seg_filename)).array, + ((doc_tree.fn_seg(fn_src, seg_filename)).asNormalizedPath).array, obj_num, ); } @@ -296,7 +296,7 @@ template DocReformPathsEPUB() { string base_dir = "epub"; struct _PathsStruct { string base() { - return asNormalizedPath((out_pth.output_base).chainPath(base_dir)).array; + return (((out_pth.output_base).chainPath(base_dir)).asNormalizedPath).array; } string base_filename(string fn_src) { return fn_src.baseName.stripExtension; @@ -305,43 +305,43 @@ template DocReformPathsEPUB() { return base_filename(fn_src) ~ "." ~ lng; } string doc_meta_inf() { - return asNormalizedPath("META-INF").array; + return (("META-INF").asNormalizedPath).array; } string doc_oebps() { - return asNormalizedPath("OEBPS").array; + return (("OEBPS").asNormalizedPath).array; } string doc_oebps_css() { - return asNormalizedPath(doc_oebps.chainPath("css")).array; + return ((doc_oebps.chainPath("css")).asNormalizedPath).array; } string doc_oebps_image() { - return asNormalizedPath(doc_oebps.chainPath("image")).array; + return ((doc_oebps.chainPath("image")).asNormalizedPath).array; } string epub_file(string fn_src) { - return asNormalizedPath(base.chainPath(base_filename_epub(fn_src) ~ ".epub")).array; + return ((base.chainPath(base_filename_epub(fn_src) ~ ".epub")).asNormalizedPath).array; } string dirtop() { return "".chainPath("").array; } string fn_mimetypes() { - return asNormalizedPath(dirtop.chainPath("mimetypes")).array; + return ((dirtop.chainPath("mimetypes")).asNormalizedPath).array; } string fn_dmi_container_xml() { - return asNormalizedPath(doc_meta_inf.chainPath("container.xml")).array; + return ((doc_meta_inf.chainPath("container.xml")).asNormalizedPath).array; } string fn_oebps_toc_nav_xhtml() { - return asNormalizedPath(doc_oebps.chainPath("toc_nav.xhtml")).array; + return ((doc_oebps.chainPath("toc_nav.xhtml")).asNormalizedPath).array; } string fn_oebps_toc_ncx() { - return asNormalizedPath(doc_oebps.chainPath("toc.ncx")).array; + return ((doc_oebps.chainPath("toc.ncx")).asNormalizedPath).array; } string fn_oebps_content_opf() { - return asNormalizedPath(doc_oebps.chainPath("content.opf")).array; + return ((doc_oebps.chainPath("content.opf")).asNormalizedPath).array; } string fn_oebps_content_xhtml(string seg_filename) { - return asNormalizedPath(doc_oebps.chainPath(seg_filename ~ ".xhtml")).array; + return ((doc_oebps.chainPath(seg_filename ~ ".xhtml")).asNormalizedPath).array; } string fn_oebps_css() { - return asNormalizedPath(doc_oebps_css.chainPath("epub.css")).array; + return ((doc_oebps_css.chainPath("epub.css")).asNormalizedPath).array; } /+ debug +/ string dbg_docdir(string fn_src) { @@ -397,55 +397,55 @@ template DocReformPathsODT() { string base_dir = "odf"; struct _PathsStruct { string base_pth() { // dir will contain odt document file (also debug file tree) - return asNormalizedPath((out_pth.output_base).chainPath(base_dir)).array; + return (((out_pth.output_base).chainPath(base_dir)).asNormalizedPath).array; } string odt_file() { - return asNormalizedPath(base_pth.chainPath(doc_matters.src.doc_uid_out ~ ".odt")).array; + return ((base_pth.chainPath(doc_matters.src.doc_uid_out ~ ".odt")).asNormalizedPath).array; } string dirtop(string type) { return (type == "zip") ? "".chainPath("").array - : asNormalizedPath(base_pth.chainPath(doc_matters.src.doc_uid_out)).array; + : ((base_pth.chainPath(doc_matters.src.doc_uid_out)).asNormalizedPath).array; } string mimetype(string type="fs") { assert(type == "zip" || "fs"); - return asNormalizedPath(dirtop(type).chainPath("mimetype")).array; + return ((dirtop(type).chainPath("mimetype")).asNormalizedPath).array; } string manifest_rdf(string type="fs") { assert(type == "zip" || "fs"); - return asNormalizedPath(dirtop(type).chainPath("manifest.rdf")).array; + return ((dirtop(type).chainPath("manifest.rdf")).asNormalizedPath).array; } string settings_xml(string type="fs") { assert(type == "zip" || "fs"); - return asNormalizedPath(dirtop(type).chainPath("settings.xml")).array; + return ((dirtop(type).chainPath("settings.xml")).asNormalizedPath).array; } string styles_xml(string type="fs") { assert(type == "zip" || "fs"); - return asNormalizedPath(dirtop(type).chainPath("styles.xml")).array; + return ((dirtop(type).chainPath("styles.xml")).asNormalizedPath).array; } string image_dir(string type="fs") { assert(type == "zip" || "fs"); - return asNormalizedPath(dirtop(type).chainPath("Pictures")).array; + return ((dirtop(type).chainPath("Pictures")).asNormalizedPath).array; } string image(string image_fn_src, string type="fs") { assert(type == "zip" || "fs"); - return asNormalizedPath(image_dir(type).chainPath(image_fn_src)).array; + return ((image_dir(type).chainPath(image_fn_src)).asNormalizedPath).array; } string content_xml(string type="fs") { assert(type == "zip" || "fs"); - return asNormalizedPath(dirtop(type).chainPath("content.xml")).array; + return ((dirtop(type).chainPath("content.xml")).asNormalizedPath).array; } string meta_inf_dir(string type="fs") { assert(type == "zip" || "fs"); - return asNormalizedPath(dirtop(type).chainPath("META-INF")).array; + return ((dirtop(type).chainPath("META-INF")).asNormalizedPath).array; } string manifest_xml(string type="fs") { assert(type == "zip" || "fs"); - return asNormalizedPath(meta_inf_dir(type).chainPath("manifest.xml")).array; + return ((meta_inf_dir(type).chainPath("manifest.xml")).asNormalizedPath).array; } string meta_xml(string type="fs") { assert(type == "zip" || "fs"); - return asNormalizedPath(dirtop(type).chainPath("meta.xml")).array; + return ((dirtop(type).chainPath("meta.xml")).asNormalizedPath).array; } } return _PathsStruct(); @@ -464,17 +464,17 @@ template DocReformPathsLaTeX() { string base() { auto out_pth = DocReformOutPaths!()(doc_matters.output_path, doc_matters.src.language); string base_dir = "latex"; - return asNormalizedPath((out_pth.output_root).chainPath(base_dir)).array; + return (((out_pth.output_root).chainPath(base_dir)).asNormalizedPath).array; } string latex_path_stuff() { - return asNormalizedPath(base.chainPath(base_filename(doc_matters.src.filename))).array; + return ((base.chainPath(base_filename(doc_matters.src.filename))).asNormalizedPath).array; } string latex_file_with_path() { - return asNormalizedPath(base.chainPath(base_filename(doc_matters.src.filename) ~ "." ~ doc_matters.src.language ~ ".tex")).array; + return ((base.chainPath(base_filename(doc_matters.src.filename) ~ "." ~ doc_matters.src.language ~ ".tex")).asNormalizedPath).array; } string images() { string image_dir = "image"; - return asNormalizedPath((base).chainPath(image_dir)).array; + return (((base).chainPath(image_dir)).asNormalizedPath).array; } } return _PathsStruct(); @@ -494,13 +494,13 @@ template DocReformPathsSQLiteDiscrete() { string base() { auto out_pth = DocReformOutPaths!()(output_pth_root, lng); string base_dir = "sqlite"; - return asNormalizedPath((out_pth.output_base).chainPath(base_dir)).array; + return (((out_pth.output_base).chainPath(base_dir)).asNormalizedPath).array; } string seg(string fn_src) { - return asNormalizedPath(base.chainPath(base_filename(fn_src))).array; + return ((base.chainPath(base_filename(fn_src))).asNormalizedPath).array; } string sqlite_file(string fn_src) { - return asNormalizedPath(base.chainPath(base_filename(fn_src) ~ ".sql.db")).array; + return ((base.chainPath(base_filename(fn_src) ~ ".sql.db")).asNormalizedPath).array; } } return _PathsStruct(); @@ -520,10 +520,10 @@ template DocReformPathsSQLite() { string base() { auto out_pth = DocReformOutPathSQLite!()(output_pth_root); // decide whether to have separate files for each language string base_dir = "sqlite"; - return asNormalizedPath((out_pth.output_root).chainPath(base_dir)).array; + return (((out_pth.output_root).chainPath(base_dir)).asNormalizedPath).array; } string sqlite_file() { - return asNormalizedPath(base.chainPath(base_filename(db_name) ~ ".sql.db")).array; + return ((base.chainPath(base_filename(db_name) ~ ".sql.db")).asNormalizedPath).array; } } return _PathsStruct(); diff --git a/src/doc_reform/output/rgx.d b/src/doc_reform/output/rgx.d index c7896ac..89d5858 100644 --- a/src/doc_reform/output/rgx.d +++ b/src/doc_reform/output/rgx.d @@ -18,8 +18,8 @@ static template DocReformOutputRgxInit() { static nbsp_char_and_space = ctRegex!(`░[ ]`, "mg"); static special_markup_chars = ctRegex!(`[【】〖〗┥┝┤├¤░┘┙┚┼┿╂┊┏┚┆■]`, "mg"); static src_pth_sst_or_ssm = ctRegex!(`^(?P[/]?(?:[a-zA-Z0-9._-]+/)*)(?P[a-zA-Z0-9._-]+[.](?Pss[tm]))$`); - static src_pth_pod_sst_or_ssm = ctRegex!(`^(?P[/]?(?:[a-zA-Z0-9._-]+/)*)media/text/[a-z]{2}/(?P[a-zA-Z0-9._-]+[.]ss[tm])$`); - static src_pth_contents = ctRegex!(`^(?P[/]?(?:[a-zA-Z0-9._-]+/)*)(?P[a-zA-Z0-9._-]+)/pod[.]manifest$`); + static src_pth_pod_sst_or_ssm = ctRegex!(`^(?P[/]?(?:[a-zA-Z0-9._-]+/)*)media/text/[a-z]{2}/(?P[a-zA-Z0-9][a-zA-Z0-9._-]*?[.]ss[tm])$`); + static src_pth_contents = ctRegex!(`^(?P[/]?(?:[a-zA-Z0-9._-]+/)*)(?P[a-zA-Z0-9][a-zA-Z0-9._-]*)/pod[.]manifest$`); static src_pth_zip = ctRegex!(`^(?P[/]?(?:[a-zA-Z0-9._-]+/)*)(?P[a-zA-Z0-9._-]+[.]zip)$`); static src_pth_unzip_pod = ctRegex!(`^(?Pmedia/text/[a-z]{2}/)*(?P[a-zA-Z0-9._-]+[.]ss[im])$`); static src_pth_types = 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(?:[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(?:[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(?:[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; -- cgit v1.2.3