diff options
author | Ralph Amissah <ralph.amissah@gmail.com> | 2019-07-08 17:41:06 -0400 |
---|---|---|
committer | Ralph Amissah <ralph.amissah@gmail.com> | 2019-10-17 19:07:20 -0400 |
commit | 1319336d6f8ce2de9a1a6319917bee6be278ad5a (patch) | |
tree | 132773a7a8bb44e9d456347f4d7de0c4ef2611d7 /org/default_paths.org | |
parent | harvests reorganized; adjustments: output, paths (diff) |
0.7.4 sqlite related, also some xml paths
Diffstat (limited to 'org/default_paths.org')
-rw-r--r-- | org/default_paths.org | 199 |
1 files changed, 103 insertions, 96 deletions
diff --git a/org/default_paths.org b/org/default_paths.org index dba021f..b1d6980 100644 --- a/org/default_paths.org +++ b/org/default_paths.org @@ -1026,47 +1026,6 @@ template DocReformOutPathsFnPd() { } #+END_SRC -** _url_ :url: - -#+name: template_paths_url -#+BEGIN_SRC d -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(); - } -} -#+END_SRC - ** _html_ :html: *** relative @@ -1075,7 +1034,7 @@ template DocReformPathsUrl() { 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"; @@ -1089,7 +1048,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() { @@ -1131,26 +1090,26 @@ template DocReformDocRootTreeHTML() { } #+END_SRC -*** absolute +*** absolute disk path #+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 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; @@ -1195,46 +1154,88 @@ template DocReformPathsHTML() { #+name: template_paths_html #+BEGIN_SRC d -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); @@ -1258,9 +1259,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"; @@ -1271,44 +1272,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) { @@ -1469,9 +1476,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) { |