aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/doc_reform/io_out/sqlite.d
diff options
context:
space:
mode:
authorRalph Amissah <ralph.amissah@gmail.com>2022-11-25 22:06:40 -0500
committerRalph Amissah <ralph.amissah@gmail.com>2022-12-23 18:17:41 -0500
commitf6d28b62f0e02b8a88a1832589e203c7a613f45b (patch)
treeb5d6462e45bae998190194784e02b143a83f79a3 /src/doc_reform/io_out/sqlite.d
parentgitignore & things nix (diff)
regex review, match speed & compile time, ctregex
- improve match time - add interim fontface identifier marker - improve compile time - remove unused regexs - separate out some specialized output matches
Diffstat (limited to 'src/doc_reform/io_out/sqlite.d')
-rw-r--r--src/doc_reform/io_out/sqlite.d39
1 files changed, 23 insertions, 16 deletions
diff --git a/src/doc_reform/io_out/sqlite.d b/src/doc_reform/io_out/sqlite.d
index a546998..33c25fe 100644
--- a/src/doc_reform/io_out/sqlite.d
+++ b/src/doc_reform/io_out/sqlite.d
@@ -49,7 +49,10 @@
+/
module doc_reform.io_out.sqlite;
-import doc_reform.io_out;
+import
+ doc_reform.io_out,
+ doc_reform.io_out.rgx,
+ doc_reform.io_out.rgx_xhtml;
import
std.file,
std.uri;
@@ -57,8 +60,10 @@ import std.conv : to;
import std.typecons : Nullable;
import d2sqlite3;
mixin spineRgxOut;
+mixin spineRgxXHTML;
mixin InternalMarkup;
static auto rgx = RgxO();
+static auto rgx_xhtml = RgxXHTML();
static auto mkup = InlineMarkup();
long _metadata_tid_lastrowid;
template SQLiteHubBuildTablesAndPopulate() {
@@ -193,6 +198,7 @@ template SQLiteFormatAndLoadObject() {
M doc_matters,
) {
mixin spineRgxOut;
+ mixin spineRgxXHTML;
struct sqlite_format_and_load_objects {
string generic_munge_sanitize_text_for_search(
string _txt,
@@ -235,15 +241,15 @@ template SQLiteFormatAndLoadObject() {
) {
string _html_special_characters(string _txt){
_txt = _txt
- .replaceAll(rgx.xhtml_ampersand, "&#38;")
- .replaceAll(rgx.xhtml_quotation, "&#34;")
- .replaceAll(rgx.xhtml_less_than, "&#60;")
- .replaceAll(rgx.xhtml_greater_than, "&#62;")
+ .replaceAll(rgx_xhtml.ampersand, "&#38;")
+ .replaceAll(rgx_xhtml.quotation, "&#34;")
+ .replaceAll(rgx_xhtml.less_than, "&#60;")
+ .replaceAll(rgx_xhtml.greater_than, "&#62;")
.replaceAll(rgx.nbsp_char, " ")
.replaceAll(rgx.br_line_inline, "<br />")
.replaceAll(rgx.br_line, "<br />")
.replaceAll(rgx.br_line_spaced, "<br /><br />")
- .replaceAll(rgx.xhtml_line_break, "<br />");
+ .replaceAll(rgx_xhtml.line_break, "<br />");
return _txt;
}
string _html_font_face(string _txt){
@@ -272,23 +278,23 @@ template SQLiteFormatAndLoadObject() {
}
string html_special_characters(string _txt){
_txt = _txt
- .replaceAll(rgx.xhtml_ampersand, "&#38;")
- .replaceAll(rgx.xhtml_quotation, "&#34;")
- .replaceAll(rgx.xhtml_less_than, "&#60;")
- .replaceAll(rgx.xhtml_greater_than, "&#62;")
+ .replaceAll(rgx_xhtml.ampersand, "&#38;")
+ .replaceAll(rgx_xhtml.quotation, "&#34;")
+ .replaceAll(rgx_xhtml.less_than, "&#60;")
+ .replaceAll(rgx_xhtml.greater_than, "&#62;")
.replaceAll(rgx.nbsp_char, " ")
.replaceAll(rgx.br_line_inline, "<br />")
.replaceAll(rgx.br_line, "<br />")
.replaceAll(rgx.br_line_spaced, "<br /><br />")
- .replaceAll(rgx.xhtml_line_break, "<br />");
+ .replaceAll(rgx_xhtml.line_break, "<br />");
return _txt;
}
string html_special_characters_code(string _txt){
_txt = _txt
- .replaceAll(rgx.xhtml_ampersand, "&#38;")
- .replaceAll(rgx.xhtml_quotation, "&#34;")
- .replaceAll(rgx.xhtml_less_than, "&#60;")
- .replaceAll(rgx.xhtml_greater_than, "&#62;")
+ .replaceAll(rgx_xhtml.ampersand, "&#38;")
+ .replaceAll(rgx_xhtml.quotation, "&#34;")
+ .replaceAll(rgx_xhtml.less_than, "&#60;")
+ .replaceAll(rgx_xhtml.greater_than, "&#62;")
.replaceAll(rgx.nbsp_char, " ");
return _txt;
}
@@ -314,6 +320,7 @@ template SQLiteFormatAndLoadObject() {
string _xml_type = "seg",
) {
static auto rgx = RgxO();
+ static auto rgx_xhtml = RgxXHTML();
if (obj.metainfo.is_a == "group") {
_txt = (_txt)
.replaceAll(rgx.grouped_para_indent_1,
@@ -1614,7 +1621,7 @@ template SQLiteTablesCreate() {
: "";
if (db_filename.length > 0 && db_path.length > 0) {
if ((opt_action.vox_gt1)) {
- writeln("db name & path: ", db_path, db_filename);
+ writeln("db name & path: ", db_path, "/", db_filename);
}
auto pth_sqlite = spinePathsSQLite!()(db_filename, db_path);
pth_sqlite.base.mkdirRecurse;