aboutsummaryrefslogtreecommitdiffhomepage
path: root/org
diff options
context:
space:
mode:
authorRalph Amissah <ralph.amissah@gmail.com>2018-11-15 18:57:53 -0500
committerRalph Amissah <ralph.amissah@gmail.com>2019-05-17 16:59:38 -0400
commitf7a56d241065cac08e6fba20cb9b658a8f073ad5 (patch)
tree3056f3246833590fb19b22dde5a338bb371195f4 /org
parentcosmetic (diff)
0.4.0 sqlite related
Diffstat (limited to 'org')
-rw-r--r--org/default_paths.org42
-rw-r--r--org/doc_reform.org2
-rw-r--r--org/output_sqlite.org25
3 files changed, 60 insertions, 9 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
diff --git a/org/doc_reform.org b/org/doc_reform.org
index 69e23a9..afc7477 100644
--- a/org/doc_reform.org
+++ b/org/doc_reform.org
@@ -26,7 +26,7 @@ struct Version {
int minor;
int patch;
}
-enum ver = Version(0, 3, 3);
+enum ver = Version(0, 4, 0);
#+END_SRC
** compilation restrictions (supported compilers)
diff --git a/org/output_sqlite.org b/org/output_sqlite.org
index 61390a3..b1c9cf4 100644
--- a/org/output_sqlite.org
+++ b/org/output_sqlite.org
@@ -205,6 +205,7 @@ template SQLiteInsertDocObjectsLoop() {
D doc_abstraction,
) {
string _uid = SQLinsertDelimiter!()(doc_matters.src.doc_uid);
+ auto site_url = DocReformPathsUrl!()(doc_matters);
string insertDocObjectsRow(O)(O obj) {
<<sqlite_formatted_insertions_doc_objects>>
return _insert_doc_objects_row;
@@ -1508,8 +1509,7 @@ CREATE TABLE metadata_and_text (
pod_name VARCHAR(256) NULL, /* zipped pod, work to be done here */
pod_fingerprint VARCHAR(256) NULL, /* zipped pod, work to be done here */
pod_size VARCHAR(10) NULL, /* zipped pod, work to be done here */
- src_text TEXT NULL,
- fulltext TEXT NULL,
+ site_url_doc_root VARCHAR(256) NULL, /* url path to doc root */
links TEXT NULL
);
#+END_SRC
@@ -1522,20 +1522,20 @@ CREATE TABLE doc_objects (
lid BIGINT PRIMARY KEY,
uid_metadata_and_text VARCHAR(256) REFERENCES metadata_and_text(uid) ON DELETE CASCADE,
ocn SMALLINT,
- ocnd VARCHAR(6),
- ocns VARCHAR(6),
+ obj_id VARCHAR(6) NULL,
clean TEXT NULL,
body TEXT NULL,
seg VARCHAR(256) NULL,
lev_an VARCHAR(1),
- lev SMALLINT NULL,
is_of_type VARCHAR(16),
is_a VARCHAR(16),
+ lev SMALLINT NULL,
node VARCHAR(16) NULL,
parent VARCHAR(16) NULL,
last_decendant VARCHAR(16) NULL, /* headings only */
digest_clean CHAR(256),
digest_all CHAR(256),
+ html_seg_url CHAR(256),
types CHAR(1) NULL
);
#+END_SRC
@@ -1612,11 +1612,13 @@ string _insert_doc_objects_row = format(q"¶
INSERT INTO doc_objects (
uid_metadata_and_text,
ocn,
+ obj_id,
clean,
body,
lev,
is_of_type,
- is_a
+ is_a,
+ html_seg_url
)
#+END_SRC
@@ -1629,8 +1631,10 @@ string _insert_doc_objects_row = format(q"¶
%s,
'%s',
'%s',
+ '%s',
%s,
'%s',
+ '%s',
'%s'
);
#+END_SRC
@@ -1642,11 +1646,13 @@ string _insert_doc_objects_row = format(q"¶
¶",
_uid,
obj.metainfo.ocn,
+ obj.metainfo.identifier,
SQLinsertDelimiter!()(obj_txt["text"]),
SQLinsertDelimiter!()(obj_txt["html"]),
obj.metainfo.heading_lev_markup,
obj.metainfo.is_of_type,
obj.metainfo.is_a,
+ site_url.html_seg(obj.tags.html_segment_anchor_tag_is, obj.metainfo.identifier),
);
#+END_SRC
@@ -1710,7 +1716,8 @@ string _insert_metadata = format(q"¶
rights_copyright_text,
rights_copyright_translation,
rights_copyright_video,
- rights_license
+ rights_license,
+ site_url_doc_root
)
#+END_SRC
@@ -1765,6 +1772,7 @@ string _insert_metadata = format(q"¶
'%s',
'%s',
'%s',
+ '%s',
'%s'
);
#+END_SRC
@@ -1820,7 +1828,8 @@ string _insert_metadata = format(q"¶
SQLinsertDelimiter!()(doc_matters.conf_make_meta.meta.rights_copyright_text),
SQLinsertDelimiter!()(doc_matters.conf_make_meta.meta.rights_copyright_translation),
SQLinsertDelimiter!()(doc_matters.conf_make_meta.meta.rights_copyright_video),
- SQLinsertDelimiter!()(doc_matters.conf_make_meta.meta.rights_license)
+ SQLinsertDelimiter!()(doc_matters.conf_make_meta.meta.rights_license),
+ SQLinsertDelimiter!()(doc_matters.conf_make_meta.conf.webserv_url_doc_root)
);
#+END_SRC