aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
-rw-r--r--org/default_paths.org42
-rw-r--r--org/doc_reform.org2
-rw-r--r--org/output_sqlite.org25
-rw-r--r--src/doc_reform/output/paths_output.d35
-rw-r--r--src/doc_reform/output/sqlite.d34
-rw-r--r--views/version.txt2
6 files changed, 117 insertions, 23 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
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);
diff --git a/views/version.txt b/views/version.txt
index 700193b..de1a62b 100644
--- a/views/version.txt
+++ b/views/version.txt
@@ -4,7 +4,7 @@ struct Version {
int minor;
int patch;
}
-enum ver = Version(0, 3, 3);
+enum ver = Version(0, 4, 0);
version (Posix) {
version (DigitalMars) {
} else version (LDC) {