From ed71ef0ac032456c882bea44b04c02863cb90a46 Mon Sep 17 00:00:00 2001 From: Ralph Amissah Date: Sat, 25 Jan 2020 13:34:47 -0500 Subject: code ctRegex calls, tidying --- src/doc_reform/io_out/epub3.d | 10 +++++----- src/doc_reform/io_out/html.d | 12 ++++++------ src/doc_reform/io_out/hub.d | 8 ++++---- src/doc_reform/io_out/latex.d | 4 ++-- src/doc_reform/io_out/odt.d | 10 +++++----- src/doc_reform/io_out/paths_output.d | 32 ++++++++++++++++---------------- src/doc_reform/io_out/rgx.d | 5 ++--- src/doc_reform/io_out/source_pod.d | 4 ++-- src/doc_reform/io_out/sqlite.d | 6 +++--- src/doc_reform/io_out/xmls.d | 4 ++-- 10 files changed, 47 insertions(+), 48 deletions(-) (limited to 'src/doc_reform/io_out') diff --git a/src/doc_reform/io_out/epub3.d b/src/doc_reform/io_out/epub3.d index f8f5ba4..9d29968 100644 --- a/src/doc_reform/io_out/epub3.d +++ b/src/doc_reform/io_out/epub3.d @@ -131,7 +131,7 @@ template outputEPub3() { @safe string epub3_oebps_toc_nav_xhtml(D,I)(D doc_abstraction, I doc_matters) { enum DomTags { none, open, close, close_and_open, open_still, } auto markup = InlineMarkup(); - static auto rgx = Rgx(); + static auto rgx = RgxO(); string toc =format(" @@ -211,7 +211,7 @@ template outputEPub3() { int counter = 0; string _uuid = "18275d951861c77f78acd05672c9906924c59f18a2e0ba06dad95959693e9bd8"; // TODO shared elsewhere auto markup = InlineMarkup(); - static auto rgx = Rgx(); + static auto rgx = RgxO(); enum DomTags { none, open, close, close_and_open, open_still, } string toc = format(q"┃ @@ -301,9 +301,9 @@ template outputEPub3() { const D doc_abstraction, I doc_matters, ) { - mixin spineOutputRgxInit; + mixin spineRgxOut; auto xhtml_format = outputXHTMLs(); - static auto rgx = Rgx(); + static auto rgx = RgxO(); string[] doc; string segment_filename; string[] top_level_headings = ["","","",""]; @@ -618,7 +618,7 @@ template outputEPub3() { static assert(is(typeof(epub_write.oebps_toc_ncx) == string)); static assert(is(typeof(epub_write.oebps_content_opf) == string)); } - static auto rgx = Rgx(); + static auto rgx = RgxO(); auto pth_epub3 = spinePathsEPUB!()(doc_matters.output_path, doc_matters.src.language); auto xhtml_format = outputXHTMLs(); /+ zip file +/ diff --git a/src/doc_reform/io_out/html.d b/src/doc_reform/io_out/html.d index 637b007..ee530ca 100644 --- a/src/doc_reform/io_out/html.d +++ b/src/doc_reform/io_out/html.d @@ -17,9 +17,9 @@ template outputHTML() { const D doc_abstraction, M doc_matters, ) { - mixin spineOutputRgxInit; + mixin spineRgxOut; auto xhtml_format = outputXHTMLs(); - static auto rgx = Rgx(); + static auto rgx = RgxO(); string[] doc_html; string[] doc; string suffix = ".html"; @@ -210,8 +210,8 @@ template outputHTML() { const D doc_abstraction, M doc_matters, ) { - mixin spineOutputRgxInit; - static auto rgx = Rgx(); + mixin spineRgxOut; + static auto rgx = RgxO(); auto xhtml_format = outputXHTMLs(); string[][string] doc_html; string[][string] doc_html_endnotes; @@ -467,8 +467,8 @@ template outputHTML() { debug(asserts) { static assert(is(typeof(doc_html) == string[][string])); } - mixin spineOutputRgxInit; - static auto rgx = Rgx(); + mixin spineRgxOut; + static auto rgx = RgxO(); 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); diff --git a/src/doc_reform/io_out/hub.d b/src/doc_reform/io_out/hub.d index df3d28c..e275348 100644 --- a/src/doc_reform/io_out/hub.d +++ b/src/doc_reform/io_out/hub.d @@ -15,10 +15,10 @@ template outputHub() { const D doc_abstraction, I doc_matters ) { - mixin spineOutputRgxInit; + mixin spineRgxOut; mixin Msg; auto msg = Msg!()(doc_matters); - static auto rgx = Rgx(); + static auto rgx = RgxO(); enum outTask { source_or_pod, sqlite, sqlite_multi, latex, odt, epub, html_scroll, html_seg, html_stuff } void Scheduled(D,I)(int sched, D doc_abstraction, I doc_matters) { auto msg = Msg!()(doc_matters); @@ -118,8 +118,8 @@ template outputHubOp() { doc_reform.io_out.create_zip_file, doc_reform.io_out.paths_output; @system void outputHubOp(E,O)(E env, O opt_action) { - mixin spineOutputRgxInit; - static auto rgx = Rgx(); + mixin spineRgxOut; + static auto rgx = RgxO(); if ((opt_action.sqlite_db_drop)) { if ((opt_action.verbose)) { writeln("sqlite drop db..."); diff --git a/src/doc_reform/io_out/latex.d b/src/doc_reform/io_out/latex.d index b8e33f4..ff5b0df 100644 --- a/src/doc_reform/io_out/latex.d +++ b/src/doc_reform/io_out/latex.d @@ -8,8 +8,8 @@ template outputLaTeX() { std.uri, std.conv : to; mixin InternalMarkup; // watch - mixin spineOutputRgxInit; - static auto rgx = Rgx(); + mixin spineRgxOut; + static auto rgx = RgxO(); mixin spineLanguageCodes; auto lang = Lang(); auto paper() { diff --git a/src/doc_reform/io_out/odt.d b/src/doc_reform/io_out/odt.d index 67b34ba..09ff63d 100644 --- a/src/doc_reform/io_out/odt.d +++ b/src/doc_reform/io_out/odt.d @@ -12,9 +12,9 @@ template formatODT() { doc_reform.io_out.create_zip_file, doc_reform.io_out.xmls, doc_reform.io_out.xmls_css; - mixin spineOutputRgxInit; + mixin spineRgxOut; struct formatODT { - static auto rgx = Rgx(); + static auto rgx = RgxO(); @safe string _tags(O)(const O obj) { string _tags = ""; if (obj.tags.anchor_tags.length > 0) { @@ -56,7 +56,7 @@ template formatODT() { return _on; } @safe string _footnotes()(string _txt) { - static auto rgx = Rgx(); + static auto rgx = RgxO(); _txt = _txt.replaceAll( rgx.inline_notes_al_regular_number_note, format(q"┃ @@ -603,8 +603,8 @@ template outputODT() { doc_reform.io_out.xmls, doc_reform.io_out.xmls_css; mixin InternalMarkup; - mixin spineOutputRgxInit; - static auto rgx = Rgx(); + mixin spineRgxOut; + static auto rgx = RgxO(); // mixin outputXmlODT; @safe string odt_head(I)(I doc_matters) { string _has_tables = format(q"┃ diff --git a/src/doc_reform/io_out/paths_output.d b/src/doc_reform/io_out/paths_output.d index 23c4624..f01f88b 100644 --- a/src/doc_reform/io_out/paths_output.d +++ b/src/doc_reform/io_out/paths_output.d @@ -82,8 +82,8 @@ template spineOutPathsFnPd() { } template spineDocRootTreeHTML() { - mixin spineRgxInit; - static auto rgx = Rgx(); + mixin spineRgxIn; + static auto rgx = RgxI(); auto spineDocRootTreeHTML()(string lng) { auto lng_pth = spineOutPaths!()("", lng); string base_dir = "html"; @@ -142,8 +142,8 @@ template spineDocRootTreeHTML() { } } template spinePathsHTML() { - mixin spineRgxInit; - static auto rgx = Rgx(); + mixin spineRgxIn; + static auto rgx = RgxI(); auto spinePathsHTML()( string output_path_root, string lng, @@ -203,8 +203,8 @@ template spinePathsHTML() { } template spineUrlsHTML() { import std.format; - mixin spineRgxInit; - static auto rgx = Rgx(); + mixin spineRgxIn; + static auto rgx = RgxI(); auto spineUrlsHTML()( string url_doc_root, string lng, @@ -304,8 +304,8 @@ template spineUrlsHTML() { } } template spinePathsEPUB() { - mixin spineRgxInit; - static auto rgx = Rgx(); + mixin spineRgxIn; + static auto rgx = RgxI(); auto spinePathsEPUB()( string output_pth_root, string lng, @@ -409,8 +409,8 @@ template spinePathsEPUB() { } } template spinePathsODT() { - mixin spineRgxInit; - static auto rgx = Rgx(); + mixin spineRgxIn; + static auto rgx = RgxI(); auto spinePathsODT(M)( M doc_matters, ) { @@ -473,8 +473,8 @@ template spinePathsODT() { } } template spinePathsLaTeX() { - mixin spineRgxInit; - static auto rgx = Rgx(); + mixin spineRgxIn; + static auto rgx = RgxI(); auto spinePathsLaTeX(M)( M doc_matters, ) { @@ -502,8 +502,8 @@ template spinePathsLaTeX() { } } template spinePathsSQLiteDiscrete() { - mixin spineRgxInit; - static auto rgx = Rgx(); + mixin spineRgxIn; + static auto rgx = RgxI(); auto spinePathsSQLiteDiscrete()( string output_pth_root, string lng, @@ -528,8 +528,8 @@ template spinePathsSQLiteDiscrete() { } } template spinePathsSQLite() { - mixin spineRgxInit; - static auto rgx = Rgx(); + mixin spineRgxIn; + static auto rgx = RgxI(); auto spinePathsSQLite(DbN, Po)( DbN db_name, Po output_pth_root, diff --git a/src/doc_reform/io_out/rgx.d b/src/doc_reform/io_out/rgx.d index 4d0801c..32d457d 100644 --- a/src/doc_reform/io_out/rgx.d +++ b/src/doc_reform/io_out/rgx.d @@ -2,9 +2,8 @@ regex: regular expressions used in sisu document parser +/ module doc_reform.io_out.rgx; -static template spineOutputRgxInit() { - import doc_reform.io_out.defaults; - static struct Rgx { +static template spineRgxOut() { + static struct RgxO { static newline = ctRegex!("\n", "mg"); static space = ctRegex!(`[ ]`, "mg"); static spaces_keep = ctRegex!(`(?P^[ ]+|[ ]{2,})`, "mg"); // code, verse, block diff --git a/src/doc_reform/io_out/source_pod.d b/src/doc_reform/io_out/source_pod.d index 59746de..5a96ed6 100644 --- a/src/doc_reform/io_out/source_pod.d +++ b/src/doc_reform/io_out/source_pod.d @@ -14,14 +14,14 @@ template spinePod() { debug(asserts) { // static assert(is(typeof(doc_matters) == tuple)); } - mixin spineOutputRgxInit; + mixin spineRgxOut; string pwd = doc_matters.env.pwd; auto src_path_info = doc_matters.src_path_info; auto pth_dr_doc_src = doc_matters.src_path_info; auto pths_pod = spinePathsPods!()(doc_matters); mixin spineLanguageCodes; auto lang = Lang(); - static auto rgx = Rgx(); + static auto rgx = RgxO(); assert (doc_matters.src.filename.match(rgx.src_fn)); @system auto pod_archive(Z)( string _source_type, diff --git a/src/doc_reform/io_out/sqlite.d b/src/doc_reform/io_out/sqlite.d index e83a75f..d24fc00 100644 --- a/src/doc_reform/io_out/sqlite.d +++ b/src/doc_reform/io_out/sqlite.d @@ -6,9 +6,9 @@ import std.conv : to; import d2sqlite3; import std.typecons : Nullable; -mixin spineOutputRgxInit; +mixin spineRgxOut; mixin InternalMarkup; -static auto rgx = Rgx(); +static auto rgx = RgxO(); static auto mkup = InlineMarkup(); long _metadata_tid_lastrowid; template SQLiteHubBuildTablesAndPopulate() { @@ -138,7 +138,7 @@ template SQLiteFormatAndLoadObject() { auto SQLiteFormatAndLoadObject(M)( M doc_matters, ) { - mixin spineOutputRgxInit; + mixin spineRgxOut; struct sqlite_format_and_load_objects { string generic_munge_sanitize_text_for_search( string _txt, diff --git a/src/doc_reform/io_out/xmls.d b/src/doc_reform/io_out/xmls.d index 1b038a9..b640d81 100644 --- a/src/doc_reform/io_out/xmls.d +++ b/src/doc_reform/io_out/xmls.d @@ -12,9 +12,9 @@ template outputXHTMLs() { doc_reform.io_out.create_zip_file, doc_reform.io_out.xmls, doc_reform.io_out.xmls_css; - mixin spineOutputRgxInit; + mixin spineRgxOut; struct outputXHTMLs { - static auto rgx = Rgx(); + static auto rgx = RgxO(); @safe string div_delimit( string part, return ref string previous_part -- cgit v1.2.3