diff options
| author | Ralph Amissah <ralph@amissah.com> | 2017-04-20 13:57:03 -0400 | 
|---|---|---|
| committer | Ralph Amissah <ralph@amissah.com> | 2019-04-10 15:14:14 -0400 | 
| commit | 9cf470e69b2d579701ee607f796de612dc600565 (patch) | |
| tree | ff16c8b547767e4b441655df39511c1757f819c3 /src/sdp/paths_output.d | |
| parent | section keys sequence (diff) | |
0.14.0 reorganized files, and paths
Diffstat (limited to 'src/sdp/paths_output.d')
| -rw-r--r-- | src/sdp/paths_output.d | 287 | 
1 files changed, 287 insertions, 0 deletions
diff --git a/src/sdp/paths_output.d b/src/sdp/paths_output.d new file mode 100644 index 0000000..9c91384 --- /dev/null +++ b/src/sdp/paths_output.d @@ -0,0 +1,287 @@ +/++ +  default settings ++/ +import std.array, +  std.path, +  std.regex, +  std.stdio; +import 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!()(); // 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 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); // or pod_root? +      } +      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!()(); // 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 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(); +  } +}  | 
