aboutsummaryrefslogtreecommitdiffhomepage
path: root/org/default_paths.org
diff options
context:
space:
mode:
authorRalph Amissah <ralph.amissah@gmail.com>2019-06-23 14:01:43 -0400
committerRalph Amissah <ralph.amissah@gmail.com>2019-10-17 19:07:20 -0400
commitd542315e97260128706af55652964f18e9fdc4bb (patch)
treecfa3a68fa463eaf433fb562fd69a1a0b968e0b4e /org/default_paths.org
parentharvest reorganized (diff)
harvests reorganized; adjustments: output, pathsdoc-reform_v0.7.3
Diffstat (limited to 'org/default_paths.org')
-rw-r--r--org/default_paths.org180
1 files changed, 159 insertions, 21 deletions
diff --git a/org/default_paths.org b/org/default_paths.org
index 7bf838e..dba021f 100644
--- a/org/default_paths.org
+++ b/org/default_paths.org
@@ -252,6 +252,19 @@ template PathMatters() {
}
return _uid;
}
+ string doc_uid_out() {
+ string _uid;
+ if (is_pod && !(pod_name_with_path.empty)) {
+ if (pod_name_with_path.baseName == filename_base) {
+ _uid = filename_base ~ "." ~ lng;
+ } else {
+ _uid = pod_name_with_path.baseName ~ mkup.sep ~ filename_base ~ "." ~ lng;
+ }
+ } else {
+ _uid = "_" ~ filename_base ~ "." ~ lng;
+ }
+ return _uid;
+ }
string docname_composite_unique_per_src_doc() {
string _fn;
if (pod_name_with_path.baseName == filename_base) {
@@ -938,13 +951,12 @@ import doc_reform.meta.rgx;
template DocReformOutPaths() {
auto DocReformOutPaths(Po,Lng)(
Po output_pth_root,
- Lng lng,
+ Lng lng = "",
) {
struct _PathsStruct {
string output_root() {
return (output_pth_root.length > 0)
- ? output_pth_root
- : "sisugen";
+ ? output_pth_root : "";
}
string output_base() {
return asNormalizedPath(output_root.chainPath(lng)).array;
@@ -960,8 +972,7 @@ template DocReformOutPathSQLite() {
struct _PathsStruct {
string output_root() {
return (output_pth_root.length > 0)
- ? output_pth_root
- : "sisugen";
+ ? output_pth_root : "";
}
string output_base() {
return asNormalizedPath(output_root).array;
@@ -1057,31 +1068,38 @@ template DocReformPathsUrl() {
#+END_SRC
** _html_ :html:
+*** relative
#+name: template_paths_html
#+BEGIN_SRC d
-template DocReformPathsHTML() {
+template DocReformDocRootTreeHTML() {
mixin DocReformRgxInit;
static auto rgx = Rgx();
- auto DocReformPathsHTML(Po,Lng)(
- Po output_pth_root,
- Lng lng,
- ) {
- auto out_pth = DocReformOutPaths!()(output_pth_root, lng);
+ auto DocReformDocRootTreeHTML(Lng)(Lng lng) {
+ auto lng_pth = DocReformOutPaths!()("", lng);
string base_dir = "html";
string suffix = ".html";
struct _PathsStruct {
string base_filename(string fn_src) {
return fn_src.baseName.stripExtension;
}
+ string base_filename_scroll(string fn_src) {
+ return base_filename(fn_src) ~ "." ~ lng;
+ }
+ string base_filename_seg(string fn_src) {
+ return base_filename(fn_src) ~ "." ~ lng;
+ }
+ string docroot() {
+ return asNormalizedPath(lng_pth.output_root).array;
+ }
string base() {
- return asNormalizedPath((out_pth.output_base).chainPath(base_dir)).array;
+ return asNormalizedPath((lng).chainPath(base_dir)).array;
}
string image() {
- return asNormalizedPath((out_pth.output_root).chainPath("image")).array;
+ return asNormalizedPath("image").array;
}
string css() {
- return asNormalizedPath((out_pth.output_root).chainPath("css")).array;
+ return asNormalizedPath("css").array;
}
string fn_seg_css() {
return asNormalizedPath(css.chainPath("html_seg.css")).array;
@@ -1090,19 +1108,19 @@ template DocReformPathsHTML() {
return asNormalizedPath(css.chainPath("html_scroll.css")).array;
}
string seg(string fn_src) {
- return asNormalizedPath(base.chainPath(base_filename(fn_src))).array;
+ return asNormalizedPath(base.chainPath(base_filename_seg(fn_src))).array;
}
string fn_scroll(string fn_src) {
- return asNormalizedPath(base.chainPath(base_filename(fn_src) ~ suffix)).array;
+ return asNormalizedPath(base.chainPath(base_filename_scroll(fn_src) ~ suffix)).array;
}
string fn_seg(string fn_src, string seg_filename) {
return asNormalizedPath(seg(fn_src).chainPath(seg_filename ~ suffix)).array;
}
string tail_seg(string fn_src) {
- return lng ~ "/html/" ~ base_filename(fn_src);
+ return lng ~ "/html/" ~ base_filename_seg(fn_src);
}
string tail_fn_scroll(string fn_src) {
- return lng ~ "/html/" ~ base_filename(fn_src) ~ suffix;
+ return lng ~ "/html/" ~ base_filename_scroll(fn_src) ~ suffix;
}
string tail_fn_seg(string fn_src, string seg_filename) {
return lng ~ "/html/" ~ seg(fn_src) ~ "/" ~ seg_filename ~ suffix;
@@ -1113,6 +1131,126 @@ template DocReformPathsHTML() {
}
#+END_SRC
+*** absolute
+
+#+name: template_paths_html
+#+BEGIN_SRC d
+template DocReformPathsHTML() {
+ mixin DocReformRgxInit;
+ static auto rgx = Rgx();
+ auto DocReformPathsHTML(Po,Lng)(
+ Po root_pth,
+ Lng lng,
+ ) {
+ auto doc_tree = DocReformDocRootTreeHTML!()(lng);
+ string base_dir = "html";
+ string suffix = ".html";
+ struct _PathsStruct {
+ string docroot() {
+ return asNormalizedPath(root_pth.chainPath(doc_tree.docroot)).array;
+ }
+ string harvest(string fn_harvest) {
+ return docroot ~ "/" ~ fn_harvest;
+ }
+ string base() {
+ return asNormalizedPath(root_pth.chainPath(doc_tree.base)).array;
+ }
+ string image() {
+ return asNormalizedPath(root_pth.chainPath(doc_tree.image)).array;
+ }
+ string css() {
+ return asNormalizedPath(root_pth.chainPath(doc_tree.css)).array;
+ }
+ string fn_seg_css() {
+ return asNormalizedPath(root_pth.chainPath(doc_tree.fn_seg_css)).array;
+ }
+ string fn_scroll_css() {
+ return asNormalizedPath(root_pth.chainPath(doc_tree.fn_scroll_css)).array;
+ }
+ string seg(string fn_src) {
+ return asNormalizedPath(root_pth.chainPath(doc_tree.seg(fn_src))).array;
+ }
+ string fn_scroll(string fn_src) {
+ return asNormalizedPath(root_pth.chainPath(doc_tree.fn_scroll(fn_src))).array;
+ }
+ string fn_seg(string fn_src, string seg_filename) {
+ return asNormalizedPath(root_pth.chainPath(doc_tree.fn_seg(fn_src, seg_filename))).array;
+ }
+ string tail_seg(string fn_src) {
+ return doc_tree.tail_seg(fn_src);
+ }
+ string tail_fn_scroll(string fn_src) {
+ return doc_tree.tail_fn_scroll(fn_src);
+ }
+ string tail_fn_seg(string fn_src, string seg_filename) {
+ return doc_tree.tail_fn_seg(fn_src, seg_filename);
+ }
+ }
+ return _PathsStruct();
+ }
+}
+#+END_SRC
+
+*** urls
+
+#+name: template_paths_html
+#+BEGIN_SRC d
+template DocReformUrlPathsHTML() {
+ mixin DocReformRgxInit;
+ static auto rgx = Rgx();
+ auto DocReformUrlPathsHTML(Po,Lng)(
+ Po root_pth,
+ Lng lng,
+ ) {
+ auto doc_tree = DocReformDocRootTreeHTML!()(lng);
+ string base_dir = "html";
+ string suffix = ".html";
+ struct _PathsStruct {
+ string docroot() {
+ return asNormalizedPath(root_pth.chainPath(doc_tree.docroot)).array;
+ }
+ string harvest(string fn_harvest) {
+ return docroot ~ "/" ~ fn_harvest;
+ }
+ string base() {
+ return asNormalizedPath(root_pth.chainPath(doc_tree.base)).array;
+ }
+ string image() {
+ return asNormalizedPath(root_pth.chainPath(doc_tree.image)).array;
+ }
+ string css() {
+ return asNormalizedPath(root_pth.chainPath(doc_tree.css)).array;
+ }
+ string fn_seg_css() {
+ return asNormalizedPath(root_pth.chainPath(doc_tree.fn_seg_css)).array;
+ }
+ string fn_scroll_css() {
+ return asNormalizedPath(root_pth.chainPath(doc_tree.fn_scroll_css)).array;
+ }
+ string seg(string fn_src) {
+ return asNormalizedPath(root_pth.chainPath(doc_tree.seg(fn_src))).array;
+ }
+ string fn_scroll(string fn_src) {
+ return asNormalizedPath(root_pth.chainPath(doc_tree.fn_scroll(fn_src))).array;
+ }
+ string fn_seg(string fn_src, string seg_filename) {
+ return asNormalizedPath(root_pth.chainPath(doc_tree.fn_seg(fn_src, seg_filename))).array;
+ }
+ string tail_seg(string fn_src) {
+ return doc_tree.tail_seg(fn_src);
+ }
+ string tail_fn_scroll(string fn_src) {
+ return doc_tree.tail_fn_scroll(fn_src);
+ }
+ string tail_fn_seg(string fn_src, string seg_filename) {
+ return doc_tree.tail_fn_seg(fn_src, seg_filename);
+ }
+ }
+ return _PathsStruct();
+ }
+}
+#+END_SRC
+
** _epub_ :epub:
#+name: template_paths_epub
@@ -1131,7 +1269,7 @@ template DocReformPathsEPUB() {
return asNormalizedPath((out_pth.output_base).chainPath(base_dir)).array;
}
string base_filename(string fn_src) {
- return fn_src.baseName.stripExtension;
+ return fn_src.baseName.stripExtension ~ "." ~ lng;
}
string epub_file(string fn_src) {
return asNormalizedPath(base.chainPath(base_filename(fn_src) ~ ".epub")).array;
@@ -1235,12 +1373,12 @@ template DocReformPathsODT() {
return asNormalizedPath((out_pth.output_base).chainPath(base_dir)).array;
}
string odt_file() {
- return asNormalizedPath(base_pth.chainPath(doc_matters.src.filename_base ~ ".odt")).array;
+ return asNormalizedPath(base_pth.chainPath(doc_matters.src.doc_uid_out ~ ".odt")).array;
}
string dirtop(string type) {
return (type == "zip")
? "".chainPath("").array
- : asNormalizedPath(base_pth.chainPath(doc_matters.src.filename_base)).array;
+ : asNormalizedPath(base_pth.chainPath(doc_matters.src.doc_uid_out)).array;
}
string mimetype(string type="fs") {
assert(type == "zip" || "fs");