aboutsummaryrefslogtreecommitdiffhomepage
path: root/org/defaults.org
diff options
context:
space:
mode:
Diffstat (limited to 'org/defaults.org')
-rw-r--r--org/defaults.org218
1 files changed, 170 insertions, 48 deletions
diff --git a/org/defaults.org b/org/defaults.org
index cb4ee80..b83308d 100644
--- a/org/defaults.org
+++ b/org/defaults.org
@@ -911,103 +911,226 @@ private import
#+name: defaults_template_paths
#+BEGIN_SRC d
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;
- }
+#+END_SRC
+
+**** base
+
+#+name: defaults_template_paths
+#+BEGIN_SRC d
struct DirPaths {
string base_filename(string fn_src) {
- return _base_filename(fn_src);
+ return baseName(stripExtension(fn_src));
}
}
+#+END_SRC
+
+**** sisupod
+
+***** pod
+
+#+name: defaults_template_paths
+#+BEGIN_SRC d
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;
+ }
+ }
+#+END_SRC
+
+***** pod zipped
+
+#+name: defaults_template_paths
+#+BEGIN_SRC d
+ 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 chainPath("sisupod", _base_filename(fn_src)).array;
+ return spod_pths.base(fn_src);
}
- string doc(string fn_src) {
- return chainPath(base(fn_src), "doc").array;
- // return chainPath(base(fn_src), "text").array;
+ auto doc_root(string fn_src) {
+ return "doc";
}
- string doc_lng(string fn_src, string lng) {
- return chainPath(doc(fn_src), lng).array;
+ auto doc(string fn_src) {
+ return doc_root(fn_src);
}
- string conf(string fn_src) {
- return chainPath(doc(fn_src), "_sisu").array;
+ auto doc_lng(string fn_src, string lng) {
+ return doc_root(fn_src).chainPath(lng).array;
}
- string image(string fn_src) {
- return chainPath(conf(fn_src), "image").array;
+ auto conf(string fn_src) {
+ return doc_root(fn_src).chainPath("_sisu").array;
}
- string css(string fn_src) {
- return chainPath(conf(fn_src), "css").array;
+ auto image(string fn_src) {
+ return conf(fn_src).chainPath("image").array;
}
- string fn_doc(string fn_src, string lng) {
- return chainPath((doc_lng(fn_src, lng)), baseName(fn_src)).array;
+ auto css(string fn_src) {
+ return conf(fn_src).chainPath("css").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(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;
}
}
+#+END_SRC
+
+***** pod unzipped archive
+
+#+name: defaults_template_paths
+#+BEGIN_SRC d
+ 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 spod_pths.base(fn_src);
+ }
+ auto doc_root(string fn_src) {
+ return base(fn_src).chainPath("doc").array;
+ }
+ 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;
+ }
+ }
+#+END_SRC
+
+**** html5
+
+#+name: defaults_template_paths
+#+BEGIN_SRC d
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 {
+#+END_SRC
+
+**** epub3
+
+#+name: defaults_template_paths
+#+BEGIN_SRC d
+ 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 doc(string fn_src) {
- return chainPath(base, _base_filename(fn_src)).array;
+ string epub_file(string fn_src) {
+ return base.chainPath(base_filename(fn_src) ~ ".epub").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;
+ }
}
}
}
@@ -1072,8 +1195,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;
}