diff options
Diffstat (limited to 'src/sdp/defaults.d')
-rw-r--r-- | src/sdp/defaults.d | 180 |
1 files changed, 132 insertions, 48 deletions
diff --git a/src/sdp/defaults.d b/src/sdp/defaults.d index a6520a3..537b4ba 100644 --- a/src/sdp/defaults.d +++ b/src/sdp/defaults.d @@ -3,103 +3,188 @@ +/ template SiSUpaths() { - string _base_filename(string fn_src) { - string _fn_base = ""; - if (extension(fn_src) == ".sst") { - _fn_base = baseName(fn_src, ".sst"); - } else if (extension(fn_src) == ".ssm") { - _fn_base = baseName(fn_src, ".ssm"); - } - return _fn_base; - } struct DirPaths { string base_filename(string fn_src) { - return _base_filename(fn_src); + return baseName(stripExtension(fn_src)); } } struct SiSUpodPaths { string base_filename(string fn_src) { - return _base_filename(fn_src); + return baseName(stripExtension(fn_src)); + } + string sisupod_filename(string fn_src) { + return "sisupod".chainPath(base_filename(fn_src) ~ ".zip").array; + } + string base(string fn_src) { + return "sisupod".chainPath(base_filename(fn_src)).array; + } + } + struct SiSUpodPathsZipped { + auto spod_pths = SiSUpodPaths(); + string base_filename(string fn_src) { + return spod_pths.base_filename(fn_src); + } + string sisupod_filename(string fn_src) { + return spod_pths.sisupod_filename(fn_src); + } + string base(string fn_src) { + return spod_pths.base(fn_src); + } + auto doc_root(string fn_src) { + return "doc"; + } + auto doc(string fn_src) { + return doc_root(fn_src); + } + auto doc_lng(string fn_src, string lng) { + return doc_root(fn_src).chainPath(lng).array; + } + auto conf(string fn_src) { + return doc_root(fn_src).chainPath("_sisu").array; + } + auto image(string fn_src) { + return conf(fn_src).chainPath("image").array; + } + auto css(string fn_src) { + return conf(fn_src).chainPath("css").array; + } + auto fn_doc(string fn_src, string lng) { + return (doc_lng(fn_src, lng)).chainPath(baseName(fn_src)).array; + } + auto fn_doc_insert(string fn_src, string fn_insert, string lng) { + return (doc_lng(fn_src, lng)).chainPath(baseName(fn_insert)).array; + } + } + struct SiSUpodPathsFilesystemArchive { + auto spod_pths = SiSUpodPaths(); + string base_filename(string fn_src) { + return spod_pths.base_filename(fn_src); + } + string sisupod_filename(string fn_src) { + return spod_pths.sisupod_filename(fn_src); } string base(string fn_src) { - return chainPath("sisupod", _base_filename(fn_src)).array; + return spod_pths.base(fn_src); + } + auto doc_root(string fn_src) { + return base(fn_src).chainPath("doc").array; } - string doc(string fn_src) { - return chainPath(base(fn_src), "doc").array; - // return chainPath(base(fn_src), "text").array; + auto doc(string fn_src) { + return doc_root(fn_src); } - string doc_lng(string fn_src, string lng) { - return chainPath(doc(fn_src), lng).array; + auto doc_lng(string fn_src, string lng) { + return doc_root(fn_src).chainPath(lng).array; } - string conf(string fn_src) { - return chainPath(doc(fn_src), "_sisu").array; + auto conf(string fn_src) { + return doc_root(fn_src).chainPath("_sisu").array; } - string image(string fn_src) { - return chainPath(conf(fn_src), "image").array; + auto image(string fn_src) { + return conf(fn_src).chainPath("image").array; } - string css(string fn_src) { - return chainPath(conf(fn_src), "css").array; + auto css(string fn_src) { + return conf(fn_src).chainPath("css").array; } - string fn_doc(string fn_src, string lng) { - return chainPath((doc_lng(fn_src, lng)), baseName(fn_src)).array; + auto fn_doc(string fn_src, string lng) { + return (doc_lng(fn_src, lng)).chainPath(baseName(fn_src)).array; } - string fn_doc_insert(string fn_src, string fn_insert, string lng) { - return chainPath((doc_lng(fn_src, lng)), baseName(fn_insert)).array; + auto fn_doc_insert(string fn_src, string fn_insert, string lng) { + return (doc_lng(fn_src, lng)).chainPath(baseName(fn_insert)).array; } } struct HtmlPaths { string base_filename(string fn_src) { - return _base_filename(fn_src); + return baseName(stripExtension(fn_src)); } string base() { - return chainPath("en", "html").array; + return "en".chainPath("html").array; } string seg(string fn_src) { - return chainPath(base, _base_filename(fn_src)).array; + return base.chainPath(base_filename(fn_src)).array; } string fn_scroll(string fn_src) { - return chainPath(base, _base_filename(fn_src) ~ ".html").array; + return base.chainPath(base_filename(fn_src) ~ ".html").array; } string fn_seg(string fn_src, string seg_filename) { - return chainPath(seg(fn_src), seg_filename ~ ".html").array; + return seg(fn_src).chainPath(seg_filename ~ ".html").array; } } - struct EpubPaths { + struct Epub3paths { + string dirtop() { + return "".chainPath("").array; + } string base_filename(string fn_src) { - return _base_filename(fn_src); + return baseName(stripExtension(fn_src)); } string base() { - return chainPath("en", "epub").array; + return "en".chainPath("epub3").array; + } + string epub_file(string fn_src) { + return base.chainPath(base_filename(fn_src) ~ ".epub").array; } - string doc(string fn_src) { - return chainPath(base, _base_filename(fn_src)).array; + string docdir(string fn_src) { + return base.chainPath(base_filename(fn_src)).array; } string doc_meta_inf(string fn_src) { - return chainPath(doc(fn_src), "META-INF").array; + return dirtop.chainPath("META-INF").array; } string doc_oebps(string fn_src) { - return chainPath(doc(fn_src), "OEBPS").array; + return dirtop.chainPath("OEBPS").array; } string doc_oebps_css(string fn_src) { - return chainPath(doc_oebps(fn_src), "css").array; + return doc_oebps(fn_src).chainPath("css").array; } string doc_oebps_image(string fn_src) { - return chainPath(doc_oebps(fn_src), "image").array; + return doc_oebps(fn_src).chainPath("image").array; } string fn_mimetypes(string fn_src) { - return chainPath(doc(fn_src), "mimetypes").array; + return dirtop.chainPath("mimetypes").array; } string fn_dmi_container_xml(string fn_src) { - return chainPath(doc_meta_inf(fn_src), "container.xml").array; + return 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; } string fn_oebps_toc_ncx(string fn_src) { - return chainPath(doc_oebps(fn_src), "toc.ncx").array; + return doc_oebps(fn_src).chainPath("toc.ncx").array; } string fn_oebps_content_opf(string fn_src) { - return chainPath(doc_oebps(fn_src), "content.opf").array; + return doc_oebps(fn_src).chainPath("content.opf").array; } string fn_oebps_content_xhtml(string fn_src, string seg_filename) { - return chainPath(doc_oebps(fn_src), seg_filename ~ ".xhtml").array; + return doc_oebps(fn_src).chainPath(seg_filename ~ ".xhtml").array; + } + debug(epub_output) { + string dbg_doc_meta_inf(string fn_src) { + return docdir(fn_src).chainPath("META-INF").array; + } + string dbg_doc_oebps(string fn_src) { + return docdir(fn_src).chainPath("OEBPS").array; + } + string dbg_doc_oebps_css(string fn_src) { + return doc_oebps(fn_src).chainPath("css").array; + } + string dbg_doc_oebps_image(string fn_src) { + return doc_oebps(fn_src).chainPath("image").array; + } + string dbg_fn_mimetypes(string fn_src) { + return docdir(fn_src).chainPath("mimetypes").array; + } + string dbg_fn_dmi_container_xml(string fn_src) { + return doc_meta_inf(fn_src).chainPath("container.xml").array; + } + string dbg_fn_oebps_toc_nav_xhtml(string fn_src) { + return doc_oebps(fn_src).chainPath("toc_nav.xhtml").array; + } + string dbg_fn_oebps_toc_ncx(string fn_src) { + return doc_oebps(fn_src).chainPath("toc.ncx").array; + } + string dbg_fn_oebps_content_opf(string fn_src) { + return doc_oebps(fn_src).chainPath("content.opf").array; + } + string dbg_fn_oebps_content_xhtml(string fn_src, string seg_filename) { + return doc_oebps(fn_src).chainPath(seg_filename ~ ".xhtml").array; + } } } } @@ -122,8 +207,7 @@ template InternalMarkup() { auto tc_o = "┏"; //"『"; // "┏" ┓ auto tc_c = "┚"; // "』"; // "┚" table row mark #Mx[:tc_c]="』\n" auto tc_p = "┆"; // table col/misc mark - string indent_by_spaces_provided(int indent) { - auto _indent_spaces ="░░"; // auto nbsp = "░"; + string indent_by_spaces_provided(int indent, string _indent_spaces ="░░") { _indent_spaces = replicate(_indent_spaces, indent); return _indent_spaces; } |