aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/doc_reform/output
diff options
context:
space:
mode:
Diffstat (limited to 'src/doc_reform/output')
-rw-r--r--src/doc_reform/output/paths_output.d35
-rw-r--r--src/doc_reform/output/sqlite.d34
2 files changed, 56 insertions, 13 deletions
diff --git a/src/doc_reform/output/paths_output.d b/src/doc_reform/output/paths_output.d
index f4dc083..f6e8f1b 100644
--- a/src/doc_reform/output/paths_output.d
+++ b/src/doc_reform/output/paths_output.d
@@ -79,6 +79,41 @@ 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 DocReformPathsHTML() {
mixin DocReformRgxInit;
static auto rgx = Rgx();
diff --git a/src/doc_reform/output/sqlite.d b/src/doc_reform/output/sqlite.d
index bf0d546..0e424e6 100644
--- a/src/doc_reform/output/sqlite.d
+++ b/src/doc_reform/output/sqlite.d
@@ -913,28 +913,27 @@ template SQLiteTablesReCreate() {
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
);
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
);
CREATE INDEX idx_ocn ON doc_objects(ocn);
@@ -1021,7 +1020,8 @@ template SQLiteInsertMetadata() {
rights_copyright_text,
rights_copyright_translation,
rights_copyright_video,
- rights_license
+ rights_license,
+ site_url_doc_root
)
VALUES (
'%s',
@@ -1070,6 +1070,7 @@ template SQLiteInsertMetadata() {
'%s',
'%s',
'%s',
+ '%s',
'%s'
);
¶",
@@ -1119,7 +1120,8 @@ template SQLiteInsertMetadata() {
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)
);
return _insert_metadata;
}
@@ -1130,34 +1132,41 @@ template SQLiteInsertDocObjectsLoop() {
D doc_abstraction,
) {
string _uid = SQLinsertDelimiter!()(doc_matters.src.doc_uid);
+ auto site_url = DocReformPathsUrl!()(doc_matters);
string insertDocObjectsRow(O)(O obj) {
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
)
VALUES (
'%s',
%s,
'%s',
'%s',
+ '%s',
%s,
'%s',
+ '%s',
'%s'
);
¶",
_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),
);
return _insert_doc_objects_row;
}
@@ -1440,28 +1449,27 @@ template SQLiteTablesCreate() {
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
);
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
);
CREATE INDEX idx_ocn ON doc_objects(ocn);