aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/sdp/output/paths_output.d
diff options
context:
space:
mode:
authorRalph Amissah <ralph@amissah.com>2017-05-09 13:01:06 -0400
committerRalph Amissah <ralph@amissah.com>2019-04-10 15:14:14 -0400
commit60d6073bcfc4fa91253428094813de0dac41a2b4 (patch)
treecef8e223469724d9e42dea81d6ded5ffc75a9be2 /src/sdp/output/paths_output.d
parentmodules, collective imports (diff)
0.16.0 files/modules re-arrangeddoc-reform_v0.0.16
Diffstat (limited to 'src/sdp/output/paths_output.d')
-rw-r--r--src/sdp/output/paths_output.d288
1 files changed, 288 insertions, 0 deletions
diff --git a/src/sdp/output/paths_output.d b/src/sdp/output/paths_output.d
new file mode 100644
index 0000000..3edcb67
--- /dev/null
+++ b/src/sdp/output/paths_output.d
@@ -0,0 +1,288 @@
+/++
+ default settings
++/
+module sdp.output.paths_output;
+import std.array,
+ std.path,
+ std.regex,
+ std.stdio;
+import sdp.ao.rgx;
+template SiSUpathsSisupod() {
+ mixin SiSUrgxInit;
+ auto rgx = Rgx();
+ string base_dir = "sisupod";
+ string suffix = ".zip";
+ auto SiSUpathsSisupod()() {
+ struct _PathsStruct {
+ string base_filename(string fn_src) {
+ return fn_src.baseName.stripExtension;
+ }
+ string sisupod_filename(string fn_src) {
+ return base_dir.chainPath(base_filename(fn_src) ~ suffix).array;
+ }
+ string base(string fn_src) {
+ return base_dir.chainPath(base_filename(fn_src)).array;
+ }
+ }
+ return _PathsStruct();
+ }
+}
+template SiSUpathsSisupodZipped() {
+ mixin SiSUrgxInit;
+ auto rgx = Rgx();
+ auto SiSUpathsSisupodZipped(Ps,Lng)(
+ Ps src_pth_info,
+ Lng lng,
+ ) {
+ struct _PathsStruct {
+ auto spod_pths = SiSUpathsSisupod!()();
+ 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 pod_root(string fn_src) {
+ return "sisudoc";
+ }
+ auto text_root(string fn_src) {
+ return pod_root(fn_src).chainPath("text").array;
+ }
+ auto media_root(string fn_src) {
+ return pod_root(fn_src).chainPath("docmedia").array;
+ }
+ auto conf_root(string fn_src) {
+ return pod_root(fn_src).chainPath("conf").array;
+ }
+ auto doc(string fn_src) {
+ return text_root(fn_src);
+ }
+ auto doc_lng(string fn_src) {
+ return text_root(fn_src).chainPath(lng).array;
+ }
+ auto image_root(string fn_src) {
+ return media_root(fn_src).chainPath("image").array;
+ }
+ auto css(string fn_src) {
+ return conf_root(fn_src).chainPath("css").array;
+ }
+ auto fn_doc(string fn_src) {
+ return (doc_lng(fn_src)).chainPath(fn_src.baseName).array;
+ }
+ auto fn_doc_insert(string fn_src, string fn_insert) {
+ return (doc_lng(fn_src)).chainPath(fn_insert.baseName).array;
+ }
+ }
+ return _PathsStruct();
+ }
+}
+template SiSUpathsSisupodFileSystem() {
+ mixin SiSUrgxInit;
+ auto rgx = Rgx();
+ auto SiSUpathsSisupodFileSystem(Ps,Lng)(
+ Ps src_pth_info,
+ Lng lng,
+ ) {
+ struct _PathsStruct {
+ auto spod_pths = SiSUpathsSisupod!()();
+ 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 pod_root(string fn_src) {
+ return base(fn_src).chainPath("sisudoc").array;
+ }
+ auto text_root(string fn_src) {
+ return pod_root(fn_src).chainPath("text").array;
+ }
+ auto media_root(string fn_src) {
+ return pod_root(fn_src).chainPath("docmedia").array;
+ }
+ auto conf_root(string fn_src) {
+ return pod_root(fn_src).chainPath("conf").array;
+ }
+ auto doc(string fn_src) {
+ return pod_root(fn_src);
+ }
+ auto doc_lng(string fn_src) {
+ return text_root(fn_src).chainPath(lng).array;
+ }
+ auto image_root(string fn_src) {
+ return media_root(fn_src).chainPath("image").array;
+ }
+ auto css(string fn_src) {
+ return conf_root(fn_src).chainPath("css").array;
+ }
+ auto fn_doc(string fn_src) {
+ return (doc_lng(fn_src)).chainPath(fn_src.baseName).array;
+ }
+ auto fn_doc_insert(string fn_src, string fn_insert) {
+ return (doc_lng(fn_src)).chainPath(fn_insert.baseName).array;
+ }
+ }
+ return _PathsStruct();
+ }
+}
+template SiSUoutPaths() {
+ auto SiSUoutPaths(Ps,Lng)(
+ Ps src_pth_info,
+ Lng lng,
+ ) {
+ struct _PathsStruct {
+ string output_root() {
+ return "sisugen";
+ }
+ string output_base() {
+ return output_root.chainPath(lng).array;
+ }
+ }
+ return _PathsStruct();
+ }
+}
+template SiSUpathsHTML() {
+ mixin SiSUrgxInit;
+ auto rgx = Rgx();
+ auto SiSUpathsHTML(Ps,Lng)(
+ Ps src_pth_info,
+ Lng lng,
+ ) {
+ auto out_pth = SiSUoutPaths!()(src_pth_info, lng);
+ string base_dir = "html";
+ string suffix = ".html";
+ struct _PathsStruct {
+ string base_filename(string fn_src) {
+ return fn_src.baseName.stripExtension;
+ }
+ string base() {
+ return (out_pth.output_base).chainPath(base_dir).array;
+ }
+ string image() {
+ return (out_pth.output_root).chainPath("image").array;
+ }
+ string css() {
+ return (out_pth.output_root).chainPath("css").array;
+ }
+ string fn_css() {
+ return css.chainPath("html.css").array;
+ }
+ string seg(string fn_src) {
+ return base.chainPath(base_filename(fn_src)).array;
+ }
+ string fn_scroll(string fn_src) {
+ return 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 _PathsStruct();
+ }
+}
+template SiSUpathsEPUB() {
+ mixin SiSUrgxInit;
+ auto rgx = Rgx();
+ auto SiSUpathsEPUB(Ps,Lng)(
+ Ps src_pth_info,
+ Lng lng,
+ ) {
+ auto out_pth = SiSUoutPaths!()(src_pth_info, lng);
+ string base_dir = "epub";
+ struct _PathsStruct {
+ string base() {
+ return (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;
+ }
+ string dirtop() {
+ return "".chainPath("").array;
+ }
+ string doc_meta_inf(string fn_src) {
+ return dirtop.chainPath("META-INF").array;
+ }
+ string doc_oebps(string fn_src) {
+ return dirtop.chainPath("OEBPS").array;
+ }
+ string doc_oebps_css(string fn_src) {
+ return doc_oebps(fn_src).chainPath("css").array;
+ }
+ string doc_oebps_image(string fn_src) {
+ return doc_oebps(fn_src).chainPath("image").array;
+ }
+ string fn_mimetypes(string fn_src) {
+ return dirtop.chainPath("mimetypes").array;
+ }
+ string fn_dmi_container_xml(string fn_src) {
+ 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 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;
+ }
+ string fn_oebps_content_xhtml(string fn_src, string seg_filename) {
+ return 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;
+ }
+ debug(epub_output) {
+ string dbg_docdir(string fn_src) {
+ return base.chainPath(base_filename(fn_src)).array;
+ }
+ string dbg_docdir_oebps(string fn_src) {
+ return dbg_docdir(fn_src).chainPath("OEBPS").array;
+ }
+ string dbg_doc_meta_inf(string fn_src) {
+ return dbg_docdir(fn_src).chainPath("META-INF").array;
+ }
+ string dbg_doc_oebps(string fn_src) {
+ return dbg_docdir(fn_src).chainPath("OEBPS").array;
+ }
+ string dbg_doc_oebps_css(string fn_src) {
+ return dbg_doc_oebps(fn_src).chainPath("css").array;
+ }
+ string dbg_doc_oebps_image(string fn_src) {
+ return dbg_doc_oebps(fn_src).chainPath("image").array;
+ }
+ string dbg_fn_mimetypes(string fn_src) {
+ return dbg_docdir(fn_src).chainPath("mimetypes").array;
+ }
+ string dbg_fn_dmi_container_xml(string fn_src) {
+ return dbg_doc_meta_inf(fn_src).chainPath("container.xml").array;
+ }
+ string dbg_fn_oebps_toc_nav_xhtml(string fn_src) {
+ return dbg_docdir_oebps(fn_src).chainPath("toc_nav.xhtml").array;
+ }
+ string dbg_fn_oebps_toc_ncx(string fn_src) {
+ return dbg_docdir_oebps(fn_src).chainPath("toc.ncx").array;
+ }
+ string dbg_fn_oebps_content_opf(string fn_src) {
+ return dbg_docdir_oebps(fn_src).chainPath("content.opf").array;
+ }
+ string dbg_fn_oebps_content_xhtml(string fn_src, string seg_filename) {
+ return dbg_docdir_oebps(fn_src).chainPath(seg_filename ~ ".xhtml").array;
+ }
+ string dbg_fn_oebps_css(string fn_src) {
+ return dbg_doc_oebps_css(fn_src).chainPath("epub.css").array;
+ }
+ }
+ }
+ return _PathsStruct();
+ }
+}