diff options
Diffstat (limited to 'org/default_paths.org')
-rw-r--r-- | org/default_paths.org | 42 |
1 files changed, 42 insertions, 0 deletions
diff --git a/org/default_paths.org b/org/default_paths.org index 07f1176..6d38825 100644 --- a/org/default_paths.org +++ b/org/default_paths.org @@ -915,6 +915,7 @@ import std.array, std.stdio; import doc_reform.meta.rgx; <<template_paths_out>> +<<template_paths_url>> <<template_paths_html>> <<template_paths_epub>> <<template_paths_sqlite>> @@ -1012,6 +1013,47 @@ 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: #+name: template_paths_html |