aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/doc_reform/output/paths_output.d
diff options
context:
space:
mode:
Diffstat (limited to 'src/doc_reform/output/paths_output.d')
-rw-r--r--src/doc_reform/output/paths_output.d192
1 files changed, 103 insertions, 89 deletions
diff --git a/src/doc_reform/output/paths_output.d b/src/doc_reform/output/paths_output.d
index 795da4c..0ca9fa7 100644
--- a/src/doc_reform/output/paths_output.d
+++ b/src/doc_reform/output/paths_output.d
@@ -77,45 +77,11 @@ template DocReformOutPathsFnPd() {
return _PathsStruct();
}
}
-template DocReformPathsUrl() {
- import std.format;
- mixin DocReformRgxInit;
- static auto rgx = Rgx();
- auto DocReformPathsUrl(M)(M doc_matters) {
- struct _UrlPathsStruct {
- string doc_root() {
- string _doc_root = (doc_matters.conf_make_meta.conf.webserv_url_doc_path.length > 0)
- ? doc_matters.conf_make_meta.conf.webserv_url_doc_root
- : "file://" ~ doc_matters.output_path;
- return _doc_root;
- }
- string html_seg(string html_segname, string obj_id) { // TODO bespoke for sqlite
- string _url = format(q"┃%s/%s/html/%s/%s.html#%s┃",
- doc_root,
- doc_matters.src.language,
- doc_matters.src.filename_base,
- html_segname,
- obj_id
- );
- if (html_segname.empty || obj_id.empty) {
- if (
- doc_matters.opt.action.debug_do
- && doc_matters.opt.action.verbose
- ) {
- writeln("sqlite object missing segname or object id: ", _url);
- }
- _url = "";
- }
- return _url;
- }
- }
- return _UrlPathsStruct();
- }
-}
+
template DocReformDocRootTreeHTML() {
mixin DocReformRgxInit;
static auto rgx = Rgx();
- auto DocReformDocRootTreeHTML(Lng)(Lng lng) {
+ auto DocReformDocRootTreeHTML()(string lng) {
auto lng_pth = DocReformOutPaths!()("", lng);
string base_dir = "html";
string suffix = ".html";
@@ -129,7 +95,7 @@ template DocReformDocRootTreeHTML() {
string base_filename_seg(string fn_src) {
return base_filename(fn_src) ~ "." ~ lng;
}
- string docroot() {
+ string doc_root() {
return asNormalizedPath(lng_pth.output_root).array;
}
string base() {
@@ -172,19 +138,19 @@ template DocReformDocRootTreeHTML() {
template DocReformPathsHTML() {
mixin DocReformRgxInit;
static auto rgx = Rgx();
- auto DocReformPathsHTML(Po,Lng)(
- Po root_pth,
- Lng lng,
+ auto DocReformPathsHTML()(
+ string root_pth,
+ string 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 doc_root() {
+ return asNormalizedPath(root_pth.chainPath(doc_tree.doc_root)).array;
}
string harvest(string fn_harvest) {
- return docroot ~ "/" ~ fn_harvest;
+ return doc_root ~ "/" ~ fn_harvest;
}
string base() {
return asNormalizedPath(root_pth.chainPath(doc_tree.base)).array;
@@ -223,46 +189,88 @@ template DocReformPathsHTML() {
return _PathsStruct();
}
}
-template DocReformUrlPathsHTML() {
+template DocReformUrlsHTML() {
+ import std.format;
mixin DocReformRgxInit;
static auto rgx = Rgx();
- auto DocReformUrlPathsHTML(Po,Lng)(
- Po root_pth,
- Lng lng,
+ auto DocReformUrlsHTML()(
+ string url_doc_root,
+ string 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 doc_root() {
+ return url_doc_root ~ asNormalizedPath(doc_tree.doc_root).array;
}
string harvest(string fn_harvest) {
- return docroot ~ "/" ~ fn_harvest;
+ return format(q"┃%s/%s┃",
+ doc_root,
+ fn_harvest,
+ );
}
string base() {
- return asNormalizedPath(root_pth.chainPath(doc_tree.base)).array;
+ return format(q"┃%s/%s┃",
+ url_doc_root,
+ asNormalizedPath(doc_tree.base).array,
+ );
}
string image() {
- return asNormalizedPath(root_pth.chainPath(doc_tree.image)).array;
+ return format(q"┃%s/%s┃",
+ url_doc_root,
+ asNormalizedPath(doc_tree.image).array,
+ );
}
string css() {
- return asNormalizedPath(root_pth.chainPath(doc_tree.css)).array;
+ return format(q"┃%s/%s┃",
+ url_doc_root,
+ asNormalizedPath(doc_tree.css).array,
+ );
}
string fn_seg_css() {
- return asNormalizedPath(root_pth.chainPath(doc_tree.fn_seg_css)).array;
+ return format(q"┃%s/%s┃",
+ url_doc_root,
+ asNormalizedPath(doc_tree.fn_seg_css).array,
+ );
}
string fn_scroll_css() {
- return asNormalizedPath(root_pth.chainPath(doc_tree.fn_scroll_css)).array;
+ return format(q"┃%s/%s┃",
+ url_doc_root,
+ asNormalizedPath(doc_tree.fn_scroll_css).array,
+ );
}
string seg(string fn_src) {
- return asNormalizedPath(root_pth.chainPath(doc_tree.seg(fn_src))).array;
+ return format(q"┃%s/%s┃",
+ url_doc_root,
+ asNormalizedPath(doc_tree.seg(fn_src)).array,
+ );
}
string fn_scroll(string fn_src) {
- return asNormalizedPath(root_pth.chainPath(doc_tree.fn_scroll(fn_src))).array;
+ return format(q"┃%s/%s┃",
+ url_doc_root,
+ asNormalizedPath(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;
+ return format(q"┃%s/%s┃",
+ url_doc_root,
+ asNormalizedPath(doc_tree.fn_seg(fn_src, seg_filename)).array,
+ );
+ }
+ string fn_scroll_obj_num(string fn_src, string obj_num) {
+ return format(q"┃%s/%s#%s┃",
+ url_doc_root,
+ asNormalizedPath(doc_tree.fn_scroll(fn_src)).array,
+ obj_num,
+ );
+ }
+ string fn_seg_obj_num(string fn_src, string seg_filename, string obj_num) {
+ return format(q"┃%s/%s#%s┃",
+ url_doc_root,
+ asNormalizedPath(doc_tree.fn_seg(fn_src, seg_filename)).array,
+ obj_num,
+ );
}
string tail_seg(string fn_src) {
return doc_tree.tail_seg(fn_src);
@@ -280,9 +288,9 @@ template DocReformUrlPathsHTML() {
template DocReformPathsEPUB() {
mixin DocReformRgxInit;
static auto rgx = Rgx();
- auto DocReformPathsEPUB(Po,Lng)(
- Po output_pth_root,
- Lng lng,
+ auto DocReformPathsEPUB()(
+ string output_pth_root,
+ string lng,
) {
auto out_pth = DocReformOutPaths!()(output_pth_root, lng);
string base_dir = "epub";
@@ -293,44 +301,50 @@ template DocReformPathsEPUB() {
string base_filename(string fn_src) {
return fn_src.baseName.stripExtension ~ "." ~ lng;
}
- string epub_file(string fn_src) {
- return asNormalizedPath(base.chainPath(base_filename(fn_src) ~ ".epub")).array;
+ string base_filename(string fn_src) {
+ return fn_src.baseName.stripExtension;
}
- string dirtop() {
- return "".chainPath("").array;
+ string base_filename_epub(string fn_src) {
+ return base_filename(fn_src) ~ "." ~ lng;
}
- string doc_meta_inf(string fn_src) {
- return asNormalizedPath(dirtop.chainPath("META-INF")).array;
+ string doc_meta_inf() {
+ return asNormalizedPath("META-INF").array;
}
- string doc_oebps(string fn_src) {
- return asNormalizedPath(dirtop.chainPath("OEBPS")).array;
+ string doc_oebps() {
+ return asNormalizedPath("OEBPS").array;
}
- string doc_oebps_css(string fn_src) {
- return asNormalizedPath(doc_oebps(fn_src).chainPath("css")).array;
+ string doc_oebps_css() {
+ return asNormalizedPath(doc_oebps.chainPath("css")).array;
}
- string doc_oebps_image(string fn_src) {
- return asNormalizedPath(doc_oebps(fn_src).chainPath("image")).array;
+ string doc_oebps_image() {
+ return asNormalizedPath(doc_oebps.chainPath("image")).array;
}
- string fn_mimetypes(string fn_src) {
+ string epub_file(string fn_src) {
+ return asNormalizedPath(base.chainPath(base_filename(fn_src) ~ ".epub")).array;
+ }
+ string dirtop() {
+ return "".chainPath("").array;
+ }
+ string fn_mimetypes() {
return asNormalizedPath(dirtop.chainPath("mimetypes")).array;
}
- string fn_dmi_container_xml(string fn_src) {
- return asNormalizedPath(doc_meta_inf(fn_src).chainPath("container.xml")).array;
+ string fn_dmi_container_xml() {
+ return asNormalizedPath(doc_meta_inf.chainPath("container.xml")).array;
}
- string fn_oebps_toc_nav_xhtml(string fn_src) {
- return asNormalizedPath(doc_oebps(fn_src).chainPath("toc_nav.xhtml")).array;
+ string fn_oebps_toc_nav_xhtml() {
+ return asNormalizedPath(doc_oebps.chainPath("toc_nav.xhtml")).array;
}
- string fn_oebps_toc_ncx(string fn_src) {
- return asNormalizedPath(doc_oebps(fn_src).chainPath("toc.ncx")).array;
+ string fn_oebps_toc_ncx() {
+ return asNormalizedPath(doc_oebps.chainPath("toc.ncx")).array;
}
- string fn_oebps_content_opf(string fn_src) {
- return asNormalizedPath(doc_oebps(fn_src).chainPath("content.opf")).array;
+ string fn_oebps_content_opf() {
+ return asNormalizedPath(doc_oebps.chainPath("content.opf")).array;
}
- string fn_oebps_content_xhtml(string fn_src, string seg_filename) {
- return asNormalizedPath(doc_oebps(fn_src).chainPath(seg_filename ~ ".xhtml")).array;
+ string fn_oebps_content_xhtml(string seg_filename) {
+ return asNormalizedPath(doc_oebps.chainPath(seg_filename ~ ".xhtml")).array;
}
- string fn_oebps_css(string fn_src) {
- return asNormalizedPath(doc_oebps_css(fn_src).chainPath("epub.css")).array;
+ string fn_oebps_css() {
+ return asNormalizedPath(doc_oebps_css.chainPath("epub.css")).array;
}
/+ debug +/
string dbg_docdir(string fn_src) {
@@ -472,9 +486,9 @@ template DocReformPathsLaTeX() {
template DocReformPathsSQLiteDiscrete() {
mixin DocReformRgxInit;
static auto rgx = Rgx();
- auto DocReformPathsSQLiteDiscrete(Po,Lng)(
- Po output_pth_root,
- Lng lng,
+ auto DocReformPathsSQLiteDiscrete()(
+ string output_pth_root,
+ string lng,
) {
struct _PathsStruct {
string base_filename(string fn_src) {