aboutsummaryrefslogtreecommitdiffhomepage
path: root/org/out_xmls.org
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 /org/out_xmls.org
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 'org/out_xmls.org')
-rw-r--r--org/out_xmls.org32
1 files changed, 24 insertions, 8 deletions
diff --git a/org/out_xmls.org b/org/out_xmls.org
index 78176a0..1ec53af 100644
--- a/org/out_xmls.org
+++ b/org/out_xmls.org
@@ -35,8 +35,10 @@ module doc_reform.io_out.xmls;
template outputXHTMLs() {
<<output_imports_xml>>
mixin spineRgxOut;
+ mixin spineRgxXHTML;
struct outputXHTMLs {
static auto rgx = RgxO();
+ static auto rgx_xhtml = RgxXHTML();
<<xhtml_format_objects_div_delimit>>
<<xhtml_format_objects_special_characters_text>>
<<xhtml_format_objects_special_characters_date>>
@@ -95,6 +97,9 @@ import
std.conv : to;
import
doc_reform.io_out,
+ doc_reform.io_out.rgx,
+ doc_reform.meta.rgx_files,
+ doc_reform.io_out.rgx_xhtml,
doc_reform.io_out.create_zip_file,
doc_reform.io_out.xmls,
doc_reform.io_out.xmls_css;
@@ -112,6 +117,8 @@ import
std.conv : to;
import
doc_reform.io_out,
+ doc_reform.io_out.rgx,
+ doc_reform.io_out.rgx_xhtml,
doc_reform.io_out.create_zip_file,
doc_reform.io_out.xmls,
doc_reform.io_out.xmls_css;
@@ -160,10 +167,10 @@ import
#+BEGIN_SRC d
@safe string special_characters_text(string _txt) {
_txt = _txt
- .replaceAll(rgx.xhtml_ampersand, "&amp;") // "&#38;"
- .replaceAll(rgx.xhtml_quotation, "&quot;") // "&#34;"
- .replaceAll(rgx.xhtml_less_than, "&lt;") // "&#60;"
- .replaceAll(rgx.xhtml_greater_than, "&gt;") // "&#62;"
+ .replaceAll(rgx_xhtml.ampersand, "&amp;") // "&#38;"
+ .replaceAll(rgx_xhtml.quotation, "&quot;") // "&#34;"
+ .replaceAll(rgx_xhtml.less_than, "&lt;") // "&#60;"
+ .replaceAll(rgx_xhtml.greater_than, "&gt;") // "&#62;"
.replaceAll(rgx.br_line, "<br />")
.replaceAll(rgx.br_line_inline, "<br />")
.replaceAll(rgx.br_line_spaced, "<br />\n<br />")
@@ -238,7 +245,7 @@ import
}
if (!(obj.metainfo.is_a == "code")) {
_txt = (_txt)
- .replaceAll(rgx.xhtml_line_break, "<br />");
+ .replaceAll(rgx_xhtml.line_break, "<br />");
}
return _txt;
}
@@ -1756,8 +1763,10 @@ template outputHTML() {
M doc_matters,
) {
mixin spineRgxOut;
+ mixin spineRgxXHTML;
auto xhtml_format = outputXHTMLs();
static auto rgx = RgxO();
+ static auto rgx_xhtml = RgxXHTML();
string[] doc_html;
string[] doc;
string suffix = ".html";
@@ -1990,7 +1999,9 @@ default:
M doc_matters,
) {
mixin spineRgxOut;
+ mixin spineRgxXHTML;
static auto rgx = RgxO();
+ static auto rgx_xhtml = RgxXHTML();
auto xhtml_format = outputXHTMLs();
string[][string] doc_html;
string[][string] doc_html_endnotes;
@@ -2289,11 +2300,11 @@ default:
debug(asserts) {
static assert(is(typeof(doc_html) == string[][string]));
}
- mixin spineRgxOut;
- static auto rgx = RgxO();
+ mixin spineRgxFiles;
+ static auto rgx_files = RgxFiles();
auto pth_html = spinePathsHTML!()(doc_matters.output_path, doc_matters.src.language);
auto xhtml_format = outputXHTMLs();
- auto m = doc_matters.src.filename.matchFirst(rgx.src_fn);
+ auto m = doc_matters.src.filename.matchFirst(rgx_files.src_fn);
try {
if (!exists(pth_html.seg(doc_matters.src.filename))) {
pth_html.seg(doc_matters.src.filename).mkdirRecurse;
@@ -2398,6 +2409,7 @@ template outputEPub3() {
mixin InternalMarkup;
mixin outputXHTMLs;
static auto rgx = RgxO();
+ static auto rgx_xhtml = RgxXHTML();
<<xhtml_format_objects_special_characters_text>>
<<output_epub3_fixed_mimetypes>>
<<output_epub3_fixed_container_xml>>
@@ -2572,6 +2584,7 @@ xmlns="urn:oasis:names:tc:opendocument:xmlns:container">
enum DomTags { none, open, close, close_and_open, open_still, }
auto markup = InlineMarkup();
static auto rgx = RgxO();
+ static auto rgx_xhtml = RgxXHTML();
string toc;
bool _new_title_set = false;
string toc_head = format(q"┃<html xmlns="https://www.w3.org/1999/xhtml"
@@ -2692,8 +2705,10 @@ xmlns="urn:oasis:names:tc:opendocument:xmlns:container">
I doc_matters,
) {
mixin spineRgxOut;
+ mixin spineRgxXHTML;
auto xhtml_format = outputXHTMLs();
static auto rgx = RgxO();
+ static auto rgx_xhtml = RgxXHTML();
string[] doc;
string segment_filename;
string[] top_level_headings = ["","","",""];
@@ -3065,6 +3080,7 @@ zip -0 file.epub mimetype && zip -r -9 file.epub META-INF OEBPS
static assert(is(typeof(epub_write.oebps_content_opf) == string));
}
static auto rgx = RgxO();
+ static auto rgx_xhtml = RgxXHTML();
auto pth_epub3 = spinePathsEPUB!()(doc_matters.output_path, doc_matters.src.language);
auto xhtml_format = outputXHTMLs();
/+ zip file +/