diff options
Diffstat (limited to 'src/sdp/output/paths_output.d')
-rw-r--r-- | src/sdp/output/paths_output.d | 92 |
1 files changed, 49 insertions, 43 deletions
diff --git a/src/sdp/output/paths_output.d b/src/sdp/output/paths_output.d index accfcaf..4a1c2e4 100644 --- a/src/sdp/output/paths_output.d +++ b/src/sdp/output/paths_output.d @@ -8,16 +8,22 @@ import std.array, std.stdio; import sdp.meta.rgx; 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(); @@ -26,11 +32,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 { @@ -38,28 +44,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(); @@ -68,57 +74,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) { @@ -168,24 +174,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(); @@ -194,24 +200,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(); |