From 1dbbdec89acdb2ef12cdfc0572997c4c4652466b Mon Sep 17 00:00:00 2001 From: Ralph Amissah Date: Mon, 4 Dec 2017 01:54:58 -0500 Subject: 0.23.1 use output path specified if any --- org/default_paths.org | 138 ++++++++++++++++++++++++++------------------------ 1 file changed, 72 insertions(+), 66 deletions(-) (limited to 'org/default_paths.org') diff --git a/org/default_paths.org b/org/default_paths.org index 99da708..f40ebdf 100644 --- a/org/default_paths.org +++ b/org/default_paths.org @@ -298,25 +298,25 @@ template SiSUpathsSRC() { return "sisudoc"; } auto media_root() { - return doc_root.chainPath("media").array; + return asNormalizedPath(doc_root.chainPath("media")).array; } auto conf_root() { - return doc_root.chainPath("conf").array; + return asNormalizedPath(doc_root.chainPath("conf")).array; } auto text_root() { - return media_root.chainPath("text").array; + return asNormalizedPath(media_root.chainPath("text")).array; } auto image_root() { - return media_root.chainPath("image").array; + return asNormalizedPath(media_root.chainPath("image")).array; } auto doc_src_fn_with_path_for_text_root_and_lng() { - return text_root.chainPath(language).array; + return asNormalizedPath(text_root.chainPath(language)).array; } auto doc_src_with_relative_path() { - return pwd.chainPath(_fn_src_and_relative_path).array; + return asNormalizedPath(pwd.chainPath(_fn_src_and_relative_path)).array; } auto doc_src_fn() { - return _fn_src_and_relative_path.baseName.array; + return asNormalizedPath(_fn_src_and_relative_path.baseName).array; } } return SisuSrcPaths(); @@ -447,7 +447,7 @@ template SiSUpathsSisupods() { } auto pod_root(string fn_src) { auto pth_1_ = ""; - auto pth_2_ = base(fn_src).filesystem_open_zpod.chainPath("").array; // "sisudoc" + auto pth_2_ = asNormalizedPath(base(fn_src).filesystem_open_zpod.chainPath("")).array; // "sisudoc" struct _pods { auto zpod() { return pth_1_; @@ -461,7 +461,7 @@ template SiSUpathsSisupods() { auto conf_root(string fn_src) { auto pod_root_ = pod_root(fn_src); auto pth_1_ = "conf"; - auto pth_2_ = pod_root(fn_src).filesystem_open_zpod.chainPath("conf").array; + auto pth_2_ = asNormalizedPath(pod_root(fn_src).filesystem_open_zpod.chainPath("conf")).array; struct _pods { auto zpod() { return pth_1_; @@ -475,8 +475,8 @@ template SiSUpathsSisupods() { } auto css(string fn_src) { auto pod_root_ = pod_root(fn_src); - auto pth_1_ = conf_root(fn_src).zpod.chainPath("css").array; - auto pth_2_ = conf_root(fn_src).filesystem_open_zpod.chainPath("css").array; + 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; struct _pods { auto zpod() { return pth_1_; @@ -491,7 +491,7 @@ template SiSUpathsSisupods() { auto media_root(string fn_src) { auto pod_root_ = pod_root(fn_src); auto pth_1_ = "media"; - auto pth_2_ = pod_root(fn_src).filesystem_open_zpod.chainPath("media").array; + auto pth_2_ = asNormalizedPath(pod_root(fn_src).filesystem_open_zpod.chainPath("media")).array; struct _pods { auto zpod() { return pth_1_; @@ -505,8 +505,8 @@ template SiSUpathsSisupods() { } auto text_root(string fn_src) { auto pod_root_ = pod_root(fn_src); - auto pth_1_ = media_root(fn_src).zpod.chainPath("text").array; - auto pth_2_ = media_root(fn_src).filesystem_open_zpod.chainPath("text").array; + 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; struct _pods { auto zpod() { return pth_1_; @@ -535,8 +535,8 @@ template SiSUpathsSisupods() { } auto doc_lng(string fn_src, string lng) { auto pod_root_ = pod_root(fn_src); - auto pth_1_ = text_root(fn_src).zpod.chainPath(lng).array; - auto pth_2_ = text_root(fn_src).filesystem_open_zpod.chainPath(lng).array; + 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; struct _pods { auto zpod() { return pth_1_; @@ -550,8 +550,8 @@ template SiSUpathsSisupods() { } auto image_root(string fn_src) { auto pod_root_ = pod_root(fn_src); - auto pth_1_ = media_root(fn_src).zpod.chainPath("image").array; - auto pth_2_ = media_root(fn_src).filesystem_open_zpod.chainPath("image").array; + 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; struct _pods { auto zpod() { return pth_1_; @@ -567,7 +567,7 @@ template SiSUpathsSisupods() { auto pod_root_ = pod_root(fn_src); auto _manifest = PodManifest!()(fn_src).pod_manifest_filename; auto pth_1_ = _manifest; - auto pth_2_ = pod_root(fn_src).filesystem_open_zpod.chainPath(_manifest).array; + auto pth_2_ = asNormalizedPath(pod_root(fn_src).filesystem_open_zpod.chainPath(_manifest)).array; struct _pods { auto zpod() { return pth_1_; @@ -581,8 +581,8 @@ template SiSUpathsSisupods() { } auto fn_doc(string fn_src, string lng) { auto pod_root_ = pod_root(fn_src); - auto pth_1_ = doc_lng(fn_src, lng).zpod.chainPath(fn_src.baseName).array; - auto pth_2_ = doc_lng(fn_src, lng).filesystem_open_zpod.chainPath(fn_src.baseName).array; + 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; struct _pods { auto zpod() { return pth_1_; @@ -596,8 +596,8 @@ template SiSUpathsSisupods() { } auto fn_doc_insert(string fn_src, string fn_insert, string lng) { auto pod_root_ = pod_root(fn_src); - auto pth_1_ = doc_lng(fn_src, lng).zpod.chainPath(fn_insert.baseName).array; - auto pth_2_ = doc_lng(fn_src, lng).filesystem_open_zpod.chainPath(fn_insert.baseName).array; + 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; struct _pods { auto zpod() { return pth_1_; @@ -639,16 +639,22 @@ import sdp.meta.rgx; #+name: template_paths_out #+BEGIN_SRC d template SiSUoutPaths() { - auto SiSUoutPaths(Ps,Lng)( - Ps src_pth_info, + auto SiSUoutPaths(Po,Lng)( + Po output_pth_root, Lng lng, ) { struct _PathsStruct { string output_root() { - return "sisugen"; + string out_root_; + if (output_pth_root.length > 0) { + out_root_ = output_pth_root; + } else { + out_root_ = "sisugen"; + } + return out_root_; } string output_base() { - return output_root.chainPath(lng).array; + return asNormalizedPath(output_root.chainPath(lng)).array; } } return _PathsStruct(); @@ -663,11 +669,11 @@ template SiSUoutPaths() { template SiSUpathsHTML() { mixin SiSUrgxInit; static auto rgx = Rgx(); - auto SiSUpathsHTML(Ps,Lng)( - Ps src_pth_info, + auto SiSUpathsHTML(Po,Lng)( + Po output_pth_root, Lng lng, ) { - auto out_pth = SiSUoutPaths!()(src_pth_info, lng); + auto out_pth = SiSUoutPaths!()(output_pth_root, lng); string base_dir = "html"; string suffix = ".html"; struct _PathsStruct { @@ -675,28 +681,28 @@ template SiSUpathsHTML() { return fn_src.baseName.stripExtension; } string base() { - return (out_pth.output_base).chainPath(base_dir).array; + return asNormalizedPath((out_pth.output_base).chainPath(base_dir)).array; } string image() { - return (out_pth.output_root).chainPath("image").array; + return asNormalizedPath((out_pth.output_root).chainPath("image")).array; } string css() { - return (out_pth.output_root).chainPath("css").array; + return asNormalizedPath((out_pth.output_root).chainPath("css")).array; } string fn_seg_css() { - return css.chainPath("html_seg.css").array; + return asNormalizedPath(css.chainPath("html_seg.css")).array; } string fn_scroll_css() { - return css.chainPath("html_scroll.css").array; + return asNormalizedPath(css.chainPath("html_scroll.css")).array; } string seg(string fn_src) { - return base.chainPath(base_filename(fn_src)).array; + return asNormalizedPath(base.chainPath(base_filename(fn_src))).array; } string fn_scroll(string fn_src) { - return base.chainPath(base_filename(fn_src) ~ suffix).array; + return asNormalizedPath(base.chainPath(base_filename(fn_src) ~ suffix)).array; } string fn_seg(string fn_src, string seg_filename) { - return seg(fn_src).chainPath(seg_filename ~ suffix).array; + return asNormalizedPath(seg(fn_src).chainPath(seg_filename ~ suffix)).array; } } return _PathsStruct(); @@ -711,57 +717,57 @@ template SiSUpathsHTML() { template SiSUpathsEPUB() { mixin SiSUrgxInit; static auto rgx = Rgx(); - auto SiSUpathsEPUB(Ps,Lng)( - Ps src_pth_info, + auto SiSUpathsEPUB(Po,Lng)( + Po output_pth_root, Lng lng, ) { - auto out_pth = SiSUoutPaths!()(src_pth_info, lng); + auto out_pth = SiSUoutPaths!()( output_pth_root, lng); string base_dir = "epub"; struct _PathsStruct { string base() { - return (out_pth.output_base).chainPath(base_dir).array; + return asNormalizedPath((out_pth.output_base).chainPath(base_dir)).array; } string base_filename(string fn_src) { return fn_src.baseName.stripExtension; } string epub_file(string fn_src) { - return base.chainPath(base_filename(fn_src) ~ ".epub").array; + return asNormalizedPath(base.chainPath(base_filename(fn_src) ~ ".epub")).array; } string dirtop() { return "".chainPath("").array; } string doc_meta_inf(string fn_src) { - return dirtop.chainPath("META-INF").array; + return asNormalizedPath(dirtop.chainPath("META-INF")).array; } string doc_oebps(string fn_src) { - return dirtop.chainPath("OEBPS").array; + return asNormalizedPath(dirtop.chainPath("OEBPS")).array; } string doc_oebps_css(string fn_src) { - return doc_oebps(fn_src).chainPath("css").array; + return asNormalizedPath(doc_oebps(fn_src).chainPath("css")).array; } string doc_oebps_image(string fn_src) { - return doc_oebps(fn_src).chainPath("image").array; + return asNormalizedPath(doc_oebps(fn_src).chainPath("image")).array; } string fn_mimetypes(string fn_src) { - return dirtop.chainPath("mimetypes").array; + return asNormalizedPath(dirtop.chainPath("mimetypes")).array; } string fn_dmi_container_xml(string fn_src) { - return doc_meta_inf(fn_src).chainPath("container.xml").array; + return asNormalizedPath(doc_meta_inf(fn_src).chainPath("container.xml")).array; } string fn_oebps_toc_nav_xhtml(string fn_src) { - return doc_oebps(fn_src).chainPath("toc_nav.xhtml").array; + return asNormalizedPath(doc_oebps(fn_src).chainPath("toc_nav.xhtml")).array; } string fn_oebps_toc_ncx(string fn_src) { - return doc_oebps(fn_src).chainPath("toc.ncx").array; + return asNormalizedPath(doc_oebps(fn_src).chainPath("toc.ncx")).array; } string fn_oebps_content_opf(string fn_src) { - return doc_oebps(fn_src).chainPath("content.opf").array; + return asNormalizedPath(doc_oebps(fn_src).chainPath("content.opf")).array; } string fn_oebps_content_xhtml(string fn_src, string seg_filename) { - return doc_oebps(fn_src).chainPath(seg_filename ~ ".xhtml").array; + return asNormalizedPath(doc_oebps(fn_src).chainPath(seg_filename ~ ".xhtml")).array; } string fn_oebps_css(string fn_src) { - return doc_oebps_css(fn_src).chainPath("epub.css").array; + return asNormalizedPath(doc_oebps_css(fn_src).chainPath("epub.css")).array; } debug(epub_output) { string dbg_docdir(string fn_src) { @@ -818,24 +824,24 @@ template SiSUpathsEPUB() { template SiSUpathsSQLiteDiscrete() { mixin SiSUrgxInit; static auto rgx = Rgx(); - auto SiSUpathsSQLiteDiscrete(Ps,Lng)( - Ps src_pth_info, + auto SiSUpathsSQLiteDiscrete(Po,Lng)( + Po output_pth_root, Lng lng, ) { - auto out_pth = SiSUoutPaths!()(src_pth_info, lng); + auto out_pth = SiSUoutPaths!()(output_pth_root, lng); string base_dir = "sqlite"; struct _PathsStruct { string base_filename(string fn_src) { return fn_src.baseName.stripExtension; } string base() { - return (out_pth.output_base).chainPath(base_dir).array; + return asNormalizedPath((out_pth.output_base).chainPath(base_dir)).array; } string seg(string fn_src) { - return base.chainPath(base_filename(fn_src)).array; + return asNormalizedPath(base.chainPath(base_filename(fn_src))).array; } string sqlite_file(string fn_src) { - return base.chainPath(base_filename(fn_src) ~ ".sqlite").array; + return asNormalizedPath(base.chainPath(base_filename(fn_src) ~ ".sqlite")).array; } } return _PathsStruct(); @@ -850,24 +856,24 @@ template SiSUpathsSQLiteDiscrete() { template SiSUpathsSQLite() { mixin SiSUrgxInit; static auto rgx = Rgx(); - auto SiSUpathsSQLite(Ps,Lng)( - Ps src_pth_info, + auto SiSUpathsSQLite(Po,Lng)( + Po output_pth_root, Lng lng, ) { - auto out_pth = SiSUoutPaths!()(src_pth_info, lng); + auto out_pth = SiSUoutPaths!()(output_pth_root, lng); string base_dir = "sqlite"; struct _PathsStruct { string base_filename(string fn_src) { return fn_src.baseName.stripExtension; } string base() { - return (out_pth.output_base).chainPath(base_dir).array; + return asNormalizedPath((out_pth.output_base).chainPath(base_dir)).array; } string seg(string fn_src) { - return base.chainPath(base_filename(fn_src)).array; + return asNormalizedPath(base.chainPath(base_filename(fn_src))).array; } string sqlite_file(string fn_src) { - return base.chainPath(base_filename(fn_src) ~ ".sqlite").array; + return asNormalizedPath(base.chainPath(base_filename(fn_src) ~ ".sqlite")).array; } } return _PathsStruct(); -- cgit v1.2.3