diff options
author | Ralph Amissah <ralph.amissah@gmail.com> | 2022-11-25 22:06:40 -0500 |
---|---|---|
committer | Ralph Amissah <ralph.amissah@gmail.com> | 2022-12-23 18:17:41 -0500 |
commit | f6d28b62f0e02b8a88a1832589e203c7a613f45b (patch) | |
tree | b5d6462e45bae998190194784e02b143a83f79a3 | |
parent | gitignore & 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
39 files changed, 1114 insertions, 655 deletions
diff --git a/org/default_imports.org b/org/default_imports.org index 0dbba86..ea39bcd 100644 --- a/org/default_imports.org +++ b/org/default_imports.org @@ -33,8 +33,7 @@ module doc_reform.meta; #+NAME: imports_for_meta_general #+BEGIN_SRC d public import - doc_reform.meta.defaults, - doc_reform.meta.rgx; + doc_reform.meta.defaults; /+ std +/ public import std.array, @@ -82,8 +81,7 @@ public import doc_reform.share.defaults, doc_reform.io_in.paths_source, doc_reform.io_out.defaults, - doc_reform.io_out.paths_output, - doc_reform.io_out.rgx; + doc_reform.io_out.paths_output; #+END_SRC * document header including copyright & license diff --git a/org/default_paths.org b/org/default_paths.org index 7f27191..a60d006 100644 --- a/org/default_paths.org +++ b/org/default_paths.org @@ -39,7 +39,7 @@ import std.conv : to; import doc_reform.meta.defaults, - doc_reform.meta.rgx; + doc_reform.meta.rgx_files; <<template_paths_src_0>> <<template_paths_src_1>> <<template_paths_src_2>> @@ -54,8 +54,8 @@ import #+NAME: template_paths_src_0 #+BEGIN_SRC d template PodManifest() { - mixin spineRgxIn; - static auto rgx = RgxI(); + mixin spineRgxFiles; + static auto rgx_files = RgxFiles(); @safe auto PodManifest(O)( O _opt_action, string _pth="" @@ -70,12 +70,12 @@ template PodManifest() { && (exists(_pth.chainPath(pod_manifest_filename).array) != 0 && (_pth.chainPath(pod_manifest_filename).array).isFile)) { _manifest_path = _pth; - } else if (_pth.match(rgx.src_pth_contents) + } else if (_pth.match(rgx_files.src_pth_contents) && exists(_pth) != 0 && _pth.isFile) { _manifest_path = _pth.dirName; - } else if (_pth.match(rgx.src_pth_pod_sst_or_ssm) + } else if (_pth.match(rgx_files.src_pth_pod_sst_or_ssm) && exists(_pth) != 0 && (_pth.isFile)) { - if (auto m = _pth.match(rgx.src_pth_pod_sst_or_ssm)) { + if (auto m = _pth.match(rgx_files.src_pth_pod_sst_or_ssm)) { _manifest_path = m.captures["podpath"]; } } else { @@ -129,9 +129,9 @@ pod #+NAME: template_paths_src_1 #+BEGIN_SRC d template PathMatters() { - mixin spineRgxIn; mixin InternalMarkup; - static auto rgx = RgxI(); + mixin spineRgxFiles; + static auto rgx_files = RgxFiles(); static auto mkup = InlineMarkup(); @safe auto PathMatters(O,E)( O _opt_action, @@ -204,7 +204,7 @@ template PathMatters() { string[] _lngs; foreach (filename_; manifest_list_of_filenames) { string _k = "en"; - if (auto m = (filename_).match(rgx.language_code_and_filename)) { + if (auto m = (filename_).match(rgx_files.language_code_and_filename)) { _k = m.captures[1].to!string; } _lngs ~= _k; // all the languages from the manifest list of filenames with paths @@ -241,11 +241,11 @@ template PathMatters() { return filename.stripExtension; } @safe string filename_extension() { - return filename.match(rgx.src_pth_sst_or_ssm).captures["extension"]; + return filename.match(rgx_files.src_pth_sst_or_ssm).captures["extension"]; } @safe string lng() { string _k; - if (auto m = path_and_fn.match(rgx.language_code_and_filename)) { + if (auto m = path_and_fn.match(rgx_files.language_code_and_filename)) { _k = m.captures[1]; } else {_k = "en"; } return _k; @@ -329,7 +329,7 @@ template PathMatters() { } else { _dir = ((path_and_fn.chainPath("../../../")).asNormalizedPath).array; assert(_dir == absolute_path_to_src - .match(rgx.src_base_parent_dir_name).captures["dir"]); + .match(rgx_files.src_base_parent_dir_name).captures["dir"]); } if (_opt_action.debug_do) { writeln("--> (base_dir) ", _dir); @@ -352,7 +352,7 @@ template PathMatters() { string _dir; if ( auto m = (absolute_path_to_src) - .match(rgx.src_formalised_file_path_parts) + .match(rgx_files.src_formalised_file_path_parts) ) { _dir = ((m.captures["pth"]).asNormalizedPath).array; } else if ( @@ -407,7 +407,7 @@ template PathMatters() { ) { _dir = m.captures["dir"]; } else { - _dir = (absolute_path_to_src).match(rgx.src_base_parent_dir_name).captures["dir"]; + _dir = (absolute_path_to_src).match(rgx_files.src_base_parent_dir_name).captures["dir"]; } if (_opt_action.debug_do) { writeln("--> (base_parent_dir) ", _dir); @@ -477,8 +477,6 @@ template PathMatters() { #+NAME: template_paths_src_2 #+BEGIN_SRC d template configFilePaths() { - mixin spineRgxIn; - static auto rgx = RgxI(); @safe auto configFilePaths(M,E)( M _manifested, E _env, @@ -650,8 +648,8 @@ filelist for processing [things to ponder] #+NAME: template_paths_src_3 #+BEGIN_SRC d template spinePathsSRC() { - mixin spineRgxIn; - static auto rgx = RgxI(); + mixin spineRgxFiles; + static auto rgx_files = RgxFiles(); @safe auto spinePathsSRC(D,Fn)( D _pwd, Fn _fn_src_and_path, @@ -663,7 +661,7 @@ template spinePathsSRC() { @safe string language() { // use command line info as well? string _k; - if (auto m = _fn_src_and_path.match(rgx.language_code_and_filename)) { + if (auto m = _fn_src_and_path.match(rgx_files.language_code_and_filename)) { _k = m.captures[1]; } else { /+ unknown until doc_meta read, (could provide & use command line info?) +/ _k = "xx"; // original default was "en" but is not known @@ -705,8 +703,6 @@ template spinePathsSRC() { #+NAME: template_paths_pods #+BEGIN_SRC d template spinePathsPods() { - mixin spineRgxIn; - static auto rgx = RgxI(); string _suffix = ".zip"; auto spinePathsPods(M)(M doc_matters) { string _base_dir_pod = (doc_matters.output_path.length > 0) @@ -981,7 +977,8 @@ import std.path, std.regex, std.stdio; -import doc_reform.meta.rgx; +import + doc_reform.meta.rgx_files; <<template_paths_out_0>> <<template_paths_out_1>> <<template_paths_url>> @@ -1113,8 +1110,6 @@ template spineOutPathsFnPd() { #+NAME: template_paths_html_0 #+BEGIN_SRC d template spineDocRootTreeHTML() { - mixin spineRgxIn; - static auto rgx = RgxI(); auto spineDocRootTreeHTML()(string lng) { auto lng_pth = spineOutPaths!()("", lng); string base_dir = "html"; @@ -1179,8 +1174,6 @@ template spineDocRootTreeHTML() { #+NAME: template_paths_html_1 #+BEGIN_SRC d template spinePathsHTML() { - mixin spineRgxIn; - static auto rgx = RgxI(); auto spinePathsHTML()( string output_path_root, string lng, @@ -1246,8 +1239,6 @@ template spinePathsHTML() { #+BEGIN_SRC d template spineUrlsHTML() { import std.format; - mixin spineRgxIn; - static auto rgx = RgxI(); auto spineUrlsHTML()( string url_doc_root, string lng, @@ -1353,8 +1344,6 @@ template spineUrlsHTML() { #+NAME: template_paths_epub #+BEGIN_SRC d template spinePathsEPUB() { - mixin spineRgxIn; - static auto rgx = RgxI(); auto spinePathsEPUB()( string output_pth_root, string lng, @@ -1465,8 +1454,6 @@ template spinePathsEPUB() { #+BEGIN_SRC d template spinePathsODT() { import std.conv; - mixin spineRgxIn; - static auto rgx = RgxI(); auto spinePathsODT(M)( M doc_matters, ) { @@ -1535,8 +1522,6 @@ template spinePathsODT() { #+NAME: template_paths_latex #+BEGIN_SRC d template spinePathsLaTeX() { - mixin spineRgxIn; - static auto rgx = RgxI(); auto spinePathsLaTeX(M)( M doc_matters, ) { @@ -1616,8 +1601,6 @@ template spinePathsLaTeXsty() { #+NAME: template_paths_pdf #+BEGIN_SRC d template spinePathsPDF() { - mixin spineRgxIn; - static auto rgx = RgxI(); auto spinePathsPDF(M)( M doc_matters, ) { @@ -1647,8 +1630,6 @@ template spinePathsPDF() { #+NAME: template_paths_sqlite_0 #+BEGIN_SRC d template spinePathsSQLiteDiscrete() { - mixin spineRgxIn; - static auto rgx = RgxI(); auto spinePathsSQLiteDiscrete()( string output_pth_root, string lng, @@ -1679,8 +1660,6 @@ template spinePathsSQLiteDiscrete() { #+NAME: template_paths_sqlite_1 #+BEGIN_SRC d template spinePathsSQLite() { - mixin spineRgxIn; - static auto rgx = RgxI(); auto spinePathsSQLite()( string db_name, string output_pth_root, diff --git a/org/default_regex.org b/org/default_regex.org index 89d6ea3..976baa0 100644 --- a/org/default_regex.org +++ b/org/default_regex.org @@ -67,7 +67,6 @@ static template spineRgxIn() { <<meta_rgx_bibliography>> <<meta_rgx_book_index_split>> <<meta_rgx_topic_register_split>> - <<meta_rgx_language_codes>> <<prgmkup_rgx_spaces>> <<prgmkup_rgx_filename_and_path>> <<prgmkup_rgx_inline_breaks>> @@ -86,10 +85,6 @@ static template spineRgxIn() { /+ misc +/ static flag_action = ctRegex!(`^(--[a-z][a-z0-9-]+)$`); static within_quotes = ctRegex!(`"(.+?)"`, "m"); -static yaml_tag_is_str = ctRegex!(`:str$`); -static yaml_tag_is_int = ctRegex!(`:int$`); -static yaml_tag_is_map = ctRegex!(`:map$`); -static yaml_tag_is_seq = ctRegex!(`:seq$`); static make_heading_delimiter = ctRegex!(`[;][ ]*`); static arr_delimiter = ctRegex!(`[ ]*[;][ ]*`); static name_delimiter = ctRegex!(`^([^,]+)[ ]*,[ ]+(.+?)$`); @@ -476,8 +471,6 @@ static template spineRgxOut() { <<prgmkup_rgx_inline_links>> <<prgmkup_rgx_inline_font_face>> <<prgmkup_rgx_table>> - <<sp_ch_xhtml_rgx>> - <<sp_ch_latex_rgx>> <<grouped_text_rgx_paragraph_marks>> } } @@ -492,35 +485,22 @@ static make_breakpage = ctRegex!(`new=(?P<breakpage>.+ static make_breakcolumn = ctRegex!(`break=(?P<breakcolumn>.+?)(?:;|$)`,); #+END_SRC -** special characters -*** xhtml special characters +* 2. ctRegex defaults shared by meta & output (generic) -#+NAME: sp_ch_xhtml_rgx +** meta + +#+NAME: prgmkup_rgx_meta #+BEGIN_SRC d -static xhtml_ampersand = ctRegex!(`[&]`, "m"); // & -static xhtml_quotation = ctRegex!(`["]`, "m"); // " -static xhtml_less_than = ctRegex!(`[<]`, "m"); // < -static xhtml_greater_than = ctRegex!(`[>]`, "m"); // > -static xhtml_line_break = ctRegex!(` [\\]{2}`, "m"); // <br /> +static space = ctRegex!(`[ ]`, "mg"); +static spaces_keep = ctRegex!(`(?P<keep_spaces>^[ ]+|[ ]{2,})`, "mg"); // code, verse, block #+END_SRC -*** latex special characters +** spine & source_in -#+NAME: sp_ch_latex_rgx +#+NAME: prgmkup_rgx_in #+BEGIN_SRC d -static latex_special_char = ctRegex!(`([%${}_#&\\])`); -static latex_special_char_for_escape = ctRegex!(`([%${}_#\\])`); -static latex_special_char_for_escape_and_braces = ctRegex!(`([&])`); -static latex_special_char_for_escape_url = ctRegex!(`([%])`); -static latex_special_char_escaped = ctRegex!(`\\([%${}_#\\])`); -static latex_special_char_escaped_braced = ctRegex!(`[{]\\([&])[}]`); -static latex_identify_inline_link = ctRegex!(`┥.+?┝┤\S+?├`, "mg"); -static latex_identify_inline_fontface = ctRegex!(`\\([_#$]┨.+?┣)\\([_#$])`, "mg"); -static latex_clean_internal_link = ctRegex!(`^(?:#|¤\S+?#)`, "m"); -static latex_clean_bookindex_linebreak = ctRegex!(`\s*\\\\\\\\\s*`, "m"); #+END_SRC -* 2. ctRegex defaults shared by meta & output (generic) ** misc generic #+NAME: prgmkup_rgx_spaces @@ -534,24 +514,6 @@ static nbsp_chars = ctRegex!(`[░]+`, "mg"); static middle_dot = ctRegex!(`·`, "mg"); #+END_SRC -** filename (& path) (including insert file) :insert:file:path:filename: - -#+NAME: prgmkup_rgx_filename_and_path -#+BEGIN_SRC d -static src_pth_sst_or_ssm = ctRegex!(`^(?P<path>[/]?(?:[a-zA-Z0-9._-]+/)*)(?P<filename>[a-zA-Z0-9._-]+[.](?P<extension>ss[tm]))$`); -static src_pth_pod_sst_or_ssm = ctRegex!(`^(?P<podpath>[/]?(?:[a-zA-Z0-9._-]+/)*)media/text/[a-z]{2}/(?P<filename>[a-zA-Z0-9][a-zA-Z0-9._-]*?[.]ss[tm])$`); -static src_pth_contents = ctRegex!(`^(?P<path>[/]?(?:[a-zA-Z0-9._-]+/)*)(?P<filename>[a-zA-Z0-9][a-zA-Z0-9._-]*)/pod[.]manifest$`); -static src_pth_zip = ctRegex!(`^(?P<path>[/]?(?:[a-zA-Z0-9._-]+/)*)(?P<filename>[a-zA-Z0-9._-]+[.]zip)$`); -static src_pth_types = ctRegex!(`^(?P<path>[/]?[a-zA-Z0-9._-]+/)*(?P<gotfile>(?P<filename>[a-zA-Z0-9._-]+[.]ss[tm])|(?P<filelist>[a-zA-Z0-9._-]+/pod[.]manifest)|(?P<filezip>[a-zA-Z0-9._-]+[.]zip))$`); -static src_fn = - ctRegex!(`^([/]?(?:[a-zA-Z0-9._-]+/)*)(?P<fn_src>(?P<fn_base>[a-zA-Z0-9._-]+)[.](?P<fn_src_suffix>ss[tm]))$`); -static src_fn_master = ctRegex!(`^(?P<path>/?(?:[a-zA-Z0-9._-]+/)*)(?P<filename>[a-zA-Z0-9._-]+[.]ssm)$`); -static src_fn_find_inserts = ctRegex!(`^(?P<path>/?(?:[a-zA-Z0-9._-]+/)*)(?P<filename>[a-zA-Z0-9._-]+[.]ss[im])$`); -static insert_src_fn_ssi_or_sst = ctRegex!(`^<<\s*(?P<path>[a-zA-Z0-9._-]+/)*(?P<filename>[a-zA-Z0-9._-]+[.]ss[ti])$`); -static src_base_parent_dir_name = ctRegex!(`[/](?P<dir>(?:[a-zA-Z0-9._-]+))(?:/media/text/[a-z]{2})$`); // formalizes dir structure -static src_formalised_file_path_parts = ctRegex!(`(?P<pth>(?:[/a-zA-Z0-9._-]+?)(?P<dir>[a-zA-Z0-9._-]+))(?:/media/text/[a-z]{2})$`); // formalizes dir structure -#+END_SRC - ** inline markup *** inline breaks @@ -666,21 +628,21 @@ static quotation_mark_sql_insert_delimiter = ctRegex!("[']", "mg"); #+NAME: prgmkup_rgx_inline_font_face #+BEGIN_SRC d /+ inline markup font face mod +/ -static inline_emphasis = ctRegex!(`[*]┨(?P<text>.+?)┣[*]`, "mg"); -static inline_bold = ctRegex!(`[!]┨(?P<text>.+?)┣[!]`, "mg"); -static inline_underscore = ctRegex!(`[_]┨(?P<text>.+?)┣[_]`, "mg"); -static inline_italics = ctRegex!(`[/]┨(?P<text>.+?)┣[/]`, "mg"); -static inline_superscript = ctRegex!(`\^┨(?P<text>.+?)┣\^`, "mg"); -static inline_subscript = ctRegex!(`[,]┨(?P<text>.+?)┣[,]`, "mg"); -static inline_strike = ctRegex!(`[-]┨(?P<text>.+?)┣[-]`, "mg"); -static inline_insert = ctRegex!(`[+]┨(?P<text>.+?)┣[+]`, "mg"); -static inline_mono = ctRegex!(`[■]┨(?P<text>.+?)┣[■]`, "mg"); -static inline_cite = ctRegex!(`[‖]┨(?P<text>.+?)┣[‖]`, "mg"); +static inline_emphasis = ctRegex!(`⑆[*]┨(?P<text>.+?)┣[*]`, "mg"); +static inline_bold = ctRegex!(`⑆[!]┨(?P<text>.+?)┣[!]`, "mg"); +static inline_underscore = ctRegex!(`⑆[_]┨(?P<text>.+?)┣[_]`, "mg"); +static inline_italics = ctRegex!(`⑆[/]┨(?P<text>.+?)┣[/]`, "mg"); +static inline_superscript = ctRegex!(`⑆\^┨(?P<text>.+?)┣\^`, "mg"); +static inline_subscript = ctRegex!(`⑆[,]┨(?P<text>.+?)┣[,]`, "mg"); +static inline_strike = ctRegex!(`⑆[-]┨(?P<text>.+?)┣[-]`, "mg"); +static inline_insert = ctRegex!(`⑆[+]┨(?P<text>.+?)┣[+]`, "mg"); +static inline_mono = ctRegex!(`⑆[■]┨(?P<text>.+?)┣[■]`, "mg"); +static inline_cite = ctRegex!(`⑆[‖]┨(?P<text>.+?)┣[‖]`, "mg"); #+END_SRC #+BEGIN_SRC d -// static inline_superscript = ctRegex!(`[\^]┨(?P<text>.+?)┣[\^]`, "mg"); -// static inline_fontface_clean = ctRegex!(`[*!_/^,+■‖-]┨|┣[*!_/^,+■‖-]`, "mg"); +// static inline_superscript = ctRegex!(`⑆[\^]┨(?P<text>.+?)┣[\^]`, "mg"); +// static inline_fontface_clean = ctRegex!(`⑆[*!_/^,+■‖-]┨|┣[*!_/^,+■‖-]`, "mg"); #+END_SRC *** table related @@ -692,6 +654,126 @@ static table_delimiter_col = ctRegex!("[ ]*[┊][ ]*", "mg" static table_delimiter_row = ctRegex!("[ ]*\n", "mg"); #+END_SRC +** files filename (& path) (including insert file) :insert:file:path:filename: + +#+HEADER: :tangle "../src/doc_reform/meta/rgx_files.d" +#+HEADER: :noweb yes +#+BEGIN_SRC d +<<doc_header_including_copyright_and_license>> +/++ + regex: regular expressions used in sisu document parser ++/ +module doc_reform.meta.rgx_files; +static template spineRgxFiles() { + static struct RgxFiles { + <<prgmkup_rgx_filename_and_path>> + <<meta_rgx_language_codes>> + } +} +#+END_SRC + +#+NAME: prgmkup_rgx_filename_and_path +#+BEGIN_SRC d +static src_pth_sst_or_ssm = ctRegex!(`^(?P<path>[/]?(?:[a-zA-Z0-9._-]+/)*)(?P<filename>[a-zA-Z0-9._-]+[.](?P<extension>ss[tm]))$`); +static src_pth_pod_sst_or_ssm = ctRegex!(`^(?P<podpath>[/]?(?:[a-zA-Z0-9._-]+/)*)media/text/[a-z]{2}/(?P<filename>[a-zA-Z0-9][a-zA-Z0-9._-]*?[.]ss[tm])$`); +static src_pth_contents = ctRegex!(`^(?P<path>[/]?(?:[a-zA-Z0-9._-]+/)*)(?P<filename>[a-zA-Z0-9][a-zA-Z0-9._-]*)/pod[.]manifest$`); +static src_pth_zip = ctRegex!(`^(?P<path>[/]?(?:[a-zA-Z0-9._-]+/)*)(?P<filename>[a-zA-Z0-9._-]+[.]zip)$`); +static src_pth_types = ctRegex!(`^(?P<path>[/]?[a-zA-Z0-9._-]+/)*(?P<gotfile>(?P<filename>[a-zA-Z0-9._-]+[.]ss[tm])|(?P<filelist>[a-zA-Z0-9._-]+/pod[.]manifest)|(?P<filezip>[a-zA-Z0-9._-]+[.]zip))$`); +static src_fn = ctRegex!(`^([/]?(?:[a-zA-Z0-9._-]+/)*)(?P<fn_src>(?P<fn_base>[a-zA-Z0-9._-]+)[.](?P<fn_src_suffix>ss[tm]))$`); +static src_fn_master = ctRegex!(`^(?P<path>/?(?:[a-zA-Z0-9._-]+/)*)(?P<filename>[a-zA-Z0-9._-]+[.]ssm)$`); +static src_fn_find_inserts = ctRegex!(`^(?P<path>/?(?:[a-zA-Z0-9._-]+/)*)(?P<filename>[a-zA-Z0-9._-]+[.]ss[im])$`); +static insert_src_fn_ssi_or_sst = ctRegex!(`^<<\s*(?P<path>[a-zA-Z0-9._-]+/)*(?P<filename>[a-zA-Z0-9._-]+[.]ss[ti])$`); +static src_base_parent_dir_name = ctRegex!(`[/](?P<dir>(?:[a-zA-Z0-9._-]+))(?:/media/text/[a-z]{2})$`); // formalizes dir structure +static src_formalised_file_path_parts = ctRegex!(`(?P<pth>(?:[/a-zA-Z0-9._-]+?)(?P<dir>[a-zA-Z0-9._-]+))(?:/media/text/[a-z]{2})$`); // formalizes dir structure +#+END_SRC + +** _module template yaml tags + +#+HEADER: :tangle "../src/doc_reform/meta/rgx_yaml_tags.d" +#+HEADER: :noweb yes +#+BEGIN_SRC d +<<doc_header_including_copyright_and_license>> +/++ + regex: regular expressions used in sisu document parser ++/ +module doc_reform.meta.rgx_yaml; +static template spineRgxYamlTags() { + static struct RgxYaml { + <<meta_rgx_yaml>> + } +} +#+END_SRC + +#+NAME: meta_rgx_yaml +#+BEGIN_SRC d +static yaml_tag_is_str = ctRegex!(`:str$`); +static yaml_tag_is_int = ctRegex!(`:int$`); +static yaml_tag_is_map = ctRegex!(`:map$`); +static yaml_tag_is_seq = ctRegex!(`:seq$`); +#+END_SRC + +** special characters +*** xhtml special characters template + +#+HEADER: :tangle "../src/doc_reform/io_out/rgx_xhtml.d" +#+HEADER: :noweb yes +#+BEGIN_SRC d +<<doc_header_including_copyright_and_license>> +/++ + regex: regular expressions used in sisu document parser ++/ +module doc_reform.io_out.rgx_xhtml; +static template spineRgxXHTML() { + static struct RgxXHTML { + <<sp_ch_xhtml_rgx>> + } +} +#+END_SRC + +*** xhtml special characters + +#+NAME: sp_ch_xhtml_rgx +#+BEGIN_SRC d +static ampersand = ctRegex!(`[&]`, "m"); // & +static quotation = ctRegex!(`["]`, "m"); // " +static less_than = ctRegex!(`[<]`, "m"); // < +static greater_than = ctRegex!(`[>]`, "m"); // > +static line_break = ctRegex!(` [\\]{2}`, "m"); // <br /> +#+END_SRC + +*** LaTeX special characters template + +#+HEADER: :tangle "../src/doc_reform/io_out/rgx_latex.d" +#+HEADER: :noweb yes +#+BEGIN_SRC d +<<doc_header_including_copyright_and_license>> +/++ + regex: regular expressions used in sisu document parser ++/ +module doc_reform.io_out.rgx_latex; +static template spineRgxLSC() { + static struct RgxLSC { + <<sp_ch_latex_rgx>> + } +} +#+END_SRC + +*** latex special characters + +#+NAME: sp_ch_latex_rgx +#+BEGIN_SRC d +static latex_special_char = ctRegex!(`([%${}_#&\\])`); +static latex_special_char_for_escape = ctRegex!(`([%${}_#\\])`); +static latex_special_char_for_escape_and_braces = ctRegex!(`([&])`); +static latex_special_char_for_escape_url = ctRegex!(`([%])`); +static latex_special_char_escaped = ctRegex!(`\\([%${}_#\\])`); +static latex_special_char_escaped_braced = ctRegex!(`[{]\\([&])[}]`); +static latex_identify_inline_link = ctRegex!(`┥.+?┝┤\S+?├`, "mg"); +static latex_identify_inline_fontface = ctRegex!(`\\([_#$]┨.+?┣)\\([_#$])`, "mg"); +static latex_clean_internal_link = ctRegex!(`^(?:#|¤\S+?#)`, "m"); +static latex_clean_bookindex_linebreak = ctRegex!(`\s*\\\\\\\\\s*`, "m"); +#+END_SRC + * document header including copyright & license #+NAME: doc_header_including_copyright_and_license diff --git a/org/in_source_files.org b/org/in_source_files.org index ba6a578..be6b84c 100644 --- a/org/in_source_files.org +++ b/org/in_source_files.org @@ -17,23 +17,6 @@ - [[./doc-reform.org][doc-reform.org]] [[./][org/]] -* imports -** std - -#+NAME: imports_std -#+BEGIN_SRC d -std.file, -std.path -#+END_SRC - -** spine - -#+NAME: imports_spine -#+BEGIN_SRC d -doc_reform.meta, -doc_reform.io_in.paths_source -#+END_SRC - * A. get _config file_, read in (.readText) [#A] ** _module template_ :module:config_files: @@ -48,8 +31,12 @@ doc_reform.io_in.paths_source +/ module doc_reform.io_in.read_config_files; import - <<imports_std>>, - <<imports_spine>>, + std.file, + std.path; +import + doc_reform.meta, + doc_reform.io_in.paths_source, + doc_reform.meta.rgx_files, doc_reform.meta.rgx; <<meta_config_file_in>> <<meta_config_file_hub_read_site_config>> @@ -200,12 +187,18 @@ webserv: #+BEGIN_SRC d static template readConfigDoc() { import - <<imports_std>>, - <<imports_spine>>, + std.file, + std.path; + import + doc_reform.meta, + doc_reform.io_in.paths_source, + doc_reform.meta.rgx_files, doc_reform.meta.rgx; @system final auto readConfigDoc(M,E)(M _manifested, E _env) { mixin spineRgxIn; static auto rgx = RgxI(); + mixin spineRgxFiles; + static auto rgx_files = RgxFiles(); string config_file_str; string conf_filename = "NONE"; auto _conf_file_details = configFilePaths!()(_manifested, _env); @@ -257,8 +250,13 @@ static template readConfigDoc() { #+BEGIN_SRC d static template configReadSiteYAML() { import - <<imports_std>>, - <<imports_spine>>; + std.file, + std.path; + import + doc_reform.meta, + doc_reform.io_in.paths_source, + doc_reform.meta.rgx_files, + doc_reform.meta.rgx; @safe final YAMLDocument configReadSiteYAML(M,E)(M _manifested, E _env) { string _configuration = configReadInSiteYAML!()(_manifested, _env); auto _conf_file_details = configFilePaths!()(_manifested, _env); @@ -269,8 +267,11 @@ static template configReadSiteYAML() { } static template configReadDocYAML() { import - <<imports_std>>, - <<imports_spine>>; + std.file, + std.path; + import + doc_reform.meta, + doc_reform.io_in.paths_source; @safe final YAMLDocument configReadDocYAML(M,E)(M _manifested, E _env) { string _configuration = configReadInDocYAML!()(_manifested, _env); auto _conf_file_details = configFilePaths!()(_manifested, _env); @@ -296,11 +297,17 @@ static template configReadDocYAML() { module doc_reform.io_in.read_source_files; template spineRawMarkupContent() { import - <<imports_std>>, - <<imports_spine>>, + std.file, + std.path; + import + doc_reform.meta, + doc_reform.io_in.paths_source, + doc_reform.meta.rgx_files, doc_reform.meta.rgx; mixin spineRgxIn; static auto rgx = RgxI(); + mixin spineRgxFiles; + static auto rgx_files = RgxFiles(); string[] _images=[]; @safe string[] _extract_images(S)(S content_block) { string[] images_; @@ -346,7 +353,7 @@ template spineRawMarkupContent() { = raw.markupSourceHeaderContentRawLineTupleArray(source_txt_str); char[] header_raw = t.header; char[][] sourcefile_body_content = t.src_txt; - if (fn_src.match(rgx.src_fn_master)) { // filename with path needed if master file (.ssm) not otherwise + if (fn_src.match(rgx_files.src_fn_master)) { // filename with path needed if master file (.ssm) not otherwise auto ins = Inserts(); ContentsInsertsImages tu = ins.scan_master_src_for_insert_files_and_import_content(_opt_action, sourcefile_body_content, fn_src); @@ -482,9 +489,9 @@ split is on first match of level A~ (which is required) #+NAME: meta_markup_source_raw_read_in_file #+BEGIN_SRC d @safe string markupSourceReadIn(in string fn_src) { - static auto rgx = RgxI(); + static auto rgx_files = RgxFiles(); enforce( - fn_src.match(rgx.src_pth_sst_or_ssm), + fn_src.match(rgx_files.src_pth_sst_or_ssm), "not a dr markup filename: «" ~ fn_src ~ "»" ); @@ -550,7 +557,7 @@ split is on first match of level A~ (which is required) char[][] contents_insert; int code_block_status = 0; enum codeBlock { off, curly, tic, } -auto fn_pth_full = fn_src.match(rgx.src_pth_sst_or_ssm); +auto fn_pth_full = fn_src.match(rgx_files.src_pth_sst_or_ssm); auto markup_src_file_path = fn_pth_full.captures[1]; #+END_SRC @@ -574,14 +581,14 @@ if (code_block_status == codeBlock.curly) { } else if (line.matchFirst(rgx.block_tic_code_open)) { code_block_status = codeBlock.tic; contents_insert ~= line; -} else if (auto m = line.match(rgx.insert_src_fn_ssi_or_sst)) { +} else if (auto m = line.match(rgx_files.insert_src_fn_ssi_or_sst)) { auto insert_fn = m.captures[2]; auto insert_sub_pth = m.captures[1]; auto fn_src_insert = chainPath(markup_src_file_path, insert_sub_pth ~ insert_fn).array; auto raw = MarkupRawUnit(); auto markup_sourcesubfile_insert_content - = raw.getInsertMarkupSourceContentRawLineArray(fn_src_insert, rgx.src_fn_find_inserts); + = raw.getInsertMarkupSourceContentRawLineArray(fn_src_insert, rgx_files.src_fn_find_inserts); debug(insert_file) { writeln(line); writeln(fn_src_insert); @@ -634,7 +641,7 @@ return t; char[][] contents; int code_block_status = 0; enum codeBlock { off, curly, tic, } -auto fn_pth_full = fn_src.match(rgx.src_pth_sst_or_ssm); +auto fn_pth_full = fn_src.match(rgx_files.src_pth_sst_or_ssm); auto markup_src_file_path = fn_pth_full.captures[1]; char[][] contents_insert; string[] _images =[]; @@ -661,7 +668,7 @@ if (code_block_status == codeBlock.curly) { } else if (line.matchFirst(rgx.block_tic_code_open)) { code_block_status = codeBlock.tic; contents ~= line; -} else if (auto m = line.match(rgx.insert_src_fn_ssi_or_sst)) { +} else if (auto m = line.match(rgx_files.insert_src_fn_ssi_or_sst)) { auto insert_fn = m.captures[2]; auto insert_sub_pth = m.captures[1]; auto fn_src_insert @@ -670,7 +677,7 @@ if (code_block_status == codeBlock.curly) { auto raw = MarkupRawUnit(); /+ TODO +/ auto markup_sourcefile_insert_content - = raw.getInsertMarkupSourceContentRawLineArray(fn_src_insert, rgx.src_fn_find_inserts); + = raw.getInsertMarkupSourceContentRawLineArray(fn_src_insert, rgx_files.src_fn_find_inserts); debug(insert_file) { writeln(line); writeln(fn_src_insert); diff --git a/org/meta_conf_make_meta.org b/org/meta_conf_make_meta.org index af86ba8..f45d3c4 100644 --- a/org/meta_conf_make_meta.org +++ b/org/meta_conf_make_meta.org @@ -7,8 +7,8 @@ #+COPYRIGHT: Copyright (C) 2015 - 2022 Ralph Amissah #+LANGUAGE: en #+STARTUP: content hideblocks hidestars noindent entitiespretty -#+PROPERTY: header-args :exports code -#+PROPERTY: header-args+ :noweb yes +#+PROPERTY: header-args :noweb yes +#+PROPERTY: header-args+ :exports code #+PROPERTY: header-args+ :results no #+PROPERTY: header-args+ :cache no #+PROPERTY: header-args+ :padline no @@ -262,9 +262,12 @@ import std.conv : to; import doc_reform.meta.defaults, + doc_reform.meta.rgx_yaml, doc_reform.meta.rgx; mixin spineRgxIn; static auto rgx = RgxI(); +mixin spineRgxYamlTags; +static auto rgx_y = RgxYaml(); mixin InternalMarkup; static auto mkup = InlineMarkup(); #+END_SRC @@ -580,6 +583,7 @@ template contentYAMLtoSpineStruct() { import doc_reform.meta.conf_make_meta_structs, doc_reform.meta.defaults, + doc_reform.meta.rgx_yaml, doc_reform.meta.rgx; ConfComposite _struct_composite; @system auto contentYAMLtoSpineStruct(C,Y,M,O,Cfg)( @@ -592,6 +596,8 @@ template contentYAMLtoSpineStruct() { ) { mixin spineRgxIn; static auto rgx = RgxI(); + mixin spineRgxYamlTags; + static auto rgx_y = RgxYaml(); <<meta_check_input_markup>> confCompositeMakeBuild _mk; if (_identifier != "header") { // called only once per run anyway @@ -628,11 +634,11 @@ template contentYAMLtoSpineStruct() { : _cfg.http_request_type; if (("webserv" in _yaml && _yaml["webserv"].type.sequence) && (_yaml["webserv"].type.mapping - && _yaml["webserv"].tag.match(rgx.yaml_tag_is_map)) + && _yaml["webserv"].tag.match(rgx_y.yaml_tag_is_map)) ) { if ("http" in _yaml["webserv"] && _yaml["webserv"]["http"].type.string - && _yaml["webserv"]["http"].tag.match(rgx.yaml_tag_is_str) + && _yaml["webserv"]["http"].tag.match(rgx_y.yaml_tag_is_str) ) { _struct_composite.conf.w_srv_http = _yaml["webserv"]["http"].get!string; @@ -649,11 +655,11 @@ template contentYAMLtoSpineStruct() { : _cfg.cgi_search_form_title; if (("webserv" in _yaml && _yaml["webserv"].type.sequence) && (_yaml["webserv"].type.mapping - && _yaml["webserv"].tag.match(rgx.yaml_tag_is_map)) + && _yaml["webserv"].tag.match(rgx_y.yaml_tag_is_map)) ) { if ("cgi_search_form_title" in _yaml["webserv"] && _yaml["webserv"]["cgi_search_form_title"].type.string - && _yaml["webserv"]["cgi_search_form_title"].tag.match(rgx.yaml_tag_is_str) + && _yaml["webserv"]["cgi_search_form_title"].tag.match(rgx_y.yaml_tag_is_str) ) { _struct_composite.conf.w_srv_cgi_search_form_title = _yaml["webserv"]["cgi_search_form_title"].get!string; @@ -670,11 +676,11 @@ template contentYAMLtoSpineStruct() { : _cfg.cgi_filename; if (("webserv" in _yaml && _yaml["webserv"].type.sequence) && (_yaml["webserv"].type.mapping - && _yaml["webserv"].tag.match(rgx.yaml_tag_is_map)) + && _yaml["webserv"].tag.match(rgx_y.yaml_tag_is_map)) ) { if ("cgi_search_script" in _yaml["webserv"] && _yaml["webserv"]["cgi_search_script"].type.string - && _yaml["webserv"]["cgi_search_script"].tag.match(rgx.yaml_tag_is_str) + && _yaml["webserv"]["cgi_search_script"].tag.match(rgx_y.yaml_tag_is_str) ) { _struct_composite.conf.w_srv_cgi_search_script = _yaml["webserv"]["cgi_search_script"].get!string; @@ -691,11 +697,11 @@ template contentYAMLtoSpineStruct() { : _cfg.db_sqlite_filename; if (("webserv" in _yaml && _yaml["webserv"].type.sequence) && (_yaml["webserv"].type.mapping - && _yaml["webserv"].tag.match(rgx.yaml_tag_is_map)) + && _yaml["webserv"].tag.match(rgx_y.yaml_tag_is_map)) ) { if ("db_sqlite_filename" in _yaml["webserv"] && _yaml["webserv"]["db_sqlite_filename"].type.string - && _yaml["webserv"]["db_sqlite_filename"].tag.match(rgx.yaml_tag_is_str) + && _yaml["webserv"]["db_sqlite_filename"].tag.match(rgx_y.yaml_tag_is_str) ) { _struct_composite.conf.w_srv_db_sqlite_filename = _yaml["webserv"]["db_sqlite_filename"].get!string; @@ -712,11 +718,11 @@ template contentYAMLtoSpineStruct() { : _cfg.db_sqlite_path; if (("webserv" in _yaml && _yaml["webserv"].type.sequence) && (_yaml["webserv"].type.mapping - && _yaml["webserv"].tag.match(rgx.yaml_tag_is_map)) + && _yaml["webserv"].tag.match(rgx_y.yaml_tag_is_map)) ) { if ("db_sqlite_path" in _yaml["webserv"] && _yaml["webserv"]["db_sqlite_path"].type.string - && _yaml["webserv"]["db_sqlite_path"].tag.match(rgx.yaml_tag_is_str) + && _yaml["webserv"]["db_sqlite_path"].tag.match(rgx_y.yaml_tag_is_str) ) { _struct_composite.conf.w_srv_db_sqlite_path = _yaml["webserv"]["db_sqlite_path"].get!string; @@ -733,11 +739,11 @@ template contentYAMLtoSpineStruct() { : _cfg.www_url_doc_root; if (("webserv" in _yaml && _yaml["webserv"].type.sequence) && (_yaml["webserv"].type.mapping - && _yaml["webserv"].tag.match(rgx.yaml_tag_is_map)) + && _yaml["webserv"].tag.match(rgx_y.yaml_tag_is_map)) ) { if ("cgi_action" in _yaml["webserv"] && _yaml["webserv"]["cgi_action"].type.string - && _yaml["webserv"]["cgi_action"].tag.match(rgx.yaml_tag_is_str) + && _yaml["webserv"]["cgi_action"].tag.match(rgx_y.yaml_tag_is_str) ) { _struct_composite.conf.w_srv_cgi_action = _yaml["webserv"]["cgi_action"].get!string; @@ -760,14 +766,14 @@ template contentYAMLtoSpineStruct() { : _cfg.processing_path_doc_root; if (("webserv" in _yaml && _yaml["webserv"].type.sequence) && (_yaml["webserv"].type.mapping - && _yaml["webserv"].tag.match(rgx.yaml_tag_is_map)) + && _yaml["webserv"].tag.match(rgx_y.yaml_tag_is_map)) ) { if (_yaml["output"].type.mapping - && _yaml["output"].tag.match(rgx.yaml_tag_is_map) + && _yaml["output"].tag.match(rgx_y.yaml_tag_is_map) ) { if ("path" in _yaml["output"] && _yaml["output"]["path"].type.string - && _yaml["output"]["path"].tag.match(rgx.yaml_tag_is_str) + && _yaml["output"]["path"].tag.match(rgx_y.yaml_tag_is_str) ) { if (_manifested.output.path == _manifested.env.pwd && _yaml["output"]["path"].get!string.length > 0 @@ -788,11 +794,11 @@ template contentYAMLtoSpineStruct() { : _cfg.processing_path_doc_root; if (("webserv" in _yaml && _yaml["webserv"].type.sequence) && (_yaml["webserv"].type.mapping - && _yaml["webserv"].tag.match(rgx.yaml_tag_is_map)) + && _yaml["webserv"].tag.match(rgx_y.yaml_tag_is_map)) ) { if ("data_root_path" in _yaml["webserv"] && _yaml["webserv"]["data_root_path"].type.string - && _yaml["webserv"]["data_root_path"].tag.match(rgx.yaml_tag_is_str) + && _yaml["webserv"]["data_root_path"].tag.match(rgx_y.yaml_tag_is_str) ) { _struct_composite.conf.w_srv_data_root_path = _yaml["webserv"]["data_root_path"].get!string; @@ -810,11 +816,11 @@ template contentYAMLtoSpineStruct() { : _cfg.cgi_bin_root; if (("webserv" in _yaml && _yaml["webserv"].type.sequence) && (_yaml["webserv"].type.mapping - && _yaml["webserv"].tag.match(rgx.yaml_tag_is_map)) + && _yaml["webserv"].tag.match(rgx_y.yaml_tag_is_map)) ) { if ("cgi_bin_path" in _yaml["webserv"] && _yaml["webserv"]["cgi_bin_path"].type.string - && _yaml["webserv"]["cgi_bin_path"].tag.match(rgx.yaml_tag_is_str) + && _yaml["webserv"]["cgi_bin_path"].tag.match(rgx_y.yaml_tag_is_str) ) { _struct_composite.conf.w_srv_cgi_bin_path = _yaml["webserv"]["cgi_bin_path"].get!string; @@ -825,11 +831,11 @@ template contentYAMLtoSpineStruct() { = ""; if (("webserv" in _yaml && _yaml["webserv"].type.sequence) && (_yaml["webserv"].type.mapping - && _yaml["webserv"].tag.match(rgx.yaml_tag_is_map)) + && _yaml["webserv"].tag.match(rgx_y.yaml_tag_is_map)) ) { if ("data_root_part" in _yaml["webserv"] && _yaml["webserv"]["data_root_part"].type.string - && _yaml["webserv"]["data_root_part"].tag.match(rgx.yaml_tag_is_str) + && _yaml["webserv"]["data_root_part"].tag.match(rgx_y.yaml_tag_is_str) ) { _struct_composite.conf.w_srv_data_root_part = _yaml["webserv"]["data_root_part"].get!string; } @@ -839,11 +845,11 @@ template contentYAMLtoSpineStruct() { = "image"; if (("webserv" in _yaml && _yaml["webserv"].type.sequence) && (_yaml["webserv"].type.mapping - && _yaml["webserv"].tag.match(rgx.yaml_tag_is_map)) + && _yaml["webserv"].tag.match(rgx_y.yaml_tag_is_map)) ) { if ("images_root_part" in _yaml["webserv"] && _yaml["webserv"]["images_root_part"].type.string - && _yaml["webserv"]["images_root_part"].tag.match(rgx.yaml_tag_is_str) + && _yaml["webserv"]["images_root_part"].tag.match(rgx_y.yaml_tag_is_str) ) { _struct_composite.conf.w_srv_images_root_part = _yaml["webserv"]["images_root_part"].get!string; } @@ -853,31 +859,31 @@ template contentYAMLtoSpineStruct() { if (("webserv" in _yaml && _yaml["webserv"].type.sequence) && (_yaml["webserv"].type.mapping - && _yaml["webserv"].tag.match(rgx.yaml_tag_is_map)) + && _yaml["webserv"].tag.match(rgx_y.yaml_tag_is_map)) ) { // cannot be used as is with opt_action FIX look at remaining, decide what to do later if ("data_http" in _yaml["webserv"] && _yaml["webserv"]["data_http"].type.string - && _yaml["webserv"]["data_http"].tag.match(rgx.yaml_tag_is_str) + && _yaml["webserv"]["data_http"].tag.match(rgx_y.yaml_tag_is_str) ) { _struct_composite.conf.w_srv_data_http = _yaml["webserv"]["data_http"].get!string; } // if (_opt_action.*.length > 0) { if ("cgi_http" in _yaml["webserv"] && _yaml["webserv"]["cgi_http"].type.string - && _yaml["webserv"]["cgi_http"].tag.match(rgx.yaml_tag_is_str) + && _yaml["webserv"]["cgi_http"].tag.match(rgx_y.yaml_tag_is_str) ) { _struct_composite.conf.w_srv_cgi_http = _yaml["webserv"]["cgi_http"].get!string; } // if (_opt_action.*.length > 0) { if ("host" in _yaml["webserv"] && _yaml["webserv"]["host"].type.string - && _yaml["webserv"]["host"].tag.match(rgx.yaml_tag_is_str) + && _yaml["webserv"]["host"].tag.match(rgx_y.yaml_tag_is_str) ) { _struct_composite.conf.w_srv_host = _yaml["webserv"]["host"].get!string; } if ("data_root_url" in _yaml["webserv"] && _yaml["webserv"]["data_root_url"].type.string - && _yaml["webserv"]["data_root_url"].tag.match(rgx.yaml_tag_is_str) + && _yaml["webserv"]["data_root_url"].tag.match(rgx_y.yaml_tag_is_str) ) { _struct_composite.conf.w_srv_data_root_url = _yaml["webserv"]["data_root_url"].get!string; _struct_composite.conf.w_srv_data_root_url_html = @@ -894,7 +900,7 @@ if (("webserv" in _yaml } if ("cgi_host" in _yaml["webserv"] && _yaml["webserv"]["cgi_host"].type.string - && _yaml["webserv"]["cgi_host"].tag.match(rgx.yaml_tag_is_str) + && _yaml["webserv"]["cgi_host"].tag.match(rgx_y.yaml_tag_is_str) ) { _struct_composite.conf.w_srv_cgi_host = _yaml["webserv"]["cgi_host"].get!string; } else { // composite construct @@ -902,25 +908,25 @@ if (("webserv" in _yaml } if ("cgi_bin_subpath" in _yaml["webserv"] && _yaml["webserv"]["cgi_bin_subpath"].type.string - && _yaml["webserv"]["cgi_bin_subpath"].tag.match(rgx.yaml_tag_is_str) + && _yaml["webserv"]["cgi_bin_subpath"].tag.match(rgx_y.yaml_tag_is_str) ) { _struct_composite.conf.w_srv_cgi_bin_subpath = _yaml["webserv"]["cgi_bin_subpath"].get!string; } if ("cgi_port" in _yaml["webserv"] && _yaml["webserv"]["cgi_port"].type.string - && _yaml["webserv"]["cgi_port"].tag.match(rgx.yaml_tag_is_str) + && _yaml["webserv"]["cgi_port"].tag.match(rgx_y.yaml_tag_is_str) ) { _struct_composite.conf.w_srv_cgi_port = _yaml["webserv"]["cgi_port"].get!string; } if ("cgi_user" in _yaml["webserv"] && _yaml["webserv"]["cgi_user"].type.string - && _yaml["webserv"]["cgi_user"].tag.match(rgx.yaml_tag_is_str) + && _yaml["webserv"]["cgi_user"].tag.match(rgx_y.yaml_tag_is_str) ) { _struct_composite.conf.w_srv_cgi_user = _yaml["webserv"]["cgi_user"].get!string; } if ("cgi_bin_url" in _yaml["webserv"] && _yaml["webserv"]["cgi_bin_url"].type.string - && _yaml["webserv"]["cgi_bin_url"].tag.match(rgx.yaml_tag_is_str) + && _yaml["webserv"]["cgi_bin_url"].tag.match(rgx_y.yaml_tag_is_str) ) { _struct_composite.conf.w_srv_cgi_bin_url = _yaml["webserv"]["cgi_bin_url"].get!string; } else { @@ -936,7 +942,7 @@ if (("webserv" in _yaml } // if ("cgi_file_links" in _yaml["webserv"] // && _yaml["webserv"]["cgi_file_links"].type.string - // && _yaml["webserv"]["cgi_file_links"].tag.match(rgx.yaml_tag_is_str) + // && _yaml["webserv"]["cgi_file_links"].tag.match(rgx_y.yaml_tag_is_str) // ) { // _struct_composite.conf.w_srv_cgi_file_links = _yaml["webserv"]["cgi_file_links"].get!string; // } @@ -946,11 +952,11 @@ if ("processing" in _yaml && _yaml["processing"].type.sequence ) { if (_yaml["processing"].type.mapping - && _yaml["processing"].tag.match(rgx.yaml_tag_is_map) + && _yaml["processing"].tag.match(rgx_y.yaml_tag_is_map) ) { if ("concord_max" in _yaml["processing"] && _yaml["processing"]["concord_max"].type.string - && _yaml["processing"]["concord_max"].tag.match(rgx.yaml_tag_is_str) + && _yaml["processing"]["concord_max"].tag.match(rgx_y.yaml_tag_is_str) ) { _struct_composite.conf.processing_concord_max = _yaml["processing"]["concord_max"].get!string; } @@ -960,65 +966,65 @@ if ("flag" in _yaml && _yaml["flag"].type.sequence ) { if (_yaml["flag"].type.mapping - && _yaml["flag"].tag.match(rgx.yaml_tag_is_map) + && _yaml["flag"].tag.match(rgx_y.yaml_tag_is_map) ) { if ("act0" in _yaml["flag"] && _yaml["flag"]["act0"].type.string - && _yaml["flag"]["act0"].tag.match(rgx.yaml_tag_is_str) + && _yaml["flag"]["act0"].tag.match(rgx_y.yaml_tag_is_str) ) { _struct_composite.conf.flag_act0 = _yaml["flag"]["act0"].get!string; } if ("act1" in _yaml["flag"] && _yaml["flag"]["act1"].type.string - && _yaml["flag"]["act1"].tag.match(rgx.yaml_tag_is_str) + && _yaml["flag"]["act1"].tag.match(rgx_y.yaml_tag_is_str) ) { _struct_composite.conf.flag_act1 = _yaml["flag"]["act1"].get!string; } if ("act2" in _yaml["flag"] && _yaml["flag"]["act2"].type.string - && _yaml["flag"]["act2"].tag.match(rgx.yaml_tag_is_str) + && _yaml["flag"]["act2"].tag.match(rgx_y.yaml_tag_is_str) ) { _struct_composite.conf.flag_act2 = _yaml["flag"]["act2"].get!string; } if ("act3" in _yaml["flag"] && _yaml["flag"]["act3"].type.string - && _yaml["flag"]["act3"].tag.match(rgx.yaml_tag_is_str) + && _yaml["flag"]["act3"].tag.match(rgx_y.yaml_tag_is_str) ) { _struct_composite.conf.flag_act3 = _yaml["flag"]["act3"].get!string; } if ("act4" in _yaml["flag"] && _yaml["flag"]["act4"].type.string - && _yaml["flag"]["act4"].tag.match(rgx.yaml_tag_is_str) + && _yaml["flag"]["act4"].tag.match(rgx_y.yaml_tag_is_str) ) { _struct_composite.conf.flag_act4 = _yaml["flag"]["act4"].get!string; } if ("act5" in _yaml["flag"] && _yaml["flag"]["act5"].type.string - && _yaml["flag"]["act5"].tag.match(rgx.yaml_tag_is_str) + && _yaml["flag"]["act5"].tag.match(rgx_y.yaml_tag_is_str) ) { _struct_composite.conf.flag_act5 = _yaml["flag"]["act5"].get!string; } if ("act6" in _yaml["flag"] && _yaml["flag"]["act6"].type.string - && _yaml["flag"]["act6"].tag.match(rgx.yaml_tag_is_str) + && _yaml["flag"]["act6"].tag.match(rgx_y.yaml_tag_is_str) ) { _struct_composite.conf.flag_act6 = _yaml["flag"]["act6"].get!string; } if ("act7" in _yaml["flag"] && _yaml["flag"]["act7"].type.string - && _yaml["flag"]["act7"].tag.match(rgx.yaml_tag_is_str) + && _yaml["flag"]["act7"].tag.match(rgx_y.yaml_tag_is_str) ) { _struct_composite.conf.flag_act7 = _yaml["flag"]["act7"].get!string; } if ("act8" in _yaml["flag"] && _yaml["flag"]["act8"].type.string - && _yaml["flag"]["act8"].tag.match(rgx.yaml_tag_is_str) + && _yaml["flag"]["act8"].tag.match(rgx_y.yaml_tag_is_str) ) { _struct_composite.conf.flag_act8 = _yaml["flag"]["act8"].get!string; } if ("act9" in _yaml["flag"] && _yaml["flag"]["act9"].type.string - && _yaml["flag"]["act9"].tag.match(rgx.yaml_tag_is_str) + && _yaml["flag"]["act9"].tag.match(rgx_y.yaml_tag_is_str) ) { _struct_composite.conf.flag_act9 = _yaml["flag"]["act9"].get!string; } @@ -1095,7 +1101,7 @@ if (_opt_action.latex_papersize.length > 0) { : _cfg.default_papersize; if ("papersize" in _yaml["default"] && _yaml["default"]["papersize"].type.string - && _yaml["default"]["papersize"].tag.match(rgx.yaml_tag_is_str) + && _yaml["default"]["papersize"].tag.match(rgx_y.yaml_tag_is_str) ) { _set_papersize = _yaml["default"]["papersize"].get!string; @@ -1106,29 +1112,29 @@ if ( "default" in _yaml && _yaml["default"].type.sequence && _yaml["default"].type.mapping - && _yaml["default"].tag.match(rgx.yaml_tag_is_map) + && _yaml["default"].tag.match(rgx_y.yaml_tag_is_map) ) { if ("text_wrap" in _yaml["default"] && _yaml["default"]["text_wrap"].type.string - && _yaml["default"]["text_wrap"].tag.match(rgx.yaml_tag_is_str) + && _yaml["default"]["text_wrap"].tag.match(rgx_y.yaml_tag_is_str) ) { _struct_composite.conf.set_text_wrap = _yaml["default"]["text_wrap"].get!string; } if ("emphasis" in _yaml["default"] && _yaml["default"]["emphasis"].type.string - && _yaml["default"]["emphasis"].tag.match(rgx.yaml_tag_is_str) + && _yaml["default"]["emphasis"].tag.match(rgx_y.yaml_tag_is_str) ) { _struct_composite.conf.set_emphasis = _yaml["default"]["emphasis"].get!string; } if ("language" in _yaml["default"] && _yaml["default"]["language"].type.string - && _yaml["default"]["language"].tag.match(rgx.yaml_tag_is_str) + && _yaml["default"]["language"].tag.match(rgx_y.yaml_tag_is_str) ) { _struct_composite.conf.set_language = _yaml["default"]["language"].get!string; } if ("digest" in _yaml["default"] && _yaml["default"]["digest"].type.string - && _yaml["default"]["digest"].tag.match(rgx.yaml_tag_is_str) + && _yaml["default"]["digest"].tag.match(rgx_y.yaml_tag_is_str) ) { _struct_composite.conf.set_digest = _yaml["default"]["digest"].get!string; } @@ -1137,29 +1143,29 @@ if ("search" in _yaml && _yaml["search"].type.sequence ) { if (_yaml["search"].type.mapping - && _yaml["search"].tag.match(rgx.yaml_tag_is_map) + && _yaml["search"].tag.match(rgx_y.yaml_tag_is_map) ) { if ("flag" in _yaml["search"] && _yaml["search"]["flag"].type.string - && _yaml["search"]["flag"].tag.match(rgx.yaml_tag_is_str) + && _yaml["search"]["flag"].tag.match(rgx_y.yaml_tag_is_str) ) { _struct_composite.conf.search_flag = _yaml["search"]["flag"].get!string; } if ("action" in _yaml["search"] && _yaml["search"]["action"].type.string - && _yaml["search"]["action"].tag.match(rgx.yaml_tag_is_str) + && _yaml["search"]["action"].tag.match(rgx_y.yaml_tag_is_str) ) { _struct_composite.conf.search_action = _yaml["search"]["action"].get!string; } if ("db" in _yaml["search"] && _yaml["search"]["db"].type.string - && _yaml["search"]["db"].tag.match(rgx.yaml_tag_is_str) + && _yaml["search"]["db"].tag.match(rgx_y.yaml_tag_is_str) ) { _struct_composite.conf.search_db = _yaml["search"]["db"].get!string; } if ("title" in _yaml["search"] && _yaml["search"]["title"].type.string - && _yaml["search"]["title"].tag.match(rgx.yaml_tag_is_str) + && _yaml["search"]["title"].tag.match(rgx_y.yaml_tag_is_str) ) { _struct_composite.conf.search_title = _yaml["search"]["title"].get!string; } @@ -1176,47 +1182,47 @@ if ("make" in _yaml && _yaml["make"].type.sequence ) { if (_yaml["make"].type.mapping - && _yaml["make"].tag.match(rgx.yaml_tag_is_map) + && _yaml["make"].tag.match(rgx_y.yaml_tag_is_map) ) { if ("doc_type" in _yaml["make"] && _yaml["make"]["doc_type"].type.string - && _yaml["make"]["doc_type"].tag.match(rgx.yaml_tag_is_str) + && _yaml["make"]["doc_type"].tag.match(rgx_y.yaml_tag_is_str) ) { _struct_composite.make_str.doc_type = _yaml["make"]["doc_type"].get!string; } if ("breaks" in _yaml["make"] && _yaml["make"]["breaks"].type.string - && _yaml["make"]["breaks"].tag.match(rgx.yaml_tag_is_str) + && _yaml["make"]["breaks"].tag.match(rgx_y.yaml_tag_is_str) ) { _struct_composite.make_str.breaks = _yaml["make"]["breaks"].get!string; } if ("bold" in _yaml["make"] && _yaml["make"]["bold"].type.string - && _yaml["make"]["bold"].tag.match(rgx.yaml_tag_is_str) + && _yaml["make"]["bold"].tag.match(rgx_y.yaml_tag_is_str) ) { _struct_composite.make_str.bold = _yaml["make"]["bold"].get!string; } if ("cover_image" in _yaml["make"] && _yaml["make"]["cover_image"].type.string - && _yaml["make"]["cover_image"].tag.match(rgx.yaml_tag_is_str) + && _yaml["make"]["cover_image"].tag.match(rgx_y.yaml_tag_is_str) ) { _struct_composite.make_str.cover_image = _yaml["make"]["cover_image"].get!string; } if ("css" in _yaml["make"] && _yaml["make"]["css"].type.string - && _yaml["make"]["css"].tag.match(rgx.yaml_tag_is_str) + && _yaml["make"]["css"].tag.match(rgx_y.yaml_tag_is_str) ) { _struct_composite.make_str.css = _yaml["make"]["css"].get!string; } if ("emphasis" in _yaml["make"] && _yaml["make"]["emphasis"].type.string - && _yaml["make"]["emphasis"].tag.match(rgx.yaml_tag_is_str) + && _yaml["make"]["emphasis"].tag.match(rgx_y.yaml_tag_is_str) ) { _struct_composite.make_str.emphasis = _yaml["make"]["emphasis"].get!string; } if ("footer" in _yaml["make"] && _yaml["make"]["footer"].type.string - && _yaml["make"]["footer"].tag.match(rgx.yaml_tag_is_str) + && _yaml["make"]["footer"].tag.match(rgx_y.yaml_tag_is_str) ) { char[][] __match_footer_array = (cast(char[]) _yaml["make"]["footer"].get!string) @@ -1225,7 +1231,7 @@ if ("make" in _yaml } if ("headings" in _yaml["make"] && _yaml["make"]["headings"].type.string - && _yaml["make"]["headings"].tag.match(rgx.yaml_tag_is_str) + && _yaml["make"]["headings"].tag.match(rgx_y.yaml_tag_is_str) ) { char[][] __match_headings_array = (cast(char[]) _yaml["make"]["headings"].get!string) @@ -1233,7 +1239,7 @@ if ("make" in _yaml _struct_composite.make_str.headings = __match_headings_array.to!(string[]); } else if ("headings" in _yaml["make"] && _yaml["make"]["headings"].type.string - && _yaml["make"]["headings"].tag.match(rgx.yaml_tag_is_seq) + && _yaml["make"]["headings"].tag.match(rgx_y.yaml_tag_is_seq) ) { foreach(string identify_heading_level; _yaml["make"]["headings"]) { _struct_composite.make_str.headings ~= identify_heading_level; @@ -1241,7 +1247,7 @@ if ("make" in _yaml } if ("home_button_image" in _yaml["make"] && _yaml["make"]["home_button_image"].type.string - && _yaml["make"]["home_button_image"].tag.match(rgx.yaml_tag_is_str) + && _yaml["make"]["home_button_image"].tag.match(rgx_y.yaml_tag_is_str) ) { char[][] __match_home_button_image_array = (cast(char[]) _yaml["make"]["home_button_image"].get!string) @@ -1250,12 +1256,12 @@ if ("make" in _yaml } if ("home_button_text" in _yaml["make"] && _yaml["make"]["home_button_text"].type.string - && _yaml["make"]["home_button_text"].tag.match(rgx.yaml_tag_is_str) + && _yaml["make"]["home_button_text"].tag.match(rgx_y.yaml_tag_is_str) ) { _struct_composite.make_str.home_button_text = _yaml["make"]["home_button_text"].get!string; } else if ("home_button_text" in _yaml["make"] && _yaml["make"]["home_button_text"].type.string - && _yaml["make"]["home_button_text"].tag.match(rgx.yaml_tag_is_seq) + && _yaml["make"]["home_button_text"].tag.match(rgx_y.yaml_tag_is_seq) ) { _struct_composite.make_str.home_button_text = ""; foreach(string hbt; _yaml["make"]["home_button_text"]) { @@ -1264,13 +1270,13 @@ if ("make" in _yaml } if ("italics" in _yaml["make"] && _yaml["make"]["italics"].type.string - && _yaml["make"]["italics"].tag.match(rgx.yaml_tag_is_str) + && _yaml["make"]["italics"].tag.match(rgx_y.yaml_tag_is_str) ) { _struct_composite.make_str.italics = _yaml["make"]["italics"].get!string; } if ("auto_num_top_at_level" in _yaml["make"] && _yaml["make"]["auto_num_top_at_level"].type.string - && _yaml["make"]["auto_num_top_at_level"].tag.match(rgx.yaml_tag_is_str) + && _yaml["make"]["auto_num_top_at_level"].tag.match(rgx_y.yaml_tag_is_str) ) { _struct_composite.make_str.auto_num_top_at_level = _yaml["make"]["auto_num_top_at_level"].get!string; switch (_yaml["make"]["auto_num_top_at_level"].get!string) { @@ -1296,12 +1302,12 @@ if ("make" in _yaml } if ("auto_num_depth" in _yaml["make"] && _yaml["make"]["auto_num_depth"].type.string - && _yaml["make"]["auto_num_depth"].tag.match(rgx.yaml_tag_is_int) + && _yaml["make"]["auto_num_depth"].tag.match(rgx_y.yaml_tag_is_int) ) { // not sure implemented for documents _struct_composite.make_str.auto_num_depth = _yaml["make"]["auto_num_depth"].get!int; } else if ("auto_num_depth" in _yaml["make"] && _yaml["make"]["auto_num_depth"].type.string - && _yaml["make"]["auto_num_depth"].tag.match(rgx.yaml_tag_is_str) + && _yaml["make"]["auto_num_depth"].tag.match(rgx_y.yaml_tag_is_str) ) { // not sure implemented for documents _struct_composite.make_str.auto_num_depth = _yaml["make"]["auto_num_depth"].get!int; } @@ -1340,34 +1346,34 @@ if (_struct_composite.meta.creator_author.empty) { && _yaml["creator"].type.sequence ) { if (_yaml["creator"].type.mapping - && _yaml["creator"].tag.match(rgx.yaml_tag_is_map) + && _yaml["creator"].tag.match(rgx_y.yaml_tag_is_map) ) { if ("author" in _yaml["creator"] && _yaml["creator"]["author"].type.string - && _yaml["creator"]["author"].tag.match(rgx.yaml_tag_is_str) + && _yaml["creator"]["author"].tag.match(rgx_y.yaml_tag_is_str) ) { _struct_composite.meta.creator_author = _yaml["creator"]["author"].get!string; } if ("email" in _yaml["creator"] && _yaml["creator"]["email"].type.string - && _yaml["creator"]["email"].tag.match(rgx.yaml_tag_is_str) + && _yaml["creator"]["email"].tag.match(rgx_y.yaml_tag_is_str) ) { _struct_composite.meta.creator_author_email = _yaml["creator"]["email"].get!string; } if ("illustrator" in _yaml["creator"] && _yaml["creator"]["illustrator"].type.string - && _yaml["creator"]["illustrator"].tag.match(rgx.yaml_tag_is_str) + && _yaml["creator"]["illustrator"].tag.match(rgx_y.yaml_tag_is_str) ) { _struct_composite.meta.creator_illustrator = _yaml["creator"]["illustrator"].get!string; } if ("translator" in _yaml["creator"] && _yaml["creator"]["translator"].type.string - && _yaml["creator"]["translator"].tag.match(rgx.yaml_tag_is_str) + && _yaml["creator"]["translator"].tag.match(rgx_y.yaml_tag_is_str) ) { _struct_composite.meta.creator_translator = _yaml["creator"]["translator"].get!string; } } else if (_yaml["creator"].type.string - && _yaml["creator"].tag.match(rgx.yaml_tag_is_str) + && _yaml["creator"].tag.match(rgx_y.yaml_tag_is_str) ) { _struct_composite.meta.creator_author = _yaml["creator"].get!string; } @@ -1407,57 +1413,57 @@ if (_struct_composite.meta.title_main.empty) { && _yaml["title"].type.sequence ) { if (_yaml["title"].type.mapping - && _yaml["title"].tag.match(rgx.yaml_tag_is_map) + && _yaml["title"].tag.match(rgx_y.yaml_tag_is_map) ) { if ("main" in _yaml["title"] && _yaml["title"]["main"].type.string - && _yaml["title"]["main"].tag.match(rgx.yaml_tag_is_str) + && _yaml["title"]["main"].tag.match(rgx_y.yaml_tag_is_str) ) { _struct_composite.meta.title_main = _yaml["title"]["main"].get!string; } else if ("title" in _yaml["title"] && _yaml["title"]["title"].type.string - && _yaml["title"]["title"].tag.match(rgx.yaml_tag_is_str) + && _yaml["title"]["title"].tag.match(rgx_y.yaml_tag_is_str) ) { _struct_composite.meta.title_main = _yaml["title"]["title"].get!string; } if ("edition" in _yaml["title"] && _yaml["title"]["edition"].type.string - && _yaml["title"]["edition"].tag.match(rgx.yaml_tag_is_str) + && _yaml["title"]["edition"].tag.match(rgx_y.yaml_tag_is_str) ) { _struct_composite.meta.title_edition = _yaml["title"]["edition"].get!string; } if ("full" in _yaml["title"] && _yaml["title"]["full"].type.string - && _yaml["title"]["full"].tag.match(rgx.yaml_tag_is_str) + && _yaml["title"]["full"].tag.match(rgx_y.yaml_tag_is_str) ) { _struct_composite.meta.title_full = _yaml["title"]["full"].get!string; } if ("language" in _yaml["title"] && _yaml["title"]["language"].type.string - && _yaml["title"]["language"].tag.match(rgx.yaml_tag_is_str) + && _yaml["title"]["language"].tag.match(rgx_y.yaml_tag_is_str) ) { _struct_composite.meta.title_language = _yaml["title"]["language"].get!string; } if ("note" in _yaml["title"] && _yaml["title"]["note"].type.string - && _yaml["title"]["note"].tag.match(rgx.yaml_tag_is_str) + && _yaml["title"]["note"].tag.match(rgx_y.yaml_tag_is_str) ) { _struct_composite.meta.title_note = _yaml["title"]["note"].get!string; } if ("subtitle" in _yaml["title"] && _yaml["title"]["subtitle"].type.string - && _yaml["title"]["subtitle"].tag.match(rgx.yaml_tag_is_str) + && _yaml["title"]["subtitle"].tag.match(rgx_y.yaml_tag_is_str) ) { _struct_composite.meta.title_subtitle = _yaml["title"]["subtitle"].get!string; } else if ("sub" in _yaml["title"] && _yaml["title"]["sub"].type.string - && _yaml["title"]["sub"].tag.match(rgx.yaml_tag_is_str) + && _yaml["title"]["sub"].tag.match(rgx_y.yaml_tag_is_str) ) { _struct_composite.meta.title_subtitle = _yaml["title"]["sub"].get!string; } } else if ( _yaml["title"].type.string - && _yaml["title"].tag.match(rgx.yaml_tag_is_str) + && _yaml["title"].tag.match(rgx_y.yaml_tag_is_str) ) { _struct_composite.meta.title_main = _yaml["title"].get!string; } @@ -1479,29 +1485,29 @@ if ("classify" in _yaml && _yaml["classify"].type.sequence ) { if (_yaml["classify"].type.mapping - && _yaml["classify"].tag.match(rgx.yaml_tag_is_map) + && _yaml["classify"].tag.match(rgx_y.yaml_tag_is_map) ) { if ("dewey" in _yaml["classify"] && _yaml["classify"]["dewey"].type.string - && _yaml["classify"]["dewey"].tag.match(rgx.yaml_tag_is_str) + && _yaml["classify"]["dewey"].tag.match(rgx_y.yaml_tag_is_str) ) { _struct_composite.meta.classify_dewey = _yaml["classify"]["dewey"].get!string; } if ("loc" in _yaml["classify"] && _yaml["classify"]["loc"].type.string - && _yaml["classify"]["loc"].tag.match(rgx.yaml_tag_is_str) + && _yaml["classify"]["loc"].tag.match(rgx_y.yaml_tag_is_str) ) { _struct_composite.meta.classify_loc = _yaml["classify"]["loc"].get!string; } if ("keywords" in _yaml["classify"] && _yaml["classify"]["keywords"].type.string - && _yaml["classify"]["keywords"].tag.match(rgx.yaml_tag_is_str) + && _yaml["classify"]["keywords"].tag.match(rgx_y.yaml_tag_is_str) ) { _struct_composite.meta.classify_keywords = _yaml["classify"]["keywords"].get!string; } if ("topic_register" in _yaml["classify"] && _yaml["classify"]["topic_register"].type.string - && _yaml["classify"]["topic_register"].tag.match(rgx.yaml_tag_is_str) + && _yaml["classify"]["topic_register"].tag.match(rgx_y.yaml_tag_is_str) ) { _struct_composite.meta.classify_topic_register = _yaml["classify"]["topic_register"].get!string; if (_struct_composite.meta.classify_topic_register.length > 0) { @@ -1549,47 +1555,47 @@ if ("date" in _yaml && _yaml["date"].type.sequence ) { if (_yaml["date"].type.mapping - && _yaml["date"].tag.match(rgx.yaml_tag_is_map) + && _yaml["date"].tag.match(rgx_y.yaml_tag_is_map) ) { if ("added_to_site" in _yaml["date"] && _yaml["date"]["added_to_site"].type.string - && _yaml["date"]["added_to_site"].tag.match(rgx.yaml_tag_is_str) + && _yaml["date"]["added_to_site"].tag.match(rgx_y.yaml_tag_is_str) ) { _struct_composite.meta.date_added_to_site = _yaml["date"]["added_to_site"].get!string; } if ("available" in _yaml["date"] && _yaml["date"]["available"].type.string - && _yaml["date"]["available"].tag.match(rgx.yaml_tag_is_str) + && _yaml["date"]["available"].tag.match(rgx_y.yaml_tag_is_str) ) { _struct_composite.meta.date_available = _yaml["date"]["available"].get!string; } if ("created" in _yaml["date"] && _yaml["date"]["created"].type.string - && _yaml["date"]["created"].tag.match(rgx.yaml_tag_is_str) + && _yaml["date"]["created"].tag.match(rgx_y.yaml_tag_is_str) ) { _struct_composite.meta.date_created = _yaml["date"]["created"].get!string; } if ("issued" in _yaml["date"] && _yaml["date"]["issued"].type.string - && _yaml["date"]["issued"].tag.match(rgx.yaml_tag_is_str) + && _yaml["date"]["issued"].tag.match(rgx_y.yaml_tag_is_str) ) { _struct_composite.meta.date_issued = _yaml["date"]["issued"].get!string; } if ("modified" in _yaml["date"] && _yaml["date"]["modified"].type.string - && _yaml["date"]["modified"].tag.match(rgx.yaml_tag_is_str) + && _yaml["date"]["modified"].tag.match(rgx_y.yaml_tag_is_str) ) { _struct_composite.meta.date_modified = _yaml["date"]["modified"].get!string; } if ("published" in _yaml["date"] && _yaml["date"]["published"].type.string - && _yaml["date"]["published"].tag.match(rgx.yaml_tag_is_str) + && _yaml["date"]["published"].tag.match(rgx_y.yaml_tag_is_str) ) { _struct_composite.meta.date_published = _yaml["date"]["published"].get!string; } if ("valid" in _yaml["date"] && _yaml["date"]["valid"].type.string - && _yaml["date"]["valid"].tag.match(rgx.yaml_tag_is_str) + && _yaml["date"]["valid"].tag.match(rgx_y.yaml_tag_is_str) ) { _struct_composite.meta.date_valid = _yaml["date"]["valid"].get!string; } @@ -1605,23 +1611,23 @@ if ("notes" in _yaml && _yaml["notes"].type.sequence ) { if (_yaml["notes"].type.mapping - && _yaml["notes"].tag.match(rgx.yaml_tag_is_map) + && _yaml["notes"].tag.match(rgx_y.yaml_tag_is_map) ) { if ("abstract" in _yaml["notes"] && _yaml["notes"]["abstract"].type.string - && _yaml["notes"]["abstract"].tag.match(rgx.yaml_tag_is_str) + && _yaml["notes"]["abstract"].tag.match(rgx_y.yaml_tag_is_str) ) { _struct_composite.meta.notes_abstract = _yaml["notes"]["abstract"].get!string; } if ("description" in _yaml["notes"] && _yaml["notes"]["description"].type.string - && _yaml["notes"]["description"].tag.match(rgx.yaml_tag_is_str) + && _yaml["notes"]["description"].tag.match(rgx_y.yaml_tag_is_str) ) { _struct_composite.meta.notes_description = _yaml["notes"]["description"].get!string; } if ("summary" in _yaml["notes"] && _yaml["notes"]["summary"].type.string - && _yaml["notes"]["summary"].tag.match(rgx.yaml_tag_is_str) + && _yaml["notes"]["summary"].tag.match(rgx_y.yaml_tag_is_str) ) { _struct_composite.meta.notes_summary = _yaml["notes"]["summary"].get!string; } @@ -1631,29 +1637,29 @@ if ("original" in _yaml && _yaml["original"].type.sequence ) { if (_yaml["original"].type.mapping - && _yaml["original"].tag.match(rgx.yaml_tag_is_map) + && _yaml["original"].tag.match(rgx_y.yaml_tag_is_map) ) { if ("language" in _yaml["original"] && _yaml["original"]["language"].type.string - && _yaml["original"]["language"].tag.match(rgx.yaml_tag_is_str) + && _yaml["original"]["language"].tag.match(rgx_y.yaml_tag_is_str) ) { _struct_composite.meta.original_language = _yaml["original"]["language"].get!string; } if ("language_char" in _yaml["original"] && _yaml["original"]["language_char"].type.string - && _yaml["original"]["language_char"].tag.match(rgx.yaml_tag_is_str) + && _yaml["original"]["language_char"].tag.match(rgx_y.yaml_tag_is_str) ) { _struct_composite.meta.original_language_char = _yaml["original"]["language_char"].get!string; } if ("source" in _yaml["original"] && _yaml["original"]["source"].type.string - && _yaml["original"]["source"].tag.match(rgx.yaml_tag_is_str) + && _yaml["original"]["source"].tag.match(rgx_y.yaml_tag_is_str) ) { _struct_composite.meta.original_source = _yaml["original"]["source"].get!string; } if ("title" in _yaml["original"] && _yaml["original"]["title"].type.string - && _yaml["original"]["title"].tag.match(rgx.yaml_tag_is_str) + && _yaml["original"]["title"].tag.match(rgx_y.yaml_tag_is_str) ) { _struct_composite.meta.original_title = _yaml["original"]["title"].get!string; } @@ -1668,59 +1674,59 @@ if ("rights" in _yaml && _yaml["rights"].type.sequence ) { if (_yaml["rights"].type.mapping - && _yaml["rights"].tag.match(rgx.yaml_tag_is_map) + && _yaml["rights"].tag.match(rgx_y.yaml_tag_is_map) ) { if ("copyright" in _yaml["rights"] && _yaml["rights"]["copyright"].type.string - && _yaml["rights"]["copyright"].tag.match(rgx.yaml_tag_is_str) + && _yaml["rights"]["copyright"].tag.match(rgx_y.yaml_tag_is_str) ) { _struct_composite.meta.rights_copyright = check_input_markup(_yaml["rights"]["copyright"].get!string); } if ("copyright_text" in _yaml["rights"] && _yaml["rights"]["copyright_text"].type.string - && _yaml["rights"]["copyright_text"].tag.match(rgx.yaml_tag_is_str) + && _yaml["rights"]["copyright_text"].tag.match(rgx_y.yaml_tag_is_str) ) { _struct_composite.meta.rights_copyright_text = _yaml["rights"]["copyright_text"].get!string; } if ("copyright_audio" in _yaml["rights"] && _yaml["rights"]["copyright_audio"].type.string - && _yaml["rights"]["copyright_audio"].tag.match(rgx.yaml_tag_is_str) + && _yaml["rights"]["copyright_audio"].tag.match(rgx_y.yaml_tag_is_str) ) { _struct_composite.meta.rights_copyright_audio = _yaml["rights"]["copyright_audio"].get!string; } if ("copyright_cover" in _yaml["rights"] && _yaml["rights"]["copyright_cover"].type.string - && _yaml["rights"]["copyright_cover"].tag.match(rgx.yaml_tag_is_str) + && _yaml["rights"]["copyright_cover"].tag.match(rgx_y.yaml_tag_is_str) ) { _struct_composite.meta.rights_copyright_cover = _yaml["rights"]["copyright_cover"].get!string; } if ("copyright_illustrations" in _yaml["rights"] && _yaml["rights"]["copyright_illustrations"].type.string - && _yaml["rights"]["copyright_illustrations"].tag.match(rgx.yaml_tag_is_str) + && _yaml["rights"]["copyright_illustrations"].tag.match(rgx_y.yaml_tag_is_str) ) { _struct_composite.meta.rights_copyright_illustrations = _yaml["rights"]["copyright_illustrations"].get!string; } if ("copyright_photographs" in _yaml["rights"] && _yaml["rights"]["copyright_photographs"].type.string - && _yaml["rights"]["copyright_photographs"].tag.match(rgx.yaml_tag_is_str) + && _yaml["rights"]["copyright_photographs"].tag.match(rgx_y.yaml_tag_is_str) ) { _struct_composite.meta.rights_copyright_photographs = _yaml["rights"]["copyright_photographs"].get!string; } if ("copyright_translation" in _yaml["rights"] && _yaml["rights"]["copyright_translation"].type.string - && _yaml["rights"]["copyright_translation"].tag.match(rgx.yaml_tag_is_str) + && _yaml["rights"]["copyright_translation"].tag.match(rgx_y.yaml_tag_is_str) ) { _struct_composite.meta.rights_copyright_translation = _yaml["rights"]["copyright_translation"].get!string; } if ("copyright_video" in _yaml["rights"] && _yaml["rights"]["copyright_video"].type.string - && _yaml["rights"]["copyright_video"].tag.match(rgx.yaml_tag_is_str) + && _yaml["rights"]["copyright_video"].tag.match(rgx_y.yaml_tag_is_str) ) { _struct_composite.meta.rights_copyright_video = _yaml["rights"]["copyright_video"].get!string; } if ("license" in _yaml["rights"] && _yaml["rights"]["license"].type.string - && _yaml["rights"]["license"].tag.match(rgx.yaml_tag_is_str) + && _yaml["rights"]["license"].tag.match(rgx_y.yaml_tag_is_str) ) { _struct_composite.meta.rights_license = check_input_markup(_yaml["rights"]["license"].get!string); } @@ -1755,18 +1761,20 @@ static template contentJSONtoSpineStruct() { doc_reform.meta.conf_make_meta_structs, doc_reform.meta.conf_make_meta_json, doc_reform.meta.defaults, + doc_reform.meta.rgx_yaml, doc_reform.meta.rgx; ConfComposite _struct_composite; @safe auto contentJSONtoSpineStruct(C,J,M)(C _struct_composite, J _json, M _manifested, string _identifier) { mixin spineRgxIn; static auto rgx = RgxI(); + mixin spineRgxYamlTags; + static auto rgx_y = RgxYaml(); debug (json) { writeln(">> --------------------------- >>"); foreach (tag0; _json.object.byKeyValue) { if (tag0.value.stringof == "string") { writeln(tag0.key, ": ", tag0.value); - } else { - // writeln(tag0.key, ":"); + } else { // writeln(tag0.key, ":"); foreach (tag1; tag0.value.object.byKeyValue) { writeln(tag0.key, ":", tag1.key, ": ", tag1.value); } @@ -2461,10 +2469,13 @@ template docHeaderMakeAndMetaTupYamlExtractAndConvertToStruct() { import doc_reform.meta.conf_make_meta_structs, doc_reform.meta.conf_make_meta_json, + doc_reform.meta.rgx_yaml, doc_reform.meta.rgx; mixin spineRgxIn; mixin contentJSONtoSpineStruct; static auto rgx = RgxI(); + mixin spineRgxYamlTags; + static auto rgx_y = RgxYaml(); @system auto docHeaderMakeAndMetaTupYamlExtractAndConvertToStruct(CCm,Src,M,O,Cfg)( Src header_src, CCm _make_and_meta_struct, diff --git a/org/meta_debugs.org b/org/meta_debugs.org index 37be148..36d7bfe 100644 --- a/org/meta_debugs.org +++ b/org/meta_debugs.org @@ -34,7 +34,7 @@ template spineDebugs() { const S contents, T doc_matters, ) { - mixin spineRgxIn; + mixin spineRgxFiles; mixin InternalMarkup; <<initialize>> <<meta_output_debugs>> @@ -54,7 +54,7 @@ template spineDebugs() { #+BEGIN_SRC d import doc_reform.meta.defaults, - doc_reform.meta.rgx; + doc_reform.meta.rgx_files; import std.algorithm, std.array, @@ -76,7 +76,7 @@ import #+NAME: initialize #+BEGIN_SRC d -static auto rgx = RgxI(); +static auto rgx_files = RgxFiles(); auto markup = InlineMarkup(); string key; #+END_SRC @@ -739,7 +739,7 @@ debug(summary) { #+NAME: meta_output_debugs_summary #+BEGIN_SRC d debug(checkdoc) { - if (auto mfn=match(doc_matters.src.filename, rgx.src_fn)) { + if (auto mfn=match(doc_matters.src.filename, rgx_files.src_fn)) { if (doc_matters.opt.action.assertions) { switch (mfn.captures[2]) { // live manual: diff --git a/org/metaverse.org b/org/metaverse.org index 3602d34..6cdab4b 100644 --- a/org/metaverse.org +++ b/org/metaverse.org @@ -288,6 +288,7 @@ import import doc_reform.meta, doc_reform.meta.defaults, + doc_reform.meta.rgx, doc_reform.meta.metadoc_object_setter, doc_reform.meta.rgx; #+END_SRC @@ -626,10 +627,10 @@ enum DomTags { none, open, close, close_and_open, open_still, } static auto rgx = RgxI(); static auto mkup = InlineMarkup(); line = replaceAll!(m => mkup.quote_o ~ m[1] ~ mkup.quote_c)(line, rgx.within_quotes); - line = replaceAll!(m => mkup.mono ~ mkup.ff_o ~ m["text"] ~ mkup.ff_c ~ mkup.mono)(line, rgx.inline_mark_mono); - line = replaceAll!(m => mkup.cite ~ mkup.ff_o ~ m["text"] ~ mkup.ff_c ~ mkup.cite)(line, rgx.inline_mark_cite); + line = replaceAll!(m => "⑆" ~ mkup.mono ~ mkup.ff_o ~ m["text"] ~ mkup.ff_c ~ mkup.mono)(line, rgx.inline_mark_mono); + line = replaceAll!(m => "⑆" ~ mkup.cite ~ mkup.ff_o ~ m["text"] ~ mkup.ff_c ~ mkup.cite)(line, rgx.inline_mark_cite); foreach (regx; [rgx.inline_mark_emphasis, rgx.inline_mark_bold, rgx.inline_mark_underscore, rgx.inline_mark_italics, rgx.inline_mark_superscript, rgx.inline_mark_subscript, rgx.inline_mark_strike, rgx.inline_mark_insert]) { - line = replaceAll!(m => m["mark"] ~ mkup.ff_o ~ m["text"] ~ mkup.ff_c ~ m["mark"])(line, regx); + line = replaceAll!(m => "⑆" ~ m["mark"] ~ mkup.ff_o ~ m["text"] ~ mkup.ff_c ~ m["mark"])(line, regx); } return line; } @@ -5403,17 +5404,17 @@ if (pith["block_is"] == eN.blk_is.quote) { if (textline.match(rgx.inline_faces_line)) { textline = textline .replaceFirst(rgx.inline_emphasis_line, - format(q"┃%s%s%s%s%s%s┃", - mkup.emph, mkup.ff_o, "$1", mkup.ff_c, mkup.emph, "$2")) + format(q"┃%s%s%s%s%s%s%s┃", + "⑆", mkup.emph, mkup.ff_o, "$1", mkup.ff_c, mkup.emph, "$2")) .replaceFirst(rgx.inline_bold_line, - format(q"┃%s%s%s%s%s%s┃", - mkup.bold, mkup.ff_o, "$1", mkup.ff_c, mkup.bold, "$2")) + format(q"┃%s%s%s%s%s%s%s┃", + "⑆", mkup.bold, mkup.ff_o, "$1", mkup.ff_c, mkup.bold, "$2")) .replaceFirst(rgx.inline_underscore_line, - format(q"┃%s%s%s%s%s%s┃", - mkup.underscore, mkup.ff_o, "$1", mkup.ff_c, mkup.underscore, "$2")) + format(q"┃%s%s%s%s%s%s%s┃", + "⑆", mkup.underscore, mkup.ff_o, "$1", mkup.ff_c, mkup.underscore, "$2")) .replaceFirst(rgx.inline_italics_line, - format(q"┃%s%s%s%s%s%s┃", - mkup.italic, mkup.ff_o, "$1", mkup.ff_c, mkup.italic, "$2")); + format(q"┃%s%s%s%s%s%s%s┃", + "⑆", mkup.italic, mkup.ff_o, "$1", mkup.ff_c, mkup.italic, "$2")); } return textline; } @@ -6931,7 +6932,7 @@ struct BookIndexReportSection { bookindex_unordered_hashes.byKey.array .sort!("toUpper(a) < toUpper(b)", SwapStrategy.stable).release; foreach (mainkey; mainkeys) { - write("_0_1 !┨", mainkey, "┣! "); + write("_0_1 ⑆!┨", mainkey, "┣! "); foreach (ref_; bookindex_unordered_hashes[mainkey]["_a"]) { auto go = ref_.replaceAll(rgx.book_index_go, "$1"); write(" {", ref_, "}#", go, ", "); @@ -7044,7 +7045,7 @@ struct BookIndexReportSection { string[dchar] transTable = [' ' : "_"]; foreach (mainkey; mainkeys) { bi_tmp_tags = [""]; - bi_tmp = mkup.bold ~ mkup.ff_o ~ mainkey ~ mkup.ff_c ~ mkup.bold ~ " "; + bi_tmp = "⑆" ~ mkup.bold ~ mkup.ff_o ~ mainkey ~ mkup.ff_c ~ mkup.bold ~ " "; buffer.clear(); bi_tmp_tags ~= translate(mainkey, transTable); auto bkidx_lnk(string locs) { diff --git a/org/out_latex.org b/org/out_latex.org index 7e235b6..1c1442b 100644 --- a/org/out_latex.org +++ b/org/out_latex.org @@ -134,7 +134,6 @@ template outputLaTeX() { #+BEGIN_SRC d template outputLaTeXstyInit() { import doc_reform.io_out; - mixin spineRgxOut; auto paper = paperLaTeX; <<Function_output_style_write>> <<Function_output_stylesheets_get_each_written>> @@ -627,10 +626,14 @@ import std.outbuffer, std.uri, std.conv : to; -import doc_reform.io_out; -mixin InternalMarkup; // watch +import + doc_reform.io_out, + doc_reform.io_out.rgx, + doc_reform.io_out.rgx_latex; mixin spineRgxOut; static auto rgx = RgxO(); +mixin spineRgxLSC; +static auto rgx_sc = RgxLSC(); mixin spineLanguageCodes; auto lang = Lang(); auto paper = paperLaTeX; @@ -921,23 +924,23 @@ struct PaperType { ) { string _unescape_sp_char_esc()(string _txt) { _txt = _txt - .replaceAll(rgx.latex_special_char_escaped, + .replaceAll(rgx_sc.latex_special_char_escaped, format(q"┃%s┃", "$1")) - .replaceAll(rgx.latex_special_char_escaped_braced, + .replaceAll(rgx_sc.latex_special_char_escaped_braced, format(q"┃%s┃", "$1")); return _txt; } string _unescape_fontface_esc()(string _txt) { - _txt = _txt.replaceAll(rgx.latex_identify_inline_fontface, + _txt = _txt.replaceAll(rgx_sc.latex_identify_inline_fontface, format(q"┃%s%s┃", "$1", "$2")); return _txt; } - _txt = replaceAll!(m => "\\" ~ m[1])(_txt, rgx.latex_special_char_for_escape); - _txt = replaceAll!(m => "{\\" ~ m[1] ~ "}")(_txt, rgx.latex_special_char_for_escape_and_braces); + _txt = replaceAll!(m => "\\" ~ m[1])(_txt, rgx_sc.latex_special_char_for_escape); + _txt = replaceAll!(m => "{\\" ~ m[1] ~ "}")(_txt, rgx_sc.latex_special_char_for_escape_and_braces); _txt = replaceAll!(m => "''")(_txt, rgx.quotes_open_and_close); _txt = replaceAll!(m => "$\\cdot$")(_txt, rgx.middle_dot); - _txt = replaceAll!(m => _unescape_sp_char_esc(m[0]))(_txt, rgx.latex_identify_inline_link); - _txt = replaceAll!(m => _unescape_fontface_esc(m[0]))(_txt, rgx.latex_identify_inline_fontface); + _txt = replaceAll!(m => _unescape_sp_char_esc(m[0]))(_txt, rgx_sc.latex_identify_inline_link); + _txt = replaceAll!(m => _unescape_fontface_esc(m[0]))(_txt, rgx_sc.latex_identify_inline_fontface); return _txt; } #+END_SRC @@ -986,7 +989,7 @@ struct PaperType { @safe string sp_char_esc_()( string _txt, ) { - _txt = replaceAll!(m => "\\" ~ m[1])(_txt, rgx.latex_special_char); + _txt = replaceAll!(m => "\\" ~ m[1])(_txt, rgx_sc.latex_special_char); return _txt; } #+END_SRC @@ -1125,8 +1128,8 @@ _txt = _txt } string _check_link(string _link) { _link = _link - .replaceFirst(rgx.latex_clean_internal_link, "") - .replaceAll(rgx.latex_special_char_for_escape_url, "\\$1"); + .replaceFirst(rgx_sc.latex_clean_internal_link, "") + .replaceAll(rgx_sc.latex_special_char_for_escape_url, "\\$1"); return _link; } if (obj.metainfo.is_a != "code") { @@ -1219,7 +1222,7 @@ _txt = _txt string _tex_para; _tex_para = q"┃%s┃"; _txt = format(_tex_para, - _txt.replaceAll(rgx.latex_clean_bookindex_linebreak, "\n") ~ "\n\\brln\n" + _txt.replaceAll(rgx_sc.latex_clean_bookindex_linebreak, "\n") ~ "\n\\brln\n" ); } return _txt; diff --git a/org/out_odt.org b/org/out_odt.org index 23afc03..c9d36da 100644 --- a/org/out_odt.org +++ b/org/out_odt.org @@ -54,8 +54,10 @@ module doc_reform.io_out.odt; template formatODT() { <<output_imports>> mixin spineRgxOut; + mixin spineRgxXHTML; struct formatODT { static auto rgx = RgxO(); + static auto rgx_xhtml = RgxXHTML(); <<odt_format_objects_0>> <<odt_format_objects_1>> <<odt_format_objects_2>> @@ -87,7 +89,9 @@ template outputODT() { <<output_imports>> mixin InternalMarkup; mixin spineRgxOut; + mixin spineRgxXHTML; static auto rgx = RgxO(); + static auto rgx_xhtml = RgxXHTML(); // mixin outputXmlODT; <<output_odt_variable_content_xml_0>> <<output_odt_variable_content_xml_1>> @@ -201,6 +205,7 @@ template outputODT() { #+BEGIN_SRC d @safe string _footnotes()(string _txt) { static auto rgx = RgxO(); + static auto rgx_xhtml = RgxXHTML(); _txt = _txt.replaceAll( rgx.inline_notes_al_regular_number_note, format(q"┃<text:note text:id="ftn%s" text:note-class="footnote"> @@ -394,10 +399,10 @@ template outputODT() { #+BEGIN_SRC d @safe string _special_characters(O)(string _txt, const O obj) { _txt = _txt - .replaceAll(rgx.xhtml_ampersand, "&") - .replaceAll(rgx.xhtml_quotation, """) - .replaceAll(rgx.xhtml_less_than, "<") - .replaceAll(rgx.xhtml_greater_than, ">") + .replaceAll(rgx_xhtml.ampersand, "&") + .replaceAll(rgx_xhtml.quotation, """) + .replaceAll(rgx_xhtml.less_than, "<") + .replaceAll(rgx_xhtml.greater_than, ">") .replaceAll(rgx.nbsp_char, " "); return _txt; } @@ -1021,7 +1026,10 @@ void outputODT(D,I)( #+NAME: output_imports #+BEGIN_SRC d -import doc_reform.io_out; +import + doc_reform.io_out, + doc_reform.io_out.rgx, + doc_reform.io_out.rgx_xhtml; import std.digest.sha, std.file, diff --git a/org/out_sqlite.org b/org/out_sqlite.org index 3a201e7..a90e6fd 100644 --- a/org/out_sqlite.org +++ b/org/out_sqlite.org @@ -67,8 +67,10 @@ module doc_reform.io_out.sqlite; #+NAME: sqlite_common #+BEGIN_SRC d mixin spineRgxOut; +mixin spineRgxXHTML; mixin InternalMarkup; static auto rgx = RgxO(); +static auto rgx_xhtml = RgxXHTML(); static auto mkup = InlineMarkup(); long _metadata_tid_lastrowid; #+END_SRC @@ -188,6 +190,7 @@ template SQLiteFormatAndLoadObject() { M doc_matters, ) { mixin spineRgxOut; + mixin spineRgxXHTML; struct sqlite_format_and_load_objects { <<sanitize_text_for_search>> <<sanitize_and_munge_inline_html_munge>> @@ -369,8 +372,13 @@ if (opt_action.sqlite_db_create) { ? config.conf.w_srv_db_sqlite_path : ""; if (db_filename.length > 0 && db_path.length > 0) { - if ((opt_action.vox_gt1)) { - writeln("db name & path: ", db_path, db_filename); + if (opt_action.vox_gt2) { + writeln("db name: ", db_filename); + writeln("db path: ", db_path); + writeln("db name & path: ", db_path, "/", db_filename); + } + if (opt_action.vox_gt1) { + writeln("attempting to create db: ", db_path, "/", db_filename); } auto pth_sqlite = spinePathsSQLite!()(db_filename, db_path); pth_sqlite.base.mkdirRecurse; @@ -484,7 +492,10 @@ template SQLiteDbDrop() { #+NAME: sqlite_imports #+BEGIN_SRC d -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; @@ -563,15 +574,15 @@ string munge_html(M,O)( ) { string _html_special_characters(string _txt){ _txt = _txt - .replaceAll(rgx.xhtml_ampersand, "&") - .replaceAll(rgx.xhtml_quotation, """) - .replaceAll(rgx.xhtml_less_than, "<") - .replaceAll(rgx.xhtml_greater_than, ">") + .replaceAll(rgx_xhtml.ampersand, "&") + .replaceAll(rgx_xhtml.quotation, """) + .replaceAll(rgx_xhtml.less_than, "<") + .replaceAll(rgx_xhtml.greater_than, ">") .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){ @@ -606,15 +617,15 @@ string munge_html(M,O)( #+BEGIN_SRC d string html_special_characters(string _txt){ _txt = _txt - .replaceAll(rgx.xhtml_ampersand, "&") - .replaceAll(rgx.xhtml_quotation, """) - .replaceAll(rgx.xhtml_less_than, "<") - .replaceAll(rgx.xhtml_greater_than, ">") + .replaceAll(rgx_xhtml.ampersand, "&") + .replaceAll(rgx_xhtml.quotation, """) + .replaceAll(rgx_xhtml.less_than, "<") + .replaceAll(rgx_xhtml.greater_than, ">") .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; } #+END_SRC @@ -625,10 +636,10 @@ string html_special_characters(string _txt){ #+BEGIN_SRC d string html_special_characters_code(string _txt){ _txt = _txt - .replaceAll(rgx.xhtml_ampersand, "&") - .replaceAll(rgx.xhtml_quotation, """) - .replaceAll(rgx.xhtml_less_than, "<") - .replaceAll(rgx.xhtml_greater_than, ">") + .replaceAll(rgx_xhtml.ampersand, "&") + .replaceAll(rgx_xhtml.quotation, """) + .replaceAll(rgx_xhtml.less_than, "<") + .replaceAll(rgx_xhtml.greater_than, ">") .replaceAll(rgx.nbsp_char, " "); return _txt; } @@ -667,6 +678,7 @@ string inline_grouped_text_bullets_indents(M,O)( 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, diff --git a/org/out_src_pod.org b/org/out_src_pod.org index 4d6395c..fd0b2ba 100644 --- a/org/out_src_pod.org +++ b/org/out_src_pod.org @@ -48,7 +48,9 @@ template spinePod() { #+NAME: output_imports #+BEGIN_SRC d -import doc_reform.io_out; +import + doc_reform.meta.rgx_files, + doc_reform.io_out; import std.digest.sha, std.file, @@ -67,15 +69,15 @@ import debug(asserts) { // static assert(is(typeof(doc_matters) == tuple)); } -mixin spineRgxOut; +mixin spineRgxFiles; 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 = RgxO(); -assert (doc_matters.src.filename.match(rgx.src_fn)); +static auto rgx_files = RgxFiles(); +assert (doc_matters.src.filename.match(rgx_files.src_fn)); #+END_SRC *** pod zip archive 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, "&") // "&" - .replaceAll(rgx.xhtml_quotation, """) // """ - .replaceAll(rgx.xhtml_less_than, "<") // "<" - .replaceAll(rgx.xhtml_greater_than, ">") // ">" + .replaceAll(rgx_xhtml.ampersand, "&") // "&" + .replaceAll(rgx_xhtml.quotation, """) // """ + .replaceAll(rgx_xhtml.less_than, "<") // "<" + .replaceAll(rgx_xhtml.greater_than, ">") // ">" .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 +/ diff --git a/org/output_hub.org b/org/output_hub.org index d6c4e3f..22f2ead 100644 --- a/org/output_hub.org +++ b/org/output_hub.org @@ -35,10 +35,8 @@ template outputHub() { const D doc_abstraction, I doc_matters ) { - mixin spineRgxOut; mixin Msg; auto msg = Msg!()(doc_matters); - 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); @@ -97,8 +95,6 @@ template outputHubInitialize() { template outputHubOp() { <<output_imports>> @system void outputHubOp(E,O,C)(E env, O opt_action, C config) { - mixin spineRgxOut; - static auto rgx = RgxO(); <<output_options_op_sqlite_db_drop>> <<output_options_op_sqlite_db_create>> } diff --git a/org/spine.org b/org/spine.org index f9278ed..4588a5e 100644 --- a/org/spine.org +++ b/org/spine.org @@ -203,6 +203,8 @@ import doc_reform.meta.defaults, doc_reform.meta.doc_debugs, doc_reform.meta.rgx, + doc_reform.meta.rgx_yaml, + doc_reform.meta.rgx_files, doc_reform.io_in.paths_source, doc_reform.io_in.read_config_files, doc_reform.io_in.read_source_files, @@ -221,7 +223,6 @@ import doc_reform.meta.conf_make_meta_structs, doc_reform.meta.conf_make_meta_json, doc_reform.meta.defaults, - doc_reform.meta.rgx, doc_reform.io_in.paths_source, doc_reform.io_in.read_config_files, doc_reform.io_in.read_source_files, @@ -277,6 +278,14 @@ mixin CompileTimeInfo; #+NAME: spine_mixin #+BEGIN_SRC d mixin spineRgxIn; +mixin spineRgxYamlTags; +mixin spineRgxFiles; +mixin spineBiblio; +mixin outputHub; +#+END_SRC + +#+NAME: spine_metadoc_mixin +#+BEGIN_SRC d mixin spineBiblio; mixin outputHub; #+END_SRC @@ -296,6 +305,8 @@ string flag_action; string arg_unrecognized; enum dAM { abstraction, matters } static auto rgx = RgxI(); +static auto rgx_y = RgxYaml(); +static auto rgx_files = RgxFiles(); #+END_SRC *** scope (run complete) :scope: @@ -1123,7 +1134,7 @@ foreach(arg; args[1..$]) { } else if (_opt_action.require_processing_files) { /+ cli, assumed to be path to source files +/ auto _manifest_start = PodManifest!()(_opt_action, arg); if ( /+ pod files +/ - !(arg.match(rgx.src_pth_sst_or_ssm)) + !(arg.match(rgx_files.src_pth_sst_or_ssm)) && _manifest_start.pod_manifest_file_with_path && _opt_action.abstraction ) { @@ -1151,10 +1162,10 @@ foreach(arg; args[1..$]) { } if ("doc" in pod_manifest_yaml) { if (pod_manifest_yaml["doc"].type.mapping - && pod_manifest_yaml["doc"].tag.match(rgx.yaml_tag_is_map) + && pod_manifest_yaml["doc"].tag.match(rgx_y.yaml_tag_is_map) ) { if ("path" in pod_manifest_yaml["doc"]) { - if (pod_manifest_yaml["doc"]["path"].tag.match(rgx.yaml_tag_is_seq)) { + if (pod_manifest_yaml["doc"]["path"].tag.match(rgx_y.yaml_tag_is_seq)) { foreach (string _path; pod_manifest_yaml["doc"]["path"]) { markup_contents_location_ ~= _path ~ "\n"; pod_manifest_root_content_paths_to_markup_location_raw_ ~= @@ -1162,7 +1173,7 @@ foreach(arg; args[1..$]) { } } else if ( pod_manifest_yaml["doc"]["path"].type.string - && pod_manifest_yaml["doc"]["path"].tag.match(rgx.yaml_tag_is_str) + && pod_manifest_yaml["doc"]["path"].tag.match(rgx_y.yaml_tag_is_str) ) { markup_contents_location_ = pod_manifest_yaml["doc"]["path"].get!string; pod_manifest_root_content_paths_to_markup_location_raw_ = @@ -1170,17 +1181,17 @@ foreach(arg; args[1..$]) { } } if ("filename" in pod_manifest_yaml["doc"]) { - if (pod_manifest_yaml["doc"]["filename"].tag.match(rgx.yaml_tag_is_seq)) { + if (pod_manifest_yaml["doc"]["filename"].tag.match(rgx_y.yaml_tag_is_seq)) { foreach (string _filename; pod_manifest_yaml["doc"]["filename"]) { if ("language" in pod_manifest_yaml["doc"]) { - if (pod_manifest_yaml["doc"]["language"].tag.match(rgx.yaml_tag_is_seq)) { + if (pod_manifest_yaml["doc"]["language"].tag.match(rgx_y.yaml_tag_is_seq)) { foreach (string _lang; pod_manifest_yaml["doc"]["language"]) { markup_contents_location_ ~= "media/text/" ~ _lang ~ "/" ~ _filename ~ "\n"; } - } else if (pod_manifest_yaml["doc"]["language"].tag.match(rgx.yaml_tag_is_str) + } else if (pod_manifest_yaml["doc"]["language"].tag.match(rgx_y.yaml_tag_is_str) ) { markup_contents_location_ = "media/text/" @@ -1203,17 +1214,17 @@ foreach(arg; args[1..$]) { } } else if ( pod_manifest_yaml["doc"]["filename"].type.string - && pod_manifest_yaml["doc"]["filename"].tag.match(rgx.yaml_tag_is_str) + && pod_manifest_yaml["doc"]["filename"].tag.match(rgx_y.yaml_tag_is_str) ) { if ("language" in pod_manifest_yaml["doc"]) { - if (pod_manifest_yaml["doc"]["language"].tag.match(rgx.yaml_tag_is_seq)) { + if (pod_manifest_yaml["doc"]["language"].tag.match(rgx_y.yaml_tag_is_seq)) { foreach (string _lang; pod_manifest_yaml["doc"]["language"]) { markup_contents_location_ ~= "media/text/" ~ _lang ~ "/" ~ pod_manifest_yaml["doc"]["filename"].get!string ~ "\n"; } - } else if (pod_manifest_yaml["doc"]["language"].tag.match(rgx.yaml_tag_is_str)) { + } else if (pod_manifest_yaml["doc"]["language"].tag.match(rgx_y.yaml_tag_is_str)) { markup_contents_location_ = "media/text/" ~ pod_manifest_yaml["doc"]["language"].get!string @@ -1250,7 +1261,7 @@ foreach(arg; args[1..$]) { = (cast(char[]) markup_contents_location_).split; auto tmp_dir_ = (sisudoc_txt_).dirName.array; foreach (markup_contents_location; markup_contents_locations_arr) { - assert(markup_contents_location.match(rgx.src_pth_sst_or_ssm), + assert(markup_contents_location.match(rgx_files.src_pth_sst_or_ssm), "not a recognised file: «" ~ markup_contents_location ~ "»" ); @@ -1264,14 +1275,14 @@ foreach(arg; args[1..$]) { _manifests ~= _manifested; } } - } else if (arg.match(rgx.src_pth_sst_or_ssm)) { /+ markup txt files +/ + } else if (arg.match(rgx_files.src_pth_sst_or_ssm)) { /+ markup txt files +/ if (exists(arg)==0) { writeln("ERROR >> Processing Skipped! File not found: ", arg); } else { _manifested = PathMatters!()(_opt_action, _env, arg, arg); _manifests ~= _manifested; } - } else if (arg.match(rgx.src_pth_zip)) { + } else if (arg.match(rgx_files.src_pth_zip)) { // fns_src ~= arg; // gather input markup source file names for processing } else { // anything remaining, unused arg_unrecognized ~= " " ~ arg; @@ -1315,7 +1326,7 @@ scope(failure) { } } enforce( - manifest.src.filename.match(rgx.src_pth_types), + manifest.src.filename.match(rgx_files.src_pth_types), "not a sisu markup filename: «" ~ manifest.src.filename ~ "»" ); @@ -1501,14 +1512,14 @@ break; // terminate, stop #+HEADER: :tangle "../src/doc_reform/meta/metadoc.d" #+BEGIN_SRC d +<<doc_header_including_copyright_and_license>> module doc_reform.meta.metadoc; template spineAbstraction() { <<imports_spine_metadoc>> - <<spine_mixin>> + <<spine_metadoc_mixin>> enum headBody { header, body_content, insert_file_list, image_list } enum makeMeta { make, meta } enum docAbst { doc_abstract_obj, doc_has } - static auto rgx = RgxI(); @system auto spineAbstraction(E,P,O,Cfg,M,S)( E _env, P program_info, diff --git a/src/doc_reform/io_in/paths_source.d b/src/doc_reform/io_in/paths_source.d index c34ac43..24f12b9 100644 --- a/src/doc_reform/io_in/paths_source.d +++ b/src/doc_reform/io_in/paths_source.d @@ -63,10 +63,10 @@ import std.conv : to; import doc_reform.meta.defaults, - doc_reform.meta.rgx; + doc_reform.meta.rgx_files; template PodManifest() { - mixin spineRgxIn; - static auto rgx = RgxI(); + mixin spineRgxFiles; + static auto rgx_files = RgxFiles(); @safe auto PodManifest(O)( O _opt_action, string _pth="" @@ -81,12 +81,12 @@ template PodManifest() { && (exists(_pth.chainPath(pod_manifest_filename).array) != 0 && (_pth.chainPath(pod_manifest_filename).array).isFile)) { _manifest_path = _pth; - } else if (_pth.match(rgx.src_pth_contents) + } else if (_pth.match(rgx_files.src_pth_contents) && exists(_pth) != 0 && _pth.isFile) { _manifest_path = _pth.dirName; - } else if (_pth.match(rgx.src_pth_pod_sst_or_ssm) + } else if (_pth.match(rgx_files.src_pth_pod_sst_or_ssm) && exists(_pth) != 0 && (_pth.isFile)) { - if (auto m = _pth.match(rgx.src_pth_pod_sst_or_ssm)) { + if (auto m = _pth.match(rgx_files.src_pth_pod_sst_or_ssm)) { _manifest_path = m.captures["podpath"]; } } else { @@ -118,9 +118,9 @@ template PodManifest() { } } template PathMatters() { - mixin spineRgxIn; mixin InternalMarkup; - static auto rgx = RgxI(); + mixin spineRgxFiles; + static auto rgx_files = RgxFiles(); static auto mkup = InlineMarkup(); @safe auto PathMatters(O,E)( O _opt_action, @@ -193,7 +193,7 @@ template PathMatters() { string[] _lngs; foreach (filename_; manifest_list_of_filenames) { string _k = "en"; - if (auto m = (filename_).match(rgx.language_code_and_filename)) { + if (auto m = (filename_).match(rgx_files.language_code_and_filename)) { _k = m.captures[1].to!string; } _lngs ~= _k; // all the languages from the manifest list of filenames with paths @@ -230,11 +230,11 @@ template PathMatters() { return filename.stripExtension; } @safe string filename_extension() { - return filename.match(rgx.src_pth_sst_or_ssm).captures["extension"]; + return filename.match(rgx_files.src_pth_sst_or_ssm).captures["extension"]; } @safe string lng() { string _k; - if (auto m = path_and_fn.match(rgx.language_code_and_filename)) { + if (auto m = path_and_fn.match(rgx_files.language_code_and_filename)) { _k = m.captures[1]; } else {_k = "en"; } return _k; @@ -318,7 +318,7 @@ template PathMatters() { } else { _dir = ((path_and_fn.chainPath("../../../")).asNormalizedPath).array; assert(_dir == absolute_path_to_src - .match(rgx.src_base_parent_dir_name).captures["dir"]); + .match(rgx_files.src_base_parent_dir_name).captures["dir"]); } if (_opt_action.debug_do) { writeln("--> (base_dir) ", _dir); @@ -341,7 +341,7 @@ template PathMatters() { string _dir; if ( auto m = (absolute_path_to_src) - .match(rgx.src_formalised_file_path_parts) + .match(rgx_files.src_formalised_file_path_parts) ) { _dir = ((m.captures["pth"]).asNormalizedPath).array; } else if ( @@ -396,7 +396,7 @@ template PathMatters() { ) { _dir = m.captures["dir"]; } else { - _dir = (absolute_path_to_src).match(rgx.src_base_parent_dir_name).captures["dir"]; + _dir = (absolute_path_to_src).match(rgx_files.src_base_parent_dir_name).captures["dir"]; } if (_opt_action.debug_do) { writeln("--> (base_parent_dir) ", _dir); @@ -460,8 +460,6 @@ template PathMatters() { } } template configFilePaths() { - mixin spineRgxIn; - static auto rgx = RgxI(); @safe auto configFilePaths(M,E)( M _manifested, E _env, @@ -581,8 +579,8 @@ template configFilePaths() { } } template spinePathsSRC() { - mixin spineRgxIn; - static auto rgx = RgxI(); + mixin spineRgxFiles; + static auto rgx_files = RgxFiles(); @safe auto spinePathsSRC(D,Fn)( D _pwd, Fn _fn_src_and_path, @@ -594,7 +592,7 @@ template spinePathsSRC() { @safe string language() { // use command line info as well? string _k; - if (auto m = _fn_src_and_path.match(rgx.language_code_and_filename)) { + if (auto m = _fn_src_and_path.match(rgx_files.language_code_and_filename)) { _k = m.captures[1]; } else { /+ unknown until doc_meta read, (could provide & use command line info?) +/ _k = "xx"; // original default was "en" but is not known @@ -632,8 +630,6 @@ template spinePathsSRC() { template spinePathsPods() { - mixin spineRgxIn; - static auto rgx = RgxI(); string _suffix = ".zip"; auto spinePathsPods(M)(M doc_matters) { string _base_dir_pod = (doc_matters.output_path.length > 0) diff --git a/src/doc_reform/io_in/read_config_files.d b/src/doc_reform/io_in/read_config_files.d index 64d548b..a1aa425 100644 --- a/src/doc_reform/io_in/read_config_files.d +++ b/src/doc_reform/io_in/read_config_files.d @@ -56,9 +56,11 @@ module doc_reform.io_in.read_config_files; import std.file, - std.path, + std.path; +import doc_reform.meta, doc_reform.io_in.paths_source, + doc_reform.meta.rgx_files, doc_reform.meta.rgx; template readConfigSite() { @@ -191,13 +193,17 @@ webserv: static template readConfigDoc() { import std.file, - std.path, + std.path; + import doc_reform.meta, doc_reform.io_in.paths_source, + doc_reform.meta.rgx_files, doc_reform.meta.rgx; @system final auto readConfigDoc(M,E)(M _manifested, E _env) { mixin spineRgxIn; static auto rgx = RgxI(); + mixin spineRgxFiles; + static auto rgx_files = RgxFiles(); string config_file_str; string conf_filename = "NONE"; auto _conf_file_details = configFilePaths!()(_manifested, _env); @@ -243,9 +249,12 @@ static template readConfigDoc() { static template configReadSiteYAML() { import std.file, - std.path, + std.path; + import doc_reform.meta, - doc_reform.io_in.paths_source; + doc_reform.io_in.paths_source, + doc_reform.meta.rgx_files, + doc_reform.meta.rgx; @safe final YAMLDocument configReadSiteYAML(M,E)(M _manifested, E _env) { string _configuration = configReadInSiteYAML!()(_manifested, _env); auto _conf_file_details = configFilePaths!()(_manifested, _env); @@ -257,7 +266,8 @@ static template configReadSiteYAML() { static template configReadDocYAML() { import std.file, - std.path, + std.path; + import doc_reform.meta, doc_reform.io_in.paths_source; @safe final YAMLDocument configReadDocYAML(M,E)(M _manifested, E _env) { diff --git a/src/doc_reform/io_in/read_source_files.d b/src/doc_reform/io_in/read_source_files.d index 4c8cf77..0a187f8 100644 --- a/src/doc_reform/io_in/read_source_files.d +++ b/src/doc_reform/io_in/read_source_files.d @@ -57,12 +57,16 @@ module doc_reform.io_in.read_source_files; template spineRawMarkupContent() { import std.file, - std.path, + std.path; + import doc_reform.meta, doc_reform.io_in.paths_source, + doc_reform.meta.rgx_files, doc_reform.meta.rgx; mixin spineRgxIn; static auto rgx = RgxI(); + mixin spineRgxFiles; + static auto rgx_files = RgxFiles(); string[] _images=[]; @safe string[] _extract_images(S)(S content_block) { string[] images_; @@ -108,7 +112,7 @@ template spineRawMarkupContent() { = raw.markupSourceHeaderContentRawLineTupleArray(source_txt_str); char[] header_raw = t.header; char[][] sourcefile_body_content = t.src_txt; - if (fn_src.match(rgx.src_fn_master)) { // filename with path needed if master file (.ssm) not otherwise + if (fn_src.match(rgx_files.src_fn_master)) { // filename with path needed if master file (.ssm) not otherwise auto ins = Inserts(); ContentsInsertsImages tu = ins.scan_master_src_for_insert_files_and_import_content(_opt_action, sourcefile_body_content, fn_src); @@ -175,9 +179,9 @@ template spineRawMarkupContent() { return source_line_arr; } @safe string markupSourceReadIn(in string fn_src) { - static auto rgx = RgxI(); + static auto rgx_files = RgxFiles(); enforce( - fn_src.match(rgx.src_pth_sst_or_ssm), + fn_src.match(rgx_files.src_pth_sst_or_ssm), "not a dr markup filename: «" ~ fn_src ~ "»" ); @@ -226,7 +230,7 @@ template spineRawMarkupContent() { char[][] contents_insert; int code_block_status = 0; enum codeBlock { off, curly, tic, } - auto fn_pth_full = fn_src.match(rgx.src_pth_sst_or_ssm); + auto fn_pth_full = fn_src.match(rgx_files.src_pth_sst_or_ssm); auto markup_src_file_path = fn_pth_full.captures[1]; foreach (line; markup_sourcefile_insert_content) { if (code_block_status == codeBlock.curly) { @@ -245,14 +249,14 @@ template spineRawMarkupContent() { } else if (line.matchFirst(rgx.block_tic_code_open)) { code_block_status = codeBlock.tic; contents_insert ~= line; - } else if (auto m = line.match(rgx.insert_src_fn_ssi_or_sst)) { + } else if (auto m = line.match(rgx_files.insert_src_fn_ssi_or_sst)) { auto insert_fn = m.captures[2]; auto insert_sub_pth = m.captures[1]; auto fn_src_insert = chainPath(markup_src_file_path, insert_sub_pth ~ insert_fn).array; auto raw = MarkupRawUnit(); auto markup_sourcesubfile_insert_content - = raw.getInsertMarkupSourceContentRawLineArray(fn_src_insert, rgx.src_fn_find_inserts); + = raw.getInsertMarkupSourceContentRawLineArray(fn_src_insert, rgx_files.src_fn_find_inserts); debug(insert_file) { writeln(line); writeln(fn_src_insert); @@ -300,7 +304,7 @@ template spineRawMarkupContent() { char[][] contents; int code_block_status = 0; enum codeBlock { off, curly, tic, } - auto fn_pth_full = fn_src.match(rgx.src_pth_sst_or_ssm); + auto fn_pth_full = fn_src.match(rgx_files.src_pth_sst_or_ssm); auto markup_src_file_path = fn_pth_full.captures[1]; char[][] contents_insert; string[] _images =[]; @@ -322,7 +326,7 @@ template spineRawMarkupContent() { } else if (line.matchFirst(rgx.block_tic_code_open)) { code_block_status = codeBlock.tic; contents ~= line; - } else if (auto m = line.match(rgx.insert_src_fn_ssi_or_sst)) { + } else if (auto m = line.match(rgx_files.insert_src_fn_ssi_or_sst)) { auto insert_fn = m.captures[2]; auto insert_sub_pth = m.captures[1]; auto fn_src_insert @@ -331,7 +335,7 @@ template spineRawMarkupContent() { auto raw = MarkupRawUnit(); /+ TODO +/ auto markup_sourcefile_insert_content - = raw.getInsertMarkupSourceContentRawLineArray(fn_src_insert, rgx.src_fn_find_inserts); + = raw.getInsertMarkupSourceContentRawLineArray(fn_src_insert, rgx_files.src_fn_find_inserts); debug(insert_file) { writeln(line); writeln(fn_src_insert); diff --git a/src/doc_reform/io_out/epub3.d b/src/doc_reform/io_out/epub3.d index d19545c..41d6d9d 100644 --- a/src/doc_reform/io_out/epub3.d +++ b/src/doc_reform/io_out/epub3.d @@ -58,18 +58,21 @@ template outputEPub3() { 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; mixin InternalMarkup; mixin outputXHTMLs; static auto rgx = RgxO(); + static auto rgx_xhtml = RgxXHTML(); @safe string special_characters_text(string _txt) { _txt = _txt - .replaceAll(rgx.xhtml_ampersand, "&") // "&" - .replaceAll(rgx.xhtml_quotation, """) // """ - .replaceAll(rgx.xhtml_less_than, "<") // "<" - .replaceAll(rgx.xhtml_greater_than, ">") // ">" + .replaceAll(rgx_xhtml.ampersand, "&") // "&" + .replaceAll(rgx_xhtml.quotation, """) // """ + .replaceAll(rgx_xhtml.less_than, "<") // "<" + .replaceAll(rgx_xhtml.greater_than, ">") // ">" .replaceAll(rgx.br_line, "<br />") .replaceAll(rgx.br_line_inline, "<br />") .replaceAll(rgx.br_line_spaced, "<br />\n<br />") @@ -184,6 +187,7 @@ template outputEPub3() { 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" @@ -297,8 +301,10 @@ template outputEPub3() { 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 = ["","","",""]; @@ -607,6 +613,7 @@ template outputEPub3() { 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 +/ diff --git a/src/doc_reform/io_out/html.d b/src/doc_reform/io_out/html.d index 26636ba..dd50252 100644 --- a/src/doc_reform/io_out/html.d +++ b/src/doc_reform/io_out/html.d @@ -57,6 +57,9 @@ template outputHTML() { 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; @@ -66,8 +69,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"; @@ -257,7 +262,9 @@ template outputHTML() { 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; @@ -508,11 +515,11 @@ template outputHTML() { 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; diff --git a/src/doc_reform/io_out/hub.d b/src/doc_reform/io_out/hub.d index 4c5254b..c53055d 100644 --- a/src/doc_reform/io_out/hub.d +++ b/src/doc_reform/io_out/hub.d @@ -63,10 +63,8 @@ template outputHub() { const D doc_abstraction, I doc_matters ) { - mixin spineRgxOut; mixin Msg; auto msg = Msg!()(doc_matters); - 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); @@ -201,8 +199,6 @@ template outputHubOp() { doc_reform.io_out.create_zip_file, doc_reform.io_out.paths_output; @system void outputHubOp(E,O,C)(E env, O opt_action, C config) { - mixin spineRgxOut; - static auto rgx = RgxO(); if ((opt_action.sqlite_db_drop)) { if ((opt_action.vox_gt1)) { writeln("sqlite drop db..."); diff --git a/src/doc_reform/io_out/latex.d b/src/doc_reform/io_out/latex.d index 992887d..f7dee74 100644 --- a/src/doc_reform/io_out/latex.d +++ b/src/doc_reform/io_out/latex.d @@ -325,10 +325,14 @@ template outputLaTeX() { std.outbuffer, std.uri, std.conv : to; - import doc_reform.io_out; - mixin InternalMarkup; // watch + import + doc_reform.io_out, + doc_reform.io_out.rgx, + doc_reform.io_out.rgx_latex; mixin spineRgxOut; static auto rgx = RgxO(); + mixin spineRgxLSC; + static auto rgx_sc = RgxLSC(); mixin spineLanguageCodes; auto lang = Lang(); auto paper = paperLaTeX; @@ -337,23 +341,23 @@ template outputLaTeX() { ) { string _unescape_sp_char_esc()(string _txt) { _txt = _txt - .replaceAll(rgx.latex_special_char_escaped, + .replaceAll(rgx_sc.latex_special_char_escaped, format(q"┃%s┃", "$1")) - .replaceAll(rgx.latex_special_char_escaped_braced, + .replaceAll(rgx_sc.latex_special_char_escaped_braced, format(q"┃%s┃", "$1")); return _txt; } string _unescape_fontface_esc()(string _txt) { - _txt = _txt.replaceAll(rgx.latex_identify_inline_fontface, + _txt = _txt.replaceAll(rgx_sc.latex_identify_inline_fontface, format(q"┃%s%s┃", "$1", "$2")); return _txt; } - _txt = replaceAll!(m => "\\" ~ m[1])(_txt, rgx.latex_special_char_for_escape); - _txt = replaceAll!(m => "{\\" ~ m[1] ~ "}")(_txt, rgx.latex_special_char_for_escape_and_braces); + _txt = replaceAll!(m => "\\" ~ m[1])(_txt, rgx_sc.latex_special_char_for_escape); + _txt = replaceAll!(m => "{\\" ~ m[1] ~ "}")(_txt, rgx_sc.latex_special_char_for_escape_and_braces); _txt = replaceAll!(m => "''")(_txt, rgx.quotes_open_and_close); _txt = replaceAll!(m => "$\\cdot$")(_txt, rgx.middle_dot); - _txt = replaceAll!(m => _unescape_sp_char_esc(m[0]))(_txt, rgx.latex_identify_inline_link); - _txt = replaceAll!(m => _unescape_fontface_esc(m[0]))(_txt, rgx.latex_identify_inline_fontface); + _txt = replaceAll!(m => _unescape_sp_char_esc(m[0]))(_txt, rgx_sc.latex_identify_inline_link); + _txt = replaceAll!(m => _unescape_fontface_esc(m[0]))(_txt, rgx_sc.latex_identify_inline_fontface); return _txt; } @safe string sp_char_esc(O)( @@ -461,8 +465,8 @@ template outputLaTeX() { } string _check_link(string _link) { _link = _link - .replaceFirst(rgx.latex_clean_internal_link, "") - .replaceAll(rgx.latex_special_char_for_escape_url, "\\$1"); + .replaceFirst(rgx_sc.latex_clean_internal_link, "") + .replaceAll(rgx_sc.latex_special_char_for_escape_url, "\\$1"); return _link; } if (obj.metainfo.is_a != "code") { @@ -529,7 +533,7 @@ template outputLaTeX() { string _tex_para; _tex_para = q"┃%s┃"; _txt = format(_tex_para, - _txt.replaceAll(rgx.latex_clean_bookindex_linebreak, "\n") ~ "\n\\brln\n" + _txt.replaceAll(rgx_sc.latex_clean_bookindex_linebreak, "\n") ~ "\n\\brln\n" ); } return _txt; @@ -1381,7 +1385,6 @@ template outputLaTeX() { } template outputLaTeXstyInit() { import doc_reform.io_out; - mixin spineRgxOut; auto paper = paperLaTeX; void writeOutputLaTeXstyStatic( string latex_sty, diff --git a/src/doc_reform/io_out/odt.d b/src/doc_reform/io_out/odt.d index c5fb469..1cde2d4 100644 --- a/src/doc_reform/io_out/odt.d +++ b/src/doc_reform/io_out/odt.d @@ -50,7 +50,10 @@ +/ module doc_reform.io_out.odt; template formatODT() { - import doc_reform.io_out; + import + doc_reform.io_out, + doc_reform.io_out.rgx, + doc_reform.io_out.rgx_xhtml; import std.digest.sha, std.file, @@ -63,8 +66,10 @@ template formatODT() { doc_reform.io_out.xmls, doc_reform.io_out.xmls_css; mixin spineRgxOut; + mixin spineRgxXHTML; struct formatODT { static auto rgx = RgxO(); + static auto rgx_xhtml = RgxXHTML(); @safe string _tags(O)(const O obj) { string _tags = ""; if (obj.tags.anchor_tags.length > 0) { @@ -107,6 +112,7 @@ template formatODT() { } @safe string _footnotes()(string _txt) { static auto rgx = RgxO(); + static auto rgx_xhtml = RgxXHTML(); _txt = _txt.replaceAll( rgx.inline_notes_al_regular_number_note, format(q"┃<text:note text:id="ftn%s" text:note-class="footnote"> @@ -274,10 +280,10 @@ template formatODT() { } @safe string _special_characters(O)(string _txt, const O obj) { _txt = _txt - .replaceAll(rgx.xhtml_ampersand, "&") - .replaceAll(rgx.xhtml_quotation, """) - .replaceAll(rgx.xhtml_less_than, "<") - .replaceAll(rgx.xhtml_greater_than, ">") + .replaceAll(rgx_xhtml.ampersand, "&") + .replaceAll(rgx_xhtml.quotation, """) + .replaceAll(rgx_xhtml.less_than, "<") + .replaceAll(rgx_xhtml.greater_than, ">") .replaceAll(rgx.nbsp_char, " "); return _txt; } @@ -640,7 +646,10 @@ template formatODT() { } } template outputODT() { - import doc_reform.io_out; + import + doc_reform.io_out, + doc_reform.io_out.rgx, + doc_reform.io_out.rgx_xhtml; import std.digest.sha, std.file, @@ -654,7 +663,9 @@ template outputODT() { doc_reform.io_out.xmls_css; mixin InternalMarkup; mixin spineRgxOut; + mixin spineRgxXHTML; static auto rgx = RgxO(); + static auto rgx_xhtml = RgxXHTML(); // mixin outputXmlODT; @safe string odt_head(I)(I doc_matters) { string _has_tables = format(q"┃ diff --git a/src/doc_reform/io_out/package.d b/src/doc_reform/io_out/package.d index b6932ea..0a75f98 100644 --- a/src/doc_reform/io_out/package.d +++ b/src/doc_reform/io_out/package.d @@ -67,5 +67,4 @@ public import doc_reform.share.defaults, doc_reform.io_in.paths_source, doc_reform.io_out.defaults, - doc_reform.io_out.paths_output, - doc_reform.io_out.rgx; + doc_reform.io_out.paths_output; diff --git a/src/doc_reform/io_out/paths_output.d b/src/doc_reform/io_out/paths_output.d index fc31711..471c966 100644 --- a/src/doc_reform/io_out/paths_output.d +++ b/src/doc_reform/io_out/paths_output.d @@ -57,7 +57,8 @@ import std.path, std.regex, std.stdio; -import doc_reform.meta.rgx; +import + doc_reform.meta.rgx_files; template spineOutPaths() { auto spineOutPaths()( string output_pth_root, @@ -149,8 +150,6 @@ template spineOutPathsFnPd() { } template spineDocRootTreeHTML() { - mixin spineRgxIn; - static auto rgx = RgxI(); auto spineDocRootTreeHTML()(string lng) { auto lng_pth = spineOutPaths!()("", lng); string base_dir = "html"; @@ -209,8 +208,6 @@ template spineDocRootTreeHTML() { } } template spinePathsHTML() { - mixin spineRgxIn; - static auto rgx = RgxI(); auto spinePathsHTML()( string output_path_root, string lng, @@ -270,8 +267,6 @@ template spinePathsHTML() { } template spineUrlsHTML() { import std.format; - mixin spineRgxIn; - static auto rgx = RgxI(); auto spineUrlsHTML()( string url_doc_root, string lng, @@ -371,8 +366,6 @@ template spineUrlsHTML() { } } template spinePathsEPUB() { - mixin spineRgxIn; - static auto rgx = RgxI(); auto spinePathsEPUB()( string output_pth_root, string lng, @@ -477,8 +470,6 @@ template spinePathsEPUB() { } template spinePathsODT() { import std.conv; - mixin spineRgxIn; - static auto rgx = RgxI(); auto spinePathsODT(M)( M doc_matters, ) { @@ -541,8 +532,6 @@ template spinePathsODT() { } } template spinePathsPDF() { - mixin spineRgxIn; - static auto rgx = RgxI(); auto spinePathsPDF(M)( M doc_matters, ) { @@ -565,8 +554,6 @@ template spinePathsPDF() { } } template spinePathsLaTeX() { - mixin spineRgxIn; - static auto rgx = RgxI(); auto spinePathsLaTeX(M)( M doc_matters, ) { @@ -636,8 +623,6 @@ template spinePathsLaTeXsty() { } } template spinePathsSQLiteDiscrete() { - mixin spineRgxIn; - static auto rgx = RgxI(); auto spinePathsSQLiteDiscrete()( string output_pth_root, string lng, @@ -662,8 +647,6 @@ template spinePathsSQLiteDiscrete() { } } template spinePathsSQLite() { - mixin spineRgxIn; - static auto rgx = RgxI(); auto spinePathsSQLite()( string db_name, string output_pth_root, diff --git a/src/doc_reform/io_out/rgx.d b/src/doc_reform/io_out/rgx.d index 8369735..943643c 100644 --- a/src/doc_reform/io_out/rgx.d +++ b/src/doc_reform/io_out/rgx.d @@ -68,8 +68,7 @@ static template spineRgxOut() { static src_pth_contents = ctRegex!(`^(?P<path>[/]?(?:[a-zA-Z0-9._-]+/)*)(?P<filename>[a-zA-Z0-9][a-zA-Z0-9._-]*)/pod[.]manifest$`); static src_pth_zip = ctRegex!(`^(?P<path>[/]?(?:[a-zA-Z0-9._-]+/)*)(?P<filename>[a-zA-Z0-9._-]+[.]zip)$`); static src_pth_types = ctRegex!(`^(?P<path>[/]?[a-zA-Z0-9._-]+/)*(?P<gotfile>(?P<filename>[a-zA-Z0-9._-]+[.]ss[tm])|(?P<filelist>[a-zA-Z0-9._-]+/pod[.]manifest)|(?P<filezip>[a-zA-Z0-9._-]+[.]zip))$`); - static src_fn = - ctRegex!(`^([/]?(?:[a-zA-Z0-9._-]+/)*)(?P<fn_src>(?P<fn_base>[a-zA-Z0-9._-]+)[.](?P<fn_src_suffix>ss[tm]))$`); + static src_fn = ctRegex!(`^([/]?(?:[a-zA-Z0-9._-]+/)*)(?P<fn_src>(?P<fn_base>[a-zA-Z0-9._-]+)[.](?P<fn_src_suffix>ss[tm]))$`); static src_fn_master = ctRegex!(`^(?P<path>/?(?:[a-zA-Z0-9._-]+/)*)(?P<filename>[a-zA-Z0-9._-]+[.]ssm)$`); static src_fn_find_inserts = ctRegex!(`^(?P<path>/?(?:[a-zA-Z0-9._-]+/)*)(?P<filename>[a-zA-Z0-9._-]+[.]ss[im])$`); static insert_src_fn_ssi_or_sst = ctRegex!(`^<<\s*(?P<path>[a-zA-Z0-9._-]+/)*(?P<filename>[a-zA-Z0-9._-]+[.]ss[ti])$`); @@ -119,34 +118,19 @@ static template spineRgxOut() { static mark_internal_site_lnk = ctRegex!(`¤`, "mg"); static quotation_mark_sql_insert_delimiter = ctRegex!("[']", "mg"); /+ inline markup font face mod +/ - static inline_emphasis = ctRegex!(`[*]┨(?P<text>.+?)┣[*]`, "mg"); - static inline_bold = ctRegex!(`[!]┨(?P<text>.+?)┣[!]`, "mg"); - static inline_underscore = ctRegex!(`[_]┨(?P<text>.+?)┣[_]`, "mg"); - static inline_italics = ctRegex!(`[/]┨(?P<text>.+?)┣[/]`, "mg"); - static inline_superscript = ctRegex!(`\^┨(?P<text>.+?)┣\^`, "mg"); - static inline_subscript = ctRegex!(`[,]┨(?P<text>.+?)┣[,]`, "mg"); - static inline_strike = ctRegex!(`[-]┨(?P<text>.+?)┣[-]`, "mg"); - static inline_insert = ctRegex!(`[+]┨(?P<text>.+?)┣[+]`, "mg"); - static inline_mono = ctRegex!(`[■]┨(?P<text>.+?)┣[■]`, "mg"); - static inline_cite = ctRegex!(`[‖]┨(?P<text>.+?)┣[‖]`, "mg"); + static inline_emphasis = ctRegex!(`⑆[*]┨(?P<text>.+?)┣[*]`, "mg"); + static inline_bold = ctRegex!(`⑆[!]┨(?P<text>.+?)┣[!]`, "mg"); + static inline_underscore = ctRegex!(`⑆[_]┨(?P<text>.+?)┣[_]`, "mg"); + static inline_italics = ctRegex!(`⑆[/]┨(?P<text>.+?)┣[/]`, "mg"); + static inline_superscript = ctRegex!(`⑆\^┨(?P<text>.+?)┣\^`, "mg"); + static inline_subscript = ctRegex!(`⑆[,]┨(?P<text>.+?)┣[,]`, "mg"); + static inline_strike = ctRegex!(`⑆[-]┨(?P<text>.+?)┣[-]`, "mg"); + static inline_insert = ctRegex!(`⑆[+]┨(?P<text>.+?)┣[+]`, "mg"); + static inline_mono = ctRegex!(`⑆[■]┨(?P<text>.+?)┣[■]`, "mg"); + static inline_cite = ctRegex!(`⑆[‖]┨(?P<text>.+?)┣[‖]`, "mg"); /+ table delimiters +/ static table_delimiter_col = ctRegex!("[ ]*[┊][ ]*", "mg"); static table_delimiter_row = ctRegex!("[ ]*\n", "mg"); - static xhtml_ampersand = ctRegex!(`[&]`, "m"); // & - static xhtml_quotation = ctRegex!(`["]`, "m"); // " - static xhtml_less_than = ctRegex!(`[<]`, "m"); // < - static xhtml_greater_than = ctRegex!(`[>]`, "m"); // > - static xhtml_line_break = ctRegex!(` [\\]{2}`, "m"); // <br /> - static latex_special_char = ctRegex!(`([%${}_#&\\])`); - static latex_special_char_for_escape = ctRegex!(`([%${}_#\\])`); - static latex_special_char_for_escape_and_braces = ctRegex!(`([&])`); - static latex_special_char_for_escape_url = ctRegex!(`([%])`); - static latex_special_char_escaped = ctRegex!(`\\([%${}_#\\])`); - static latex_special_char_escaped_braced = ctRegex!(`[{]\\([&])[}]`); - static latex_identify_inline_link = ctRegex!(`┥.+?┝┤\S+?├`, "mg"); - static latex_identify_inline_fontface = ctRegex!(`\\([_#$]┨.+?┣)\\([_#$])`, "mg"); - static latex_clean_internal_link = ctRegex!(`^(?:#|¤\S+?#)`, "m"); - static latex_clean_bookindex_linebreak = ctRegex!(`\s*\\\\\\\\\s*`, "m"); /+ paragraph operators +/ static grouped_para_indent_1 = ctRegex!(`^_1[ ]`, "m"); static grouped_para_indent_2 = ctRegex!(`^_2[ ]`, "m"); diff --git a/src/doc_reform/io_out/rgx_latex.d b/src/doc_reform/io_out/rgx_latex.d new file mode 100644 index 0000000..25b9c60 --- /dev/null +++ b/src/doc_reform/io_out/rgx_latex.d @@ -0,0 +1,68 @@ +/+ +- Name: Spine, Doc Reform [a part of] + - Description: documents, structuring, processing, publishing, search + - static content generator + + - Author: Ralph Amissah + [ralph.amissah@gmail.com] + + - Copyright: (C) 2015 - 2022 Ralph Amissah, All Rights + Reserved. + + - License: AGPL 3 or later: + + Spine (SiSU), a framework for document structuring, publishing and + search + + Copyright (C) Ralph Amissah + + This program is free software: you can redistribute it and/or modify it + under the terms of the GNU AFERO General Public License as published by the + Free Software Foundation, either version 3 of the License, or (at your + option) any later version. + + This program is distributed in the hope that it will be useful, but WITHOUT + ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for + more details. + + You should have received a copy of the GNU General Public License along with + this program. If not, see [https://www.gnu.org/licenses/]. + + If you have Internet connection, the latest version of the AGPL should be + available at these locations: + [https://www.fsf.org/licensing/licenses/agpl.html] + [https://www.gnu.org/licenses/agpl.html] + + - Spine (by Doc Reform, related to SiSU) uses standard: + - docReform markup syntax + - standard SiSU markup syntax with modified headers and minor modifications + - docReform object numbering + - standard SiSU object citation numbering & system + + - Homepages: + [https://www.doc_reform.org] + [https://www.sisudoc.org] + + - Git + [https://git.sisudoc.org/projects/?p=software/spine.git;a=summary] + ++/ +/++ + regex: regular expressions used in sisu document parser ++/ +module doc_reform.io_out.rgx_latex; +static template spineRgxLSC() { + static struct RgxLSC { + static latex_special_char = ctRegex!(`([%${}_#&\\])`); + static latex_special_char_for_escape = ctRegex!(`([%${}_#\\])`); + static latex_special_char_for_escape_and_braces = ctRegex!(`([&])`); + static latex_special_char_for_escape_url = ctRegex!(`([%])`); + static latex_special_char_escaped = ctRegex!(`\\([%${}_#\\])`); + static latex_special_char_escaped_braced = ctRegex!(`[{]\\([&])[}]`); + static latex_identify_inline_link = ctRegex!(`┥.+?┝┤\S+?├`, "mg"); + static latex_identify_inline_fontface = ctRegex!(`\\([_#$]┨.+?┣)\\([_#$])`, "mg"); + static latex_clean_internal_link = ctRegex!(`^(?:#|¤\S+?#)`, "m"); + static latex_clean_bookindex_linebreak = ctRegex!(`\s*\\\\\\\\\s*`, "m"); + } +} diff --git a/src/doc_reform/io_out/rgx_xhtml.d b/src/doc_reform/io_out/rgx_xhtml.d new file mode 100644 index 0000000..2d9aab1 --- /dev/null +++ b/src/doc_reform/io_out/rgx_xhtml.d @@ -0,0 +1,63 @@ +/+ +- Name: Spine, Doc Reform [a part of] + - Description: documents, structuring, processing, publishing, search + - static content generator + + - Author: Ralph Amissah + [ralph.amissah@gmail.com] + + - Copyright: (C) 2015 - 2022 Ralph Amissah, All Rights + Reserved. + + - License: AGPL 3 or later: + + Spine (SiSU), a framework for document structuring, publishing and + search + + Copyright (C) Ralph Amissah + + This program is free software: you can redistribute it and/or modify it + under the terms of the GNU AFERO General Public License as published by the + Free Software Foundation, either version 3 of the License, or (at your + option) any later version. + + This program is distributed in the hope that it will be useful, but WITHOUT + ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for + more details. + + You should have received a copy of the GNU General Public License along with + this program. If not, see [https://www.gnu.org/licenses/]. + + If you have Internet connection, the latest version of the AGPL should be + available at these locations: + [https://www.fsf.org/licensing/licenses/agpl.html] + [https://www.gnu.org/licenses/agpl.html] + + - Spine (by Doc Reform, related to SiSU) uses standard: + - docReform markup syntax + - standard SiSU markup syntax with modified headers and minor modifications + - docReform object numbering + - standard SiSU object citation numbering & system + + - Homepages: + [https://www.doc_reform.org] + [https://www.sisudoc.org] + + - Git + [https://git.sisudoc.org/projects/?p=software/spine.git;a=summary] + ++/ +/++ + regex: regular expressions used in sisu document parser ++/ +module doc_reform.io_out.rgx_xhtml; +static template spineRgxXHTML() { + static struct RgxXHTML { + static ampersand = ctRegex!(`[&]`, "m"); // & + static quotation = ctRegex!(`["]`, "m"); // " + static less_than = ctRegex!(`[<]`, "m"); // < + static greater_than = ctRegex!(`[>]`, "m"); // > + static line_break = ctRegex!(` [\\]{2}`, "m"); // <br /> + } +} diff --git a/src/doc_reform/io_out/source_pod.d b/src/doc_reform/io_out/source_pod.d index 14d63d7..0f9aef7 100644 --- a/src/doc_reform/io_out/source_pod.d +++ b/src/doc_reform/io_out/source_pod.d @@ -50,7 +50,9 @@ +/ module doc_reform.io_out.source_pod; template spinePod() { - import doc_reform.io_out; + import + doc_reform.meta.rgx_files, + doc_reform.io_out; import std.digest.sha, std.file, @@ -64,15 +66,15 @@ template spinePod() { debug(asserts) { // static assert(is(typeof(doc_matters) == tuple)); } - mixin spineRgxOut; + mixin spineRgxFiles; 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 = RgxO(); - assert (doc_matters.src.filename.match(rgx.src_fn)); + static auto rgx_files = RgxFiles(); + assert (doc_matters.src.filename.match(rgx_files.src_fn)); @system auto pod_archive(Z)( string _source_type, string _data_in, 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, "&") - .replaceAll(rgx.xhtml_quotation, """) - .replaceAll(rgx.xhtml_less_than, "<") - .replaceAll(rgx.xhtml_greater_than, ">") + .replaceAll(rgx_xhtml.ampersand, "&") + .replaceAll(rgx_xhtml.quotation, """) + .replaceAll(rgx_xhtml.less_than, "<") + .replaceAll(rgx_xhtml.greater_than, ">") .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, "&") - .replaceAll(rgx.xhtml_quotation, """) - .replaceAll(rgx.xhtml_less_than, "<") - .replaceAll(rgx.xhtml_greater_than, ">") + .replaceAll(rgx_xhtml.ampersand, "&") + .replaceAll(rgx_xhtml.quotation, """) + .replaceAll(rgx_xhtml.less_than, "<") + .replaceAll(rgx_xhtml.greater_than, ">") .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, "&") - .replaceAll(rgx.xhtml_quotation, """) - .replaceAll(rgx.xhtml_less_than, "<") - .replaceAll(rgx.xhtml_greater_than, ">") + .replaceAll(rgx_xhtml.ampersand, "&") + .replaceAll(rgx_xhtml.quotation, """) + .replaceAll(rgx_xhtml.less_than, "<") + .replaceAll(rgx_xhtml.greater_than, ">") .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; diff --git a/src/doc_reform/io_out/xmls.d b/src/doc_reform/io_out/xmls.d index 0b0dce7..131dbb6 100644 --- a/src/doc_reform/io_out/xmls.d +++ b/src/doc_reform/io_out/xmls.d @@ -57,12 +57,17 @@ template outputXHTMLs() { 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; mixin spineRgxOut; + mixin spineRgxXHTML; struct outputXHTMLs { static auto rgx = RgxO(); + static auto rgx_xhtml = RgxXHTML(); @safe string div_delimit( string part, return ref string previous_part @@ -95,10 +100,10 @@ template outputXHTMLs() { } @safe string special_characters_text(string _txt) { _txt = _txt - .replaceAll(rgx.xhtml_ampersand, "&") // "&" - .replaceAll(rgx.xhtml_quotation, """) // """ - .replaceAll(rgx.xhtml_less_than, "<") // "<" - .replaceAll(rgx.xhtml_greater_than, ">") // ">" + .replaceAll(rgx_xhtml.ampersand, "&") // "&" + .replaceAll(rgx_xhtml.quotation, """) // """ + .replaceAll(rgx_xhtml.less_than, "<") // "<" + .replaceAll(rgx_xhtml.greater_than, ">") // ">" .replaceAll(rgx.br_line, "<br />") .replaceAll(rgx.br_line_inline, "<br />") .replaceAll(rgx.br_line_spaced, "<br />\n<br />") @@ -161,7 +166,7 @@ template outputXHTMLs() { } if (!(obj.metainfo.is_a == "code")) { _txt = (_txt) - .replaceAll(rgx.xhtml_line_break, "<br />"); + .replaceAll(rgx_xhtml.line_break, "<br />"); } return _txt; } diff --git a/src/doc_reform/meta/conf_make_meta_structs.d b/src/doc_reform/meta/conf_make_meta_structs.d index 966e8d0..c6e7692 100644 --- a/src/doc_reform/meta/conf_make_meta_structs.d +++ b/src/doc_reform/meta/conf_make_meta_structs.d @@ -61,9 +61,12 @@ import std.conv : to; import doc_reform.meta.defaults, + doc_reform.meta.rgx_yaml, doc_reform.meta.rgx; mixin spineRgxIn; static auto rgx = RgxI(); +mixin spineRgxYamlTags; +static auto rgx_y = RgxYaml(); mixin InternalMarkup; static auto mkup = InlineMarkup(); @safe string url_markup(string line) { diff --git a/src/doc_reform/meta/conf_make_meta_yaml.d b/src/doc_reform/meta/conf_make_meta_yaml.d index caf560f..fa87f9c 100644 --- a/src/doc_reform/meta/conf_make_meta_yaml.d +++ b/src/doc_reform/meta/conf_make_meta_yaml.d @@ -68,6 +68,7 @@ template contentYAMLtoSpineStruct() { import doc_reform.meta.conf_make_meta_structs, doc_reform.meta.defaults, + doc_reform.meta.rgx_yaml, doc_reform.meta.rgx; ConfComposite _struct_composite; @system auto contentYAMLtoSpineStruct(C,Y,M,O,Cfg)( @@ -80,6 +81,8 @@ template contentYAMLtoSpineStruct() { ) { mixin spineRgxIn; static auto rgx = RgxI(); + mixin spineRgxYamlTags; + static auto rgx_y = RgxYaml(); string check_input_markup()( string _txt, ) { @@ -107,11 +110,11 @@ template contentYAMLtoSpineStruct() { : _cfg.http_request_type; if (("webserv" in _yaml && _yaml["webserv"].type.sequence) && (_yaml["webserv"].type.mapping - && _yaml["webserv"].tag.match(rgx.yaml_tag_is_map)) + && _yaml["webserv"].tag.match(rgx_y.yaml_tag_is_map)) ) { if ("http" in _yaml["webserv"] && _yaml["webserv"]["http"].type.string - && _yaml["webserv"]["http"].tag.match(rgx.yaml_tag_is_str) + && _yaml["webserv"]["http"].tag.match(rgx_y.yaml_tag_is_str) ) { _struct_composite.conf.w_srv_http = _yaml["webserv"]["http"].get!string; @@ -128,11 +131,11 @@ template contentYAMLtoSpineStruct() { : _cfg.cgi_search_form_title; if (("webserv" in _yaml && _yaml["webserv"].type.sequence) && (_yaml["webserv"].type.mapping - && _yaml["webserv"].tag.match(rgx.yaml_tag_is_map)) + && _yaml["webserv"].tag.match(rgx_y.yaml_tag_is_map)) ) { if ("cgi_search_form_title" in _yaml["webserv"] && _yaml["webserv"]["cgi_search_form_title"].type.string - && _yaml["webserv"]["cgi_search_form_title"].tag.match(rgx.yaml_tag_is_str) + && _yaml["webserv"]["cgi_search_form_title"].tag.match(rgx_y.yaml_tag_is_str) ) { _struct_composite.conf.w_srv_cgi_search_form_title = _yaml["webserv"]["cgi_search_form_title"].get!string; @@ -149,11 +152,11 @@ template contentYAMLtoSpineStruct() { : _cfg.cgi_filename; if (("webserv" in _yaml && _yaml["webserv"].type.sequence) && (_yaml["webserv"].type.mapping - && _yaml["webserv"].tag.match(rgx.yaml_tag_is_map)) + && _yaml["webserv"].tag.match(rgx_y.yaml_tag_is_map)) ) { if ("cgi_search_script" in _yaml["webserv"] && _yaml["webserv"]["cgi_search_script"].type.string - && _yaml["webserv"]["cgi_search_script"].tag.match(rgx.yaml_tag_is_str) + && _yaml["webserv"]["cgi_search_script"].tag.match(rgx_y.yaml_tag_is_str) ) { _struct_composite.conf.w_srv_cgi_search_script = _yaml["webserv"]["cgi_search_script"].get!string; @@ -170,11 +173,11 @@ template contentYAMLtoSpineStruct() { : _cfg.db_sqlite_filename; if (("webserv" in _yaml && _yaml["webserv"].type.sequence) && (_yaml["webserv"].type.mapping - && _yaml["webserv"].tag.match(rgx.yaml_tag_is_map)) + && _yaml["webserv"].tag.match(rgx_y.yaml_tag_is_map)) ) { if ("db_sqlite_filename" in _yaml["webserv"] && _yaml["webserv"]["db_sqlite_filename"].type.string - && _yaml["webserv"]["db_sqlite_filename"].tag.match(rgx.yaml_tag_is_str) + && _yaml["webserv"]["db_sqlite_filename"].tag.match(rgx_y.yaml_tag_is_str) ) { _struct_composite.conf.w_srv_db_sqlite_filename = _yaml["webserv"]["db_sqlite_filename"].get!string; @@ -191,11 +194,11 @@ template contentYAMLtoSpineStruct() { : _cfg.db_sqlite_path; if (("webserv" in _yaml && _yaml["webserv"].type.sequence) && (_yaml["webserv"].type.mapping - && _yaml["webserv"].tag.match(rgx.yaml_tag_is_map)) + && _yaml["webserv"].tag.match(rgx_y.yaml_tag_is_map)) ) { if ("db_sqlite_path" in _yaml["webserv"] && _yaml["webserv"]["db_sqlite_path"].type.string - && _yaml["webserv"]["db_sqlite_path"].tag.match(rgx.yaml_tag_is_str) + && _yaml["webserv"]["db_sqlite_path"].tag.match(rgx_y.yaml_tag_is_str) ) { _struct_composite.conf.w_srv_db_sqlite_path = _yaml["webserv"]["db_sqlite_path"].get!string; @@ -212,11 +215,11 @@ template contentYAMLtoSpineStruct() { : _cfg.www_url_doc_root; if (("webserv" in _yaml && _yaml["webserv"].type.sequence) && (_yaml["webserv"].type.mapping - && _yaml["webserv"].tag.match(rgx.yaml_tag_is_map)) + && _yaml["webserv"].tag.match(rgx_y.yaml_tag_is_map)) ) { if ("cgi_action" in _yaml["webserv"] && _yaml["webserv"]["cgi_action"].type.string - && _yaml["webserv"]["cgi_action"].tag.match(rgx.yaml_tag_is_str) + && _yaml["webserv"]["cgi_action"].tag.match(rgx_y.yaml_tag_is_str) ) { _struct_composite.conf.w_srv_cgi_action = _yaml["webserv"]["cgi_action"].get!string; @@ -239,14 +242,14 @@ template contentYAMLtoSpineStruct() { : _cfg.processing_path_doc_root; if (("webserv" in _yaml && _yaml["webserv"].type.sequence) && (_yaml["webserv"].type.mapping - && _yaml["webserv"].tag.match(rgx.yaml_tag_is_map)) + && _yaml["webserv"].tag.match(rgx_y.yaml_tag_is_map)) ) { if (_yaml["output"].type.mapping - && _yaml["output"].tag.match(rgx.yaml_tag_is_map) + && _yaml["output"].tag.match(rgx_y.yaml_tag_is_map) ) { if ("path" in _yaml["output"] && _yaml["output"]["path"].type.string - && _yaml["output"]["path"].tag.match(rgx.yaml_tag_is_str) + && _yaml["output"]["path"].tag.match(rgx_y.yaml_tag_is_str) ) { if (_manifested.output.path == _manifested.env.pwd && _yaml["output"]["path"].get!string.length > 0 @@ -267,11 +270,11 @@ template contentYAMLtoSpineStruct() { : _cfg.processing_path_doc_root; if (("webserv" in _yaml && _yaml["webserv"].type.sequence) && (_yaml["webserv"].type.mapping - && _yaml["webserv"].tag.match(rgx.yaml_tag_is_map)) + && _yaml["webserv"].tag.match(rgx_y.yaml_tag_is_map)) ) { if ("data_root_path" in _yaml["webserv"] && _yaml["webserv"]["data_root_path"].type.string - && _yaml["webserv"]["data_root_path"].tag.match(rgx.yaml_tag_is_str) + && _yaml["webserv"]["data_root_path"].tag.match(rgx_y.yaml_tag_is_str) ) { _struct_composite.conf.w_srv_data_root_path = _yaml["webserv"]["data_root_path"].get!string; @@ -289,11 +292,11 @@ template contentYAMLtoSpineStruct() { : _cfg.cgi_bin_root; if (("webserv" in _yaml && _yaml["webserv"].type.sequence) && (_yaml["webserv"].type.mapping - && _yaml["webserv"].tag.match(rgx.yaml_tag_is_map)) + && _yaml["webserv"].tag.match(rgx_y.yaml_tag_is_map)) ) { if ("cgi_bin_path" in _yaml["webserv"] && _yaml["webserv"]["cgi_bin_path"].type.string - && _yaml["webserv"]["cgi_bin_path"].tag.match(rgx.yaml_tag_is_str) + && _yaml["webserv"]["cgi_bin_path"].tag.match(rgx_y.yaml_tag_is_str) ) { _struct_composite.conf.w_srv_cgi_bin_path = _yaml["webserv"]["cgi_bin_path"].get!string; @@ -304,11 +307,11 @@ template contentYAMLtoSpineStruct() { = ""; if (("webserv" in _yaml && _yaml["webserv"].type.sequence) && (_yaml["webserv"].type.mapping - && _yaml["webserv"].tag.match(rgx.yaml_tag_is_map)) + && _yaml["webserv"].tag.match(rgx_y.yaml_tag_is_map)) ) { if ("data_root_part" in _yaml["webserv"] && _yaml["webserv"]["data_root_part"].type.string - && _yaml["webserv"]["data_root_part"].tag.match(rgx.yaml_tag_is_str) + && _yaml["webserv"]["data_root_part"].tag.match(rgx_y.yaml_tag_is_str) ) { _struct_composite.conf.w_srv_data_root_part = _yaml["webserv"]["data_root_part"].get!string; } @@ -318,11 +321,11 @@ template contentYAMLtoSpineStruct() { = "image"; if (("webserv" in _yaml && _yaml["webserv"].type.sequence) && (_yaml["webserv"].type.mapping - && _yaml["webserv"].tag.match(rgx.yaml_tag_is_map)) + && _yaml["webserv"].tag.match(rgx_y.yaml_tag_is_map)) ) { if ("images_root_part" in _yaml["webserv"] && _yaml["webserv"]["images_root_part"].type.string - && _yaml["webserv"]["images_root_part"].tag.match(rgx.yaml_tag_is_str) + && _yaml["webserv"]["images_root_part"].tag.match(rgx_y.yaml_tag_is_str) ) { _struct_composite.conf.w_srv_images_root_part = _yaml["webserv"]["images_root_part"].get!string; } @@ -332,31 +335,31 @@ template contentYAMLtoSpineStruct() { if (("webserv" in _yaml && _yaml["webserv"].type.sequence) && (_yaml["webserv"].type.mapping - && _yaml["webserv"].tag.match(rgx.yaml_tag_is_map)) + && _yaml["webserv"].tag.match(rgx_y.yaml_tag_is_map)) ) { // cannot be used as is with opt_action FIX look at remaining, decide what to do later if ("data_http" in _yaml["webserv"] && _yaml["webserv"]["data_http"].type.string - && _yaml["webserv"]["data_http"].tag.match(rgx.yaml_tag_is_str) + && _yaml["webserv"]["data_http"].tag.match(rgx_y.yaml_tag_is_str) ) { _struct_composite.conf.w_srv_data_http = _yaml["webserv"]["data_http"].get!string; } // if (_opt_action.*.length > 0) { if ("cgi_http" in _yaml["webserv"] && _yaml["webserv"]["cgi_http"].type.string - && _yaml["webserv"]["cgi_http"].tag.match(rgx.yaml_tag_is_str) + && _yaml["webserv"]["cgi_http"].tag.match(rgx_y.yaml_tag_is_str) ) { _struct_composite.conf.w_srv_cgi_http = _yaml["webserv"]["cgi_http"].get!string; } // if (_opt_action.*.length > 0) { if ("host" in _yaml["webserv"] && _yaml["webserv"]["host"].type.string - && _yaml["webserv"]["host"].tag.match(rgx.yaml_tag_is_str) + && _yaml["webserv"]["host"].tag.match(rgx_y.yaml_tag_is_str) ) { _struct_composite.conf.w_srv_host = _yaml["webserv"]["host"].get!string; } if ("data_root_url" in _yaml["webserv"] && _yaml["webserv"]["data_root_url"].type.string - && _yaml["webserv"]["data_root_url"].tag.match(rgx.yaml_tag_is_str) + && _yaml["webserv"]["data_root_url"].tag.match(rgx_y.yaml_tag_is_str) ) { _struct_composite.conf.w_srv_data_root_url = _yaml["webserv"]["data_root_url"].get!string; _struct_composite.conf.w_srv_data_root_url_html = @@ -373,7 +376,7 @@ template contentYAMLtoSpineStruct() { } if ("cgi_host" in _yaml["webserv"] && _yaml["webserv"]["cgi_host"].type.string - && _yaml["webserv"]["cgi_host"].tag.match(rgx.yaml_tag_is_str) + && _yaml["webserv"]["cgi_host"].tag.match(rgx_y.yaml_tag_is_str) ) { _struct_composite.conf.w_srv_cgi_host = _yaml["webserv"]["cgi_host"].get!string; } else { // composite construct @@ -381,25 +384,25 @@ template contentYAMLtoSpineStruct() { } if ("cgi_bin_subpath" in _yaml["webserv"] && _yaml["webserv"]["cgi_bin_subpath"].type.string - && _yaml["webserv"]["cgi_bin_subpath"].tag.match(rgx.yaml_tag_is_str) + && _yaml["webserv"]["cgi_bin_subpath"].tag.match(rgx_y.yaml_tag_is_str) ) { _struct_composite.conf.w_srv_cgi_bin_subpath = _yaml["webserv"]["cgi_bin_subpath"].get!string; } if ("cgi_port" in _yaml["webserv"] && _yaml["webserv"]["cgi_port"].type.string - && _yaml["webserv"]["cgi_port"].tag.match(rgx.yaml_tag_is_str) + && _yaml["webserv"]["cgi_port"].tag.match(rgx_y.yaml_tag_is_str) ) { _struct_composite.conf.w_srv_cgi_port = _yaml["webserv"]["cgi_port"].get!string; } if ("cgi_user" in _yaml["webserv"] && _yaml["webserv"]["cgi_user"].type.string - && _yaml["webserv"]["cgi_user"].tag.match(rgx.yaml_tag_is_str) + && _yaml["webserv"]["cgi_user"].tag.match(rgx_y.yaml_tag_is_str) ) { _struct_composite.conf.w_srv_cgi_user = _yaml["webserv"]["cgi_user"].get!string; } if ("cgi_bin_url" in _yaml["webserv"] && _yaml["webserv"]["cgi_bin_url"].type.string - && _yaml["webserv"]["cgi_bin_url"].tag.match(rgx.yaml_tag_is_str) + && _yaml["webserv"]["cgi_bin_url"].tag.match(rgx_y.yaml_tag_is_str) ) { _struct_composite.conf.w_srv_cgi_bin_url = _yaml["webserv"]["cgi_bin_url"].get!string; } else { @@ -415,7 +418,7 @@ template contentYAMLtoSpineStruct() { } // if ("cgi_file_links" in _yaml["webserv"] // && _yaml["webserv"]["cgi_file_links"].type.string - // && _yaml["webserv"]["cgi_file_links"].tag.match(rgx.yaml_tag_is_str) + // && _yaml["webserv"]["cgi_file_links"].tag.match(rgx_y.yaml_tag_is_str) // ) { // _struct_composite.conf.w_srv_cgi_file_links = _yaml["webserv"]["cgi_file_links"].get!string; // } @@ -425,11 +428,11 @@ template contentYAMLtoSpineStruct() { && _yaml["processing"].type.sequence ) { if (_yaml["processing"].type.mapping - && _yaml["processing"].tag.match(rgx.yaml_tag_is_map) + && _yaml["processing"].tag.match(rgx_y.yaml_tag_is_map) ) { if ("concord_max" in _yaml["processing"] && _yaml["processing"]["concord_max"].type.string - && _yaml["processing"]["concord_max"].tag.match(rgx.yaml_tag_is_str) + && _yaml["processing"]["concord_max"].tag.match(rgx_y.yaml_tag_is_str) ) { _struct_composite.conf.processing_concord_max = _yaml["processing"]["concord_max"].get!string; } @@ -439,65 +442,65 @@ template contentYAMLtoSpineStruct() { && _yaml["flag"].type.sequence ) { if (_yaml["flag"].type.mapping - && _yaml["flag"].tag.match(rgx.yaml_tag_is_map) + && _yaml["flag"].tag.match(rgx_y.yaml_tag_is_map) ) { if ("act0" in _yaml["flag"] && _yaml["flag"]["act0"].type.string - && _yaml["flag"]["act0"].tag.match(rgx.yaml_tag_is_str) + && _yaml["flag"]["act0"].tag.match(rgx_y.yaml_tag_is_str) ) { _struct_composite.conf.flag_act0 = _yaml["flag"]["act0"].get!string; } if ("act1" in _yaml["flag"] && _yaml["flag"]["act1"].type.string - && _yaml["flag"]["act1"].tag.match(rgx.yaml_tag_is_str) + && _yaml["flag"]["act1"].tag.match(rgx_y.yaml_tag_is_str) ) { _struct_composite.conf.flag_act1 = _yaml["flag"]["act1"].get!string; } if ("act2" in _yaml["flag"] && _yaml["flag"]["act2"].type.string - && _yaml["flag"]["act2"].tag.match(rgx.yaml_tag_is_str) + && _yaml["flag"]["act2"].tag.match(rgx_y.yaml_tag_is_str) ) { _struct_composite.conf.flag_act2 = _yaml["flag"]["act2"].get!string; } if ("act3" in _yaml["flag"] && _yaml["flag"]["act3"].type.string - && _yaml["flag"]["act3"].tag.match(rgx.yaml_tag_is_str) + && _yaml["flag"]["act3"].tag.match(rgx_y.yaml_tag_is_str) ) { _struct_composite.conf.flag_act3 = _yaml["flag"]["act3"].get!string; } if ("act4" in _yaml["flag"] && _yaml["flag"]["act4"].type.string - && _yaml["flag"]["act4"].tag.match(rgx.yaml_tag_is_str) + && _yaml["flag"]["act4"].tag.match(rgx_y.yaml_tag_is_str) ) { _struct_composite.conf.flag_act4 = _yaml["flag"]["act4"].get!string; } if ("act5" in _yaml["flag"] && _yaml["flag"]["act5"].type.string - && _yaml["flag"]["act5"].tag.match(rgx.yaml_tag_is_str) + && _yaml["flag"]["act5"].tag.match(rgx_y.yaml_tag_is_str) ) { _struct_composite.conf.flag_act5 = _yaml["flag"]["act5"].get!string; } if ("act6" in _yaml["flag"] && _yaml["flag"]["act6"].type.string - && _yaml["flag"]["act6"].tag.match(rgx.yaml_tag_is_str) + && _yaml["flag"]["act6"].tag.match(rgx_y.yaml_tag_is_str) ) { _struct_composite.conf.flag_act6 = _yaml["flag"]["act6"].get!string; } if ("act7" in _yaml["flag"] && _yaml["flag"]["act7"].type.string - && _yaml["flag"]["act7"].tag.match(rgx.yaml_tag_is_str) + && _yaml["flag"]["act7"].tag.match(rgx_y.yaml_tag_is_str) ) { _struct_composite.conf.flag_act7 = _yaml["flag"]["act7"].get!string; } if ("act8" in _yaml["flag"] && _yaml["flag"]["act8"].type.string - && _yaml["flag"]["act8"].tag.match(rgx.yaml_tag_is_str) + && _yaml["flag"]["act8"].tag.match(rgx_y.yaml_tag_is_str) ) { _struct_composite.conf.flag_act8 = _yaml["flag"]["act8"].get!string; } if ("act9" in _yaml["flag"] && _yaml["flag"]["act9"].type.string - && _yaml["flag"]["act9"].tag.match(rgx.yaml_tag_is_str) + && _yaml["flag"]["act9"].tag.match(rgx_y.yaml_tag_is_str) ) { _struct_composite.conf.flag_act9 = _yaml["flag"]["act9"].get!string; } @@ -574,7 +577,7 @@ template contentYAMLtoSpineStruct() { : _cfg.default_papersize; if ("papersize" in _yaml["default"] && _yaml["default"]["papersize"].type.string - && _yaml["default"]["papersize"].tag.match(rgx.yaml_tag_is_str) + && _yaml["default"]["papersize"].tag.match(rgx_y.yaml_tag_is_str) ) { _set_papersize = _yaml["default"]["papersize"].get!string; @@ -585,29 +588,29 @@ template contentYAMLtoSpineStruct() { "default" in _yaml && _yaml["default"].type.sequence && _yaml["default"].type.mapping - && _yaml["default"].tag.match(rgx.yaml_tag_is_map) + && _yaml["default"].tag.match(rgx_y.yaml_tag_is_map) ) { if ("text_wrap" in _yaml["default"] && _yaml["default"]["text_wrap"].type.string - && _yaml["default"]["text_wrap"].tag.match(rgx.yaml_tag_is_str) + && _yaml["default"]["text_wrap"].tag.match(rgx_y.yaml_tag_is_str) ) { _struct_composite.conf.set_text_wrap = _yaml["default"]["text_wrap"].get!string; } if ("emphasis" in _yaml["default"] && _yaml["default"]["emphasis"].type.string - && _yaml["default"]["emphasis"].tag.match(rgx.yaml_tag_is_str) + && _yaml["default"]["emphasis"].tag.match(rgx_y.yaml_tag_is_str) ) { _struct_composite.conf.set_emphasis = _yaml["default"]["emphasis"].get!string; } if ("language" in _yaml["default"] && _yaml["default"]["language"].type.string - && _yaml["default"]["language"].tag.match(rgx.yaml_tag_is_str) + && _yaml["default"]["language"].tag.match(rgx_y.yaml_tag_is_str) ) { _struct_composite.conf.set_language = _yaml["default"]["language"].get!string; } if ("digest" in _yaml["default"] && _yaml["default"]["digest"].type.string - && _yaml["default"]["digest"].tag.match(rgx.yaml_tag_is_str) + && _yaml["default"]["digest"].tag.match(rgx_y.yaml_tag_is_str) ) { _struct_composite.conf.set_digest = _yaml["default"]["digest"].get!string; } @@ -616,29 +619,29 @@ template contentYAMLtoSpineStruct() { && _yaml["search"].type.sequence ) { if (_yaml["search"].type.mapping - && _yaml["search"].tag.match(rgx.yaml_tag_is_map) + && _yaml["search"].tag.match(rgx_y.yaml_tag_is_map) ) { if ("flag" in _yaml["search"] && _yaml["search"]["flag"].type.string - && _yaml["search"]["flag"].tag.match(rgx.yaml_tag_is_str) + && _yaml["search"]["flag"].tag.match(rgx_y.yaml_tag_is_str) ) { _struct_composite.conf.search_flag = _yaml["search"]["flag"].get!string; } if ("action" in _yaml["search"] && _yaml["search"]["action"].type.string - && _yaml["search"]["action"].tag.match(rgx.yaml_tag_is_str) + && _yaml["search"]["action"].tag.match(rgx_y.yaml_tag_is_str) ) { _struct_composite.conf.search_action = _yaml["search"]["action"].get!string; } if ("db" in _yaml["search"] && _yaml["search"]["db"].type.string - && _yaml["search"]["db"].tag.match(rgx.yaml_tag_is_str) + && _yaml["search"]["db"].tag.match(rgx_y.yaml_tag_is_str) ) { _struct_composite.conf.search_db = _yaml["search"]["db"].get!string; } if ("title" in _yaml["search"] && _yaml["search"]["title"].type.string - && _yaml["search"]["title"].tag.match(rgx.yaml_tag_is_str) + && _yaml["search"]["title"].tag.match(rgx_y.yaml_tag_is_str) ) { _struct_composite.conf.search_title = _yaml["search"]["title"].get!string; } @@ -650,47 +653,47 @@ template contentYAMLtoSpineStruct() { && _yaml["make"].type.sequence ) { if (_yaml["make"].type.mapping - && _yaml["make"].tag.match(rgx.yaml_tag_is_map) + && _yaml["make"].tag.match(rgx_y.yaml_tag_is_map) ) { if ("doc_type" in _yaml["make"] && _yaml["make"]["doc_type"].type.string - && _yaml["make"]["doc_type"].tag.match(rgx.yaml_tag_is_str) + && _yaml["make"]["doc_type"].tag.match(rgx_y.yaml_tag_is_str) ) { _struct_composite.make_str.doc_type = _yaml["make"]["doc_type"].get!string; } if ("breaks" in _yaml["make"] && _yaml["make"]["breaks"].type.string - && _yaml["make"]["breaks"].tag.match(rgx.yaml_tag_is_str) + && _yaml["make"]["breaks"].tag.match(rgx_y.yaml_tag_is_str) ) { _struct_composite.make_str.breaks = _yaml["make"]["breaks"].get!string; } if ("bold" in _yaml["make"] && _yaml["make"]["bold"].type.string - && _yaml["make"]["bold"].tag.match(rgx.yaml_tag_is_str) + && _yaml["make"]["bold"].tag.match(rgx_y.yaml_tag_is_str) ) { _struct_composite.make_str.bold = _yaml["make"]["bold"].get!string; } if ("cover_image" in _yaml["make"] && _yaml["make"]["cover_image"].type.string - && _yaml["make"]["cover_image"].tag.match(rgx.yaml_tag_is_str) + && _yaml["make"]["cover_image"].tag.match(rgx_y.yaml_tag_is_str) ) { _struct_composite.make_str.cover_image = _yaml["make"]["cover_image"].get!string; } if ("css" in _yaml["make"] && _yaml["make"]["css"].type.string - && _yaml["make"]["css"].tag.match(rgx.yaml_tag_is_str) + && _yaml["make"]["css"].tag.match(rgx_y.yaml_tag_is_str) ) { _struct_composite.make_str.css = _yaml["make"]["css"].get!string; } if ("emphasis" in _yaml["make"] && _yaml["make"]["emphasis"].type.string - && _yaml["make"]["emphasis"].tag.match(rgx.yaml_tag_is_str) + && _yaml["make"]["emphasis"].tag.match(rgx_y.yaml_tag_is_str) ) { _struct_composite.make_str.emphasis = _yaml["make"]["emphasis"].get!string; } if ("footer" in _yaml["make"] && _yaml["make"]["footer"].type.string - && _yaml["make"]["footer"].tag.match(rgx.yaml_tag_is_str) + && _yaml["make"]["footer"].tag.match(rgx_y.yaml_tag_is_str) ) { char[][] __match_footer_array = (cast(char[]) _yaml["make"]["footer"].get!string) @@ -699,7 +702,7 @@ template contentYAMLtoSpineStruct() { } if ("headings" in _yaml["make"] && _yaml["make"]["headings"].type.string - && _yaml["make"]["headings"].tag.match(rgx.yaml_tag_is_str) + && _yaml["make"]["headings"].tag.match(rgx_y.yaml_tag_is_str) ) { char[][] __match_headings_array = (cast(char[]) _yaml["make"]["headings"].get!string) @@ -707,7 +710,7 @@ template contentYAMLtoSpineStruct() { _struct_composite.make_str.headings = __match_headings_array.to!(string[]); } else if ("headings" in _yaml["make"] && _yaml["make"]["headings"].type.string - && _yaml["make"]["headings"].tag.match(rgx.yaml_tag_is_seq) + && _yaml["make"]["headings"].tag.match(rgx_y.yaml_tag_is_seq) ) { foreach(string identify_heading_level; _yaml["make"]["headings"]) { _struct_composite.make_str.headings ~= identify_heading_level; @@ -715,7 +718,7 @@ template contentYAMLtoSpineStruct() { } if ("home_button_image" in _yaml["make"] && _yaml["make"]["home_button_image"].type.string - && _yaml["make"]["home_button_image"].tag.match(rgx.yaml_tag_is_str) + && _yaml["make"]["home_button_image"].tag.match(rgx_y.yaml_tag_is_str) ) { char[][] __match_home_button_image_array = (cast(char[]) _yaml["make"]["home_button_image"].get!string) @@ -724,12 +727,12 @@ template contentYAMLtoSpineStruct() { } if ("home_button_text" in _yaml["make"] && _yaml["make"]["home_button_text"].type.string - && _yaml["make"]["home_button_text"].tag.match(rgx.yaml_tag_is_str) + && _yaml["make"]["home_button_text"].tag.match(rgx_y.yaml_tag_is_str) ) { _struct_composite.make_str.home_button_text = _yaml["make"]["home_button_text"].get!string; } else if ("home_button_text" in _yaml["make"] && _yaml["make"]["home_button_text"].type.string - && _yaml["make"]["home_button_text"].tag.match(rgx.yaml_tag_is_seq) + && _yaml["make"]["home_button_text"].tag.match(rgx_y.yaml_tag_is_seq) ) { _struct_composite.make_str.home_button_text = ""; foreach(string hbt; _yaml["make"]["home_button_text"]) { @@ -738,13 +741,13 @@ template contentYAMLtoSpineStruct() { } if ("italics" in _yaml["make"] && _yaml["make"]["italics"].type.string - && _yaml["make"]["italics"].tag.match(rgx.yaml_tag_is_str) + && _yaml["make"]["italics"].tag.match(rgx_y.yaml_tag_is_str) ) { _struct_composite.make_str.italics = _yaml["make"]["italics"].get!string; } if ("auto_num_top_at_level" in _yaml["make"] && _yaml["make"]["auto_num_top_at_level"].type.string - && _yaml["make"]["auto_num_top_at_level"].tag.match(rgx.yaml_tag_is_str) + && _yaml["make"]["auto_num_top_at_level"].tag.match(rgx_y.yaml_tag_is_str) ) { _struct_composite.make_str.auto_num_top_at_level = _yaml["make"]["auto_num_top_at_level"].get!string; switch (_yaml["make"]["auto_num_top_at_level"].get!string) { @@ -770,12 +773,12 @@ template contentYAMLtoSpineStruct() { } if ("auto_num_depth" in _yaml["make"] && _yaml["make"]["auto_num_depth"].type.string - && _yaml["make"]["auto_num_depth"].tag.match(rgx.yaml_tag_is_int) + && _yaml["make"]["auto_num_depth"].tag.match(rgx_y.yaml_tag_is_int) ) { // not sure implemented for documents _struct_composite.make_str.auto_num_depth = _yaml["make"]["auto_num_depth"].get!int; } else if ("auto_num_depth" in _yaml["make"] && _yaml["make"]["auto_num_depth"].type.string - && _yaml["make"]["auto_num_depth"].tag.match(rgx.yaml_tag_is_str) + && _yaml["make"]["auto_num_depth"].tag.match(rgx_y.yaml_tag_is_str) ) { // not sure implemented for documents _struct_composite.make_str.auto_num_depth = _yaml["make"]["auto_num_depth"].get!int; } @@ -808,34 +811,34 @@ template contentYAMLtoSpineStruct() { && _yaml["creator"].type.sequence ) { if (_yaml["creator"].type.mapping - && _yaml["creator"].tag.match(rgx.yaml_tag_is_map) + && _yaml["creator"].tag.match(rgx_y.yaml_tag_is_map) ) { if ("author" in _yaml["creator"] && _yaml["creator"]["author"].type.string - && _yaml["creator"]["author"].tag.match(rgx.yaml_tag_is_str) + && _yaml["creator"]["author"].tag.match(rgx_y.yaml_tag_is_str) ) { _struct_composite.meta.creator_author = _yaml["creator"]["author"].get!string; } if ("email" in _yaml["creator"] && _yaml["creator"]["email"].type.string - && _yaml["creator"]["email"].tag.match(rgx.yaml_tag_is_str) + && _yaml["creator"]["email"].tag.match(rgx_y.yaml_tag_is_str) ) { _struct_composite.meta.creator_author_email = _yaml["creator"]["email"].get!string; } if ("illustrator" in _yaml["creator"] && _yaml["creator"]["illustrator"].type.string - && _yaml["creator"]["illustrator"].tag.match(rgx.yaml_tag_is_str) + && _yaml["creator"]["illustrator"].tag.match(rgx_y.yaml_tag_is_str) ) { _struct_composite.meta.creator_illustrator = _yaml["creator"]["illustrator"].get!string; } if ("translator" in _yaml["creator"] && _yaml["creator"]["translator"].type.string - && _yaml["creator"]["translator"].tag.match(rgx.yaml_tag_is_str) + && _yaml["creator"]["translator"].tag.match(rgx_y.yaml_tag_is_str) ) { _struct_composite.meta.creator_translator = _yaml["creator"]["translator"].get!string; } } else if (_yaml["creator"].type.string - && _yaml["creator"].tag.match(rgx.yaml_tag_is_str) + && _yaml["creator"].tag.match(rgx_y.yaml_tag_is_str) ) { _struct_composite.meta.creator_author = _yaml["creator"].get!string; } @@ -875,57 +878,57 @@ template contentYAMLtoSpineStruct() { && _yaml["title"].type.sequence ) { if (_yaml["title"].type.mapping - && _yaml["title"].tag.match(rgx.yaml_tag_is_map) + && _yaml["title"].tag.match(rgx_y.yaml_tag_is_map) ) { if ("main" in _yaml["title"] && _yaml["title"]["main"].type.string - && _yaml["title"]["main"].tag.match(rgx.yaml_tag_is_str) + && _yaml["title"]["main"].tag.match(rgx_y.yaml_tag_is_str) ) { _struct_composite.meta.title_main = _yaml["title"]["main"].get!string; } else if ("title" in _yaml["title"] && _yaml["title"]["title"].type.string - && _yaml["title"]["title"].tag.match(rgx.yaml_tag_is_str) + && _yaml["title"]["title"].tag.match(rgx_y.yaml_tag_is_str) ) { _struct_composite.meta.title_main = _yaml["title"]["title"].get!string; } if ("edition" in _yaml["title"] && _yaml["title"]["edition"].type.string - && _yaml["title"]["edition"].tag.match(rgx.yaml_tag_is_str) + && _yaml["title"]["edition"].tag.match(rgx_y.yaml_tag_is_str) ) { _struct_composite.meta.title_edition = _yaml["title"]["edition"].get!string; } if ("full" in _yaml["title"] && _yaml["title"]["full"].type.string - && _yaml["title"]["full"].tag.match(rgx.yaml_tag_is_str) + && _yaml["title"]["full"].tag.match(rgx_y.yaml_tag_is_str) ) { _struct_composite.meta.title_full = _yaml["title"]["full"].get!string; } if ("language" in _yaml["title"] && _yaml["title"]["language"].type.string - && _yaml["title"]["language"].tag.match(rgx.yaml_tag_is_str) + && _yaml["title"]["language"].tag.match(rgx_y.yaml_tag_is_str) ) { _struct_composite.meta.title_language = _yaml["title"]["language"].get!string; } if ("note" in _yaml["title"] && _yaml["title"]["note"].type.string - && _yaml["title"]["note"].tag.match(rgx.yaml_tag_is_str) + && _yaml["title"]["note"].tag.match(rgx_y.yaml_tag_is_str) ) { _struct_composite.meta.title_note = _yaml["title"]["note"].get!string; } if ("subtitle" in _yaml["title"] && _yaml["title"]["subtitle"].type.string - && _yaml["title"]["subtitle"].tag.match(rgx.yaml_tag_is_str) + && _yaml["title"]["subtitle"].tag.match(rgx_y.yaml_tag_is_str) ) { _struct_composite.meta.title_subtitle = _yaml["title"]["subtitle"].get!string; } else if ("sub" in _yaml["title"] && _yaml["title"]["sub"].type.string - && _yaml["title"]["sub"].tag.match(rgx.yaml_tag_is_str) + && _yaml["title"]["sub"].tag.match(rgx_y.yaml_tag_is_str) ) { _struct_composite.meta.title_subtitle = _yaml["title"]["sub"].get!string; } } else if ( _yaml["title"].type.string - && _yaml["title"].tag.match(rgx.yaml_tag_is_str) + && _yaml["title"].tag.match(rgx_y.yaml_tag_is_str) ) { _struct_composite.meta.title_main = _yaml["title"].get!string; } @@ -947,29 +950,29 @@ template contentYAMLtoSpineStruct() { && _yaml["classify"].type.sequence ) { if (_yaml["classify"].type.mapping - && _yaml["classify"].tag.match(rgx.yaml_tag_is_map) + && _yaml["classify"].tag.match(rgx_y.yaml_tag_is_map) ) { if ("dewey" in _yaml["classify"] && _yaml["classify"]["dewey"].type.string - && _yaml["classify"]["dewey"].tag.match(rgx.yaml_tag_is_str) + && _yaml["classify"]["dewey"].tag.match(rgx_y.yaml_tag_is_str) ) { _struct_composite.meta.classify_dewey = _yaml["classify"]["dewey"].get!string; } if ("loc" in _yaml["classify"] && _yaml["classify"]["loc"].type.string - && _yaml["classify"]["loc"].tag.match(rgx.yaml_tag_is_str) + && _yaml["classify"]["loc"].tag.match(rgx_y.yaml_tag_is_str) ) { _struct_composite.meta.classify_loc = _yaml["classify"]["loc"].get!string; } if ("keywords" in _yaml["classify"] && _yaml["classify"]["keywords"].type.string - && _yaml["classify"]["keywords"].tag.match(rgx.yaml_tag_is_str) + && _yaml["classify"]["keywords"].tag.match(rgx_y.yaml_tag_is_str) ) { _struct_composite.meta.classify_keywords = _yaml["classify"]["keywords"].get!string; } if ("topic_register" in _yaml["classify"] && _yaml["classify"]["topic_register"].type.string - && _yaml["classify"]["topic_register"].tag.match(rgx.yaml_tag_is_str) + && _yaml["classify"]["topic_register"].tag.match(rgx_y.yaml_tag_is_str) ) { _struct_composite.meta.classify_topic_register = _yaml["classify"]["topic_register"].get!string; if (_struct_composite.meta.classify_topic_register.length > 0) { @@ -1017,47 +1020,47 @@ template contentYAMLtoSpineStruct() { && _yaml["date"].type.sequence ) { if (_yaml["date"].type.mapping - && _yaml["date"].tag.match(rgx.yaml_tag_is_map) + && _yaml["date"].tag.match(rgx_y.yaml_tag_is_map) ) { if ("added_to_site" in _yaml["date"] && _yaml["date"]["added_to_site"].type.string - && _yaml["date"]["added_to_site"].tag.match(rgx.yaml_tag_is_str) + && _yaml["date"]["added_to_site"].tag.match(rgx_y.yaml_tag_is_str) ) { _struct_composite.meta.date_added_to_site = _yaml["date"]["added_to_site"].get!string; } if ("available" in _yaml["date"] && _yaml["date"]["available"].type.string - && _yaml["date"]["available"].tag.match(rgx.yaml_tag_is_str) + && _yaml["date"]["available"].tag.match(rgx_y.yaml_tag_is_str) ) { _struct_composite.meta.date_available = _yaml["date"]["available"].get!string; } if ("created" in _yaml["date"] && _yaml["date"]["created"].type.string - && _yaml["date"]["created"].tag.match(rgx.yaml_tag_is_str) + && _yaml["date"]["created"].tag.match(rgx_y.yaml_tag_is_str) ) { _struct_composite.meta.date_created = _yaml["date"]["created"].get!string; } if ("issued" in _yaml["date"] && _yaml["date"]["issued"].type.string - && _yaml["date"]["issued"].tag.match(rgx.yaml_tag_is_str) + && _yaml["date"]["issued"].tag.match(rgx_y.yaml_tag_is_str) ) { _struct_composite.meta.date_issued = _yaml["date"]["issued"].get!string; } if ("modified" in _yaml["date"] && _yaml["date"]["modified"].type.string - && _yaml["date"]["modified"].tag.match(rgx.yaml_tag_is_str) + && _yaml["date"]["modified"].tag.match(rgx_y.yaml_tag_is_str) ) { _struct_composite.meta.date_modified = _yaml["date"]["modified"].get!string; } if ("published" in _yaml["date"] && _yaml["date"]["published"].type.string - && _yaml["date"]["published"].tag.match(rgx.yaml_tag_is_str) + && _yaml["date"]["published"].tag.match(rgx_y.yaml_tag_is_str) ) { _struct_composite.meta.date_published = _yaml["date"]["published"].get!string; } if ("valid" in _yaml["date"] && _yaml["date"]["valid"].type.string - && _yaml["date"]["valid"].tag.match(rgx.yaml_tag_is_str) + && _yaml["date"]["valid"].tag.match(rgx_y.yaml_tag_is_str) ) { _struct_composite.meta.date_valid = _yaml["date"]["valid"].get!string; } @@ -1073,23 +1076,23 @@ template contentYAMLtoSpineStruct() { && _yaml["notes"].type.sequence ) { if (_yaml["notes"].type.mapping - && _yaml["notes"].tag.match(rgx.yaml_tag_is_map) + && _yaml["notes"].tag.match(rgx_y.yaml_tag_is_map) ) { if ("abstract" in _yaml["notes"] && _yaml["notes"]["abstract"].type.string - && _yaml["notes"]["abstract"].tag.match(rgx.yaml_tag_is_str) + && _yaml["notes"]["abstract"].tag.match(rgx_y.yaml_tag_is_str) ) { _struct_composite.meta.notes_abstract = _yaml["notes"]["abstract"].get!string; } if ("description" in _yaml["notes"] && _yaml["notes"]["description"].type.string - && _yaml["notes"]["description"].tag.match(rgx.yaml_tag_is_str) + && _yaml["notes"]["description"].tag.match(rgx_y.yaml_tag_is_str) ) { _struct_composite.meta.notes_description = _yaml["notes"]["description"].get!string; } if ("summary" in _yaml["notes"] && _yaml["notes"]["summary"].type.string - && _yaml["notes"]["summary"].tag.match(rgx.yaml_tag_is_str) + && _yaml["notes"]["summary"].tag.match(rgx_y.yaml_tag_is_str) ) { _struct_composite.meta.notes_summary = _yaml["notes"]["summary"].get!string; } @@ -1099,29 +1102,29 @@ template contentYAMLtoSpineStruct() { && _yaml["original"].type.sequence ) { if (_yaml["original"].type.mapping - && _yaml["original"].tag.match(rgx.yaml_tag_is_map) + && _yaml["original"].tag.match(rgx_y.yaml_tag_is_map) ) { if ("language" in _yaml["original"] && _yaml["original"]["language"].type.string - && _yaml["original"]["language"].tag.match(rgx.yaml_tag_is_str) + && _yaml["original"]["language"].tag.match(rgx_y.yaml_tag_is_str) ) { _struct_composite.meta.original_language = _yaml["original"]["language"].get!string; } if ("language_char" in _yaml["original"] && _yaml["original"]["language_char"].type.string - && _yaml["original"]["language_char"].tag.match(rgx.yaml_tag_is_str) + && _yaml["original"]["language_char"].tag.match(rgx_y.yaml_tag_is_str) ) { _struct_composite.meta.original_language_char = _yaml["original"]["language_char"].get!string; } if ("source" in _yaml["original"] && _yaml["original"]["source"].type.string - && _yaml["original"]["source"].tag.match(rgx.yaml_tag_is_str) + && _yaml["original"]["source"].tag.match(rgx_y.yaml_tag_is_str) ) { _struct_composite.meta.original_source = _yaml["original"]["source"].get!string; } if ("title" in _yaml["original"] && _yaml["original"]["title"].type.string - && _yaml["original"]["title"].tag.match(rgx.yaml_tag_is_str) + && _yaml["original"]["title"].tag.match(rgx_y.yaml_tag_is_str) ) { _struct_composite.meta.original_title = _yaml["original"]["title"].get!string; } @@ -1136,59 +1139,59 @@ template contentYAMLtoSpineStruct() { && _yaml["rights"].type.sequence ) { if (_yaml["rights"].type.mapping - && _yaml["rights"].tag.match(rgx.yaml_tag_is_map) + && _yaml["rights"].tag.match(rgx_y.yaml_tag_is_map) ) { if ("copyright" in _yaml["rights"] && _yaml["rights"]["copyright"].type.string - && _yaml["rights"]["copyright"].tag.match(rgx.yaml_tag_is_str) + && _yaml["rights"]["copyright"].tag.match(rgx_y.yaml_tag_is_str) ) { _struct_composite.meta.rights_copyright = check_input_markup(_yaml["rights"]["copyright"].get!string); } if ("copyright_text" in _yaml["rights"] && _yaml["rights"]["copyright_text"].type.string - && _yaml["rights"]["copyright_text"].tag.match(rgx.yaml_tag_is_str) + && _yaml["rights"]["copyright_text"].tag.match(rgx_y.yaml_tag_is_str) ) { _struct_composite.meta.rights_copyright_text = _yaml["rights"]["copyright_text"].get!string; } if ("copyright_audio" in _yaml["rights"] && _yaml["rights"]["copyright_audio"].type.string - && _yaml["rights"]["copyright_audio"].tag.match(rgx.yaml_tag_is_str) + && _yaml["rights"]["copyright_audio"].tag.match(rgx_y.yaml_tag_is_str) ) { _struct_composite.meta.rights_copyright_audio = _yaml["rights"]["copyright_audio"].get!string; } if ("copyright_cover" in _yaml["rights"] && _yaml["rights"]["copyright_cover"].type.string - && _yaml["rights"]["copyright_cover"].tag.match(rgx.yaml_tag_is_str) + && _yaml["rights"]["copyright_cover"].tag.match(rgx_y.yaml_tag_is_str) ) { _struct_composite.meta.rights_copyright_cover = _yaml["rights"]["copyright_cover"].get!string; } if ("copyright_illustrations" in _yaml["rights"] && _yaml["rights"]["copyright_illustrations"].type.string - && _yaml["rights"]["copyright_illustrations"].tag.match(rgx.yaml_tag_is_str) + && _yaml["rights"]["copyright_illustrations"].tag.match(rgx_y.yaml_tag_is_str) ) { _struct_composite.meta.rights_copyright_illustrations = _yaml["rights"]["copyright_illustrations"].get!string; } if ("copyright_photographs" in _yaml["rights"] && _yaml["rights"]["copyright_photographs"].type.string - && _yaml["rights"]["copyright_photographs"].tag.match(rgx.yaml_tag_is_str) + && _yaml["rights"]["copyright_photographs"].tag.match(rgx_y.yaml_tag_is_str) ) { _struct_composite.meta.rights_copyright_photographs = _yaml["rights"]["copyright_photographs"].get!string; } if ("copyright_translation" in _yaml["rights"] && _yaml["rights"]["copyright_translation"].type.string - && _yaml["rights"]["copyright_translation"].tag.match(rgx.yaml_tag_is_str) + && _yaml["rights"]["copyright_translation"].tag.match(rgx_y.yaml_tag_is_str) ) { _struct_composite.meta.rights_copyright_translation = _yaml["rights"]["copyright_translation"].get!string; } if ("copyright_video" in _yaml["rights"] && _yaml["rights"]["copyright_video"].type.string - && _yaml["rights"]["copyright_video"].tag.match(rgx.yaml_tag_is_str) + && _yaml["rights"]["copyright_video"].tag.match(rgx_y.yaml_tag_is_str) ) { _struct_composite.meta.rights_copyright_video = _yaml["rights"]["copyright_video"].get!string; } if ("license" in _yaml["rights"] && _yaml["rights"]["license"].type.string - && _yaml["rights"]["license"].tag.match(rgx.yaml_tag_is_str) + && _yaml["rights"]["license"].tag.match(rgx_y.yaml_tag_is_str) ) { _struct_composite.meta.rights_license = check_input_markup(_yaml["rights"]["license"].get!string); } @@ -1245,10 +1248,13 @@ template docHeaderMakeAndMetaTupYamlExtractAndConvertToStruct() { import doc_reform.meta.conf_make_meta_structs, doc_reform.meta.conf_make_meta_json, + doc_reform.meta.rgx_yaml, doc_reform.meta.rgx; mixin spineRgxIn; mixin contentJSONtoSpineStruct; static auto rgx = RgxI(); + mixin spineRgxYamlTags; + static auto rgx_y = RgxYaml(); @system auto docHeaderMakeAndMetaTupYamlExtractAndConvertToStruct(CCm,Src,M,O,Cfg)( Src header_src, CCm _make_and_meta_struct, diff --git a/src/doc_reform/meta/metadoc.d b/src/doc_reform/meta/metadoc.d index 16cc6e7..abaa874 100644 --- a/src/doc_reform/meta/metadoc.d +++ b/src/doc_reform/meta/metadoc.d @@ -1,3 +1,53 @@ +/+ +- Name: Spine, Doc Reform + - Description: documents, structuring, processing, publishing, search + - static content generator + + - Author: Ralph Amissah + [ralph.amissah@gmail.com] + + - Copyright: (C) 2015 - 2022 Ralph Amissah, All Rights + Reserved. + + - License: AGPL 3 or later: + + Spine (SiSU), a framework for document structuring, publishing and + search + + Copyright (C) Ralph Amissah + + This program is free software: you can redistribute it and/or modify it + under the terms of the GNU AFERO General Public License as published by the + Free Software Foundation, either version 3 of the License, or (at your + option) any later version. + + This program is distributed in the hope that it will be useful, but WITHOUT + ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for + more details. + + You should have received a copy of the GNU General Public License along with + this program. If not, see [https://www.gnu.org/licenses/]. + + If you have Internet connection, the latest version of the AGPL should be + available at these locations: + [https://www.fsf.org/licensing/licenses/agpl.html] + [https://www.gnu.org/licenses/agpl.html] + + - Spine (by Doc Reform, related to SiSU) uses standard: + - docReform markup syntax + - standard SiSU markup syntax with modified headers and minor modifications + - docReform object numbering + - standard SiSU object citation numbering & system + + - Homepages: + [https://www.doc_reform.org] + [https://www.sisudoc.org] + + - Git + [https://git.sisudoc.org/projects/?p=software/spine.git;a=summary] + ++/ module doc_reform.meta.metadoc; template spineAbstraction() { import @@ -8,18 +58,15 @@ template spineAbstraction() { doc_reform.meta.conf_make_meta_structs, doc_reform.meta.conf_make_meta_json, doc_reform.meta.defaults, - doc_reform.meta.rgx, doc_reform.io_in.paths_source, doc_reform.io_in.read_config_files, doc_reform.io_in.read_source_files, doc_reform.io_out.hub; - mixin spineRgxIn; mixin spineBiblio; mixin outputHub; enum headBody { header, body_content, insert_file_list, image_list } enum makeMeta { make, meta } enum docAbst { doc_abstract_obj, doc_has } - static auto rgx = RgxI(); @system auto spineAbstraction(E,P,O,Cfg,M,S)( E _env, P program_info, diff --git a/src/doc_reform/meta/metadoc_from_src.d b/src/doc_reform/meta/metadoc_from_src.d index 9a0940f..0c23101 100644 --- a/src/doc_reform/meta/metadoc_from_src.d +++ b/src/doc_reform/meta/metadoc_from_src.d @@ -65,6 +65,7 @@ template docAbstraction() { import doc_reform.meta, doc_reform.meta.defaults, + doc_reform.meta.rgx, doc_reform.meta.metadoc_object_setter, doc_reform.meta.rgx; /+ ↓ abstraction mixins +/ @@ -356,10 +357,10 @@ template docAbstraction() { static auto rgx = RgxI(); static auto mkup = InlineMarkup(); line = replaceAll!(m => mkup.quote_o ~ m[1] ~ mkup.quote_c)(line, rgx.within_quotes); - line = replaceAll!(m => mkup.mono ~ mkup.ff_o ~ m["text"] ~ mkup.ff_c ~ mkup.mono)(line, rgx.inline_mark_mono); - line = replaceAll!(m => mkup.cite ~ mkup.ff_o ~ m["text"] ~ mkup.ff_c ~ mkup.cite)(line, rgx.inline_mark_cite); + line = replaceAll!(m => "⑆" ~ mkup.mono ~ mkup.ff_o ~ m["text"] ~ mkup.ff_c ~ mkup.mono)(line, rgx.inline_mark_mono); + line = replaceAll!(m => "⑆" ~ mkup.cite ~ mkup.ff_o ~ m["text"] ~ mkup.ff_c ~ mkup.cite)(line, rgx.inline_mark_cite); foreach (regx; [rgx.inline_mark_emphasis, rgx.inline_mark_bold, rgx.inline_mark_underscore, rgx.inline_mark_italics, rgx.inline_mark_superscript, rgx.inline_mark_subscript, rgx.inline_mark_strike, rgx.inline_mark_insert]) { - line = replaceAll!(m => m["mark"] ~ mkup.ff_o ~ m["text"] ~ mkup.ff_c ~ m["mark"])(line, regx); + line = replaceAll!(m => "⑆" ~ m["mark"] ~ mkup.ff_o ~ m["text"] ~ mkup.ff_c ~ m["mark"])(line, regx); } return line; } @@ -4261,17 +4262,17 @@ template docAbstraction() { if (textline.match(rgx.inline_faces_line)) { textline = textline .replaceFirst(rgx.inline_emphasis_line, - format(q"┃%s%s%s%s%s%s┃", - mkup.emph, mkup.ff_o, "$1", mkup.ff_c, mkup.emph, "$2")) + format(q"┃%s%s%s%s%s%s%s┃", + "⑆", mkup.emph, mkup.ff_o, "$1", mkup.ff_c, mkup.emph, "$2")) .replaceFirst(rgx.inline_bold_line, - format(q"┃%s%s%s%s%s%s┃", - mkup.bold, mkup.ff_o, "$1", mkup.ff_c, mkup.bold, "$2")) + format(q"┃%s%s%s%s%s%s%s┃", + "⑆", mkup.bold, mkup.ff_o, "$1", mkup.ff_c, mkup.bold, "$2")) .replaceFirst(rgx.inline_underscore_line, - format(q"┃%s%s%s%s%s%s┃", - mkup.underscore, mkup.ff_o, "$1", mkup.ff_c, mkup.underscore, "$2")) + format(q"┃%s%s%s%s%s%s%s┃", + "⑆", mkup.underscore, mkup.ff_o, "$1", mkup.ff_c, mkup.underscore, "$2")) .replaceFirst(rgx.inline_italics_line, - format(q"┃%s%s%s%s%s%s┃", - mkup.italic, mkup.ff_o, "$1", mkup.ff_c, mkup.italic, "$2")); + format(q"┃%s%s%s%s%s%s%s┃", + "⑆", mkup.italic, mkup.ff_o, "$1", mkup.ff_c, mkup.italic, "$2")); } return textline; } @@ -5435,7 +5436,7 @@ template docAbstraction() { bookindex_unordered_hashes.byKey.array .sort!("toUpper(a) < toUpper(b)", SwapStrategy.stable).release; foreach (mainkey; mainkeys) { - write("_0_1 !┨", mainkey, "┣! "); + write("_0_1 ⑆!┨", mainkey, "┣! "); foreach (ref_; bookindex_unordered_hashes[mainkey]["_a"]) { auto go = ref_.replaceAll(rgx.book_index_go, "$1"); write(" {", ref_, "}#", go, ", "); @@ -5542,7 +5543,7 @@ template docAbstraction() { string[dchar] transTable = [' ' : "_"]; foreach (mainkey; mainkeys) { bi_tmp_tags = [""]; - bi_tmp = mkup.bold ~ mkup.ff_o ~ mainkey ~ mkup.ff_c ~ mkup.bold ~ " "; + bi_tmp = "⑆" ~ mkup.bold ~ mkup.ff_o ~ mainkey ~ mkup.ff_c ~ mkup.bold ~ " "; buffer.clear(); bi_tmp_tags ~= translate(mainkey, transTable); auto bkidx_lnk(string locs) { diff --git a/src/doc_reform/meta/package.d b/src/doc_reform/meta/package.d index 3b6cdcd..4d52077 100644 --- a/src/doc_reform/meta/package.d +++ b/src/doc_reform/meta/package.d @@ -50,8 +50,7 @@ +/ module doc_reform.meta; public import - doc_reform.meta.defaults, - doc_reform.meta.rgx; + doc_reform.meta.defaults; /+ std +/ public import std.array, diff --git a/src/doc_reform/meta/rgx.d b/src/doc_reform/meta/rgx.d index 8ecb829..1d40491 100644 --- a/src/doc_reform/meta/rgx.d +++ b/src/doc_reform/meta/rgx.d @@ -57,10 +57,6 @@ static template spineRgxIn() { /+ misc +/ static flag_action = ctRegex!(`^(--[a-z][a-z0-9-]+)$`); static within_quotes = ctRegex!(`"(.+?)"`, "m"); - static yaml_tag_is_str = ctRegex!(`:str$`); - static yaml_tag_is_int = ctRegex!(`:int$`); - static yaml_tag_is_map = ctRegex!(`:map$`); - static yaml_tag_is_seq = ctRegex!(`:seq$`); static make_heading_delimiter = ctRegex!(`[;][ ]*`); static arr_delimiter = ctRegex!(`[ ]*[;][ ]*`); static name_delimiter = ctRegex!(`^([^,]+)[ ]*,[ ]+(.+?)$`); @@ -195,9 +191,6 @@ static template spineRgxIn() { static topic_register_main_term_plus_rest_split = ctRegex!(`\s*:\s*`); static topic_register_sub_terms_split = ctRegex!(`\s*\|\s*`); static topic_register_multiple_sub_terms_split = ctRegex!(`␣([^|␣]+(?:\|[^|␣]+)+)`); - /+ language codes +/ - auto language_code_and_filename = - ctRegex!("(?:^|[/])(am|bg|bn|br|ca|cs|cy|da|de|el|en|eo|es|et|eu|fi|fr|ga|gl|he|hi|hr|hy|ia|is|it|ja|ko|la|lo|lt|lv|ml|mr|nl|no|nn|oc|pl|pt|pt_BR|ro|ru|sa|se|sk|sl|sq|sr|sv|ta|te|th|tk|tr|uk|ur|vi|zh)/[A-Za-z0-9._-].+?[.](?:sst|ssm)$"); static newline = ctRegex!("\n", "mg"); static space = ctRegex!(`[ ]`, "mg"); static spaces_keep = ctRegex!(`(?P<keep_spaces>^[ ]+|[ ]{2,})`, "mg"); // code, verse, block @@ -210,8 +203,7 @@ static template spineRgxIn() { static src_pth_contents = ctRegex!(`^(?P<path>[/]?(?:[a-zA-Z0-9._-]+/)*)(?P<filename>[a-zA-Z0-9][a-zA-Z0-9._-]*)/pod[.]manifest$`); static src_pth_zip = ctRegex!(`^(?P<path>[/]?(?:[a-zA-Z0-9._-]+/)*)(?P<filename>[a-zA-Z0-9._-]+[.]zip)$`); static src_pth_types = ctRegex!(`^(?P<path>[/]?[a-zA-Z0-9._-]+/)*(?P<gotfile>(?P<filename>[a-zA-Z0-9._-]+[.]ss[tm])|(?P<filelist>[a-zA-Z0-9._-]+/pod[.]manifest)|(?P<filezip>[a-zA-Z0-9._-]+[.]zip))$`); - static src_fn = - ctRegex!(`^([/]?(?:[a-zA-Z0-9._-]+/)*)(?P<fn_src>(?P<fn_base>[a-zA-Z0-9._-]+)[.](?P<fn_src_suffix>ss[tm]))$`); + static src_fn = ctRegex!(`^([/]?(?:[a-zA-Z0-9._-]+/)*)(?P<fn_src>(?P<fn_base>[a-zA-Z0-9._-]+)[.](?P<fn_src_suffix>ss[tm]))$`); static src_fn_master = ctRegex!(`^(?P<path>/?(?:[a-zA-Z0-9._-]+/)*)(?P<filename>[a-zA-Z0-9._-]+[.]ssm)$`); static src_fn_find_inserts = ctRegex!(`^(?P<path>/?(?:[a-zA-Z0-9._-]+/)*)(?P<filename>[a-zA-Z0-9._-]+[.]ss[im])$`); static insert_src_fn_ssi_or_sst = ctRegex!(`^<<\s*(?P<path>[a-zA-Z0-9._-]+/)*(?P<filename>[a-zA-Z0-9._-]+[.]ss[ti])$`); diff --git a/src/doc_reform/meta/rgx_files.d b/src/doc_reform/meta/rgx_files.d new file mode 100644 index 0000000..f86c416 --- /dev/null +++ b/src/doc_reform/meta/rgx_files.d @@ -0,0 +1,72 @@ +/+ +- Name: Spine, Doc Reform [a part of] + - Description: documents, structuring, processing, publishing, search + - static content generator + + - Author: Ralph Amissah + [ralph.amissah@gmail.com] + + - Copyright: (C) 2015 - 2022 Ralph Amissah, All Rights + Reserved. + + - License: AGPL 3 or later: + + Spine (SiSU), a framework for document structuring, publishing and + search + + Copyright (C) Ralph Amissah + + This program is free software: you can redistribute it and/or modify it + under the terms of the GNU AFERO General Public License as published by the + Free Software Foundation, either version 3 of the License, or (at your + option) any later version. + + This program is distributed in the hope that it will be useful, but WITHOUT + ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for + more details. + + You should have received a copy of the GNU General Public License along with + this program. If not, see [https://www.gnu.org/licenses/]. + + If you have Internet connection, the latest version of the AGPL should be + available at these locations: + [https://www.fsf.org/licensing/licenses/agpl.html] + [https://www.gnu.org/licenses/agpl.html] + + - Spine (by Doc Reform, related to SiSU) uses standard: + - docReform markup syntax + - standard SiSU markup syntax with modified headers and minor modifications + - docReform object numbering + - standard SiSU object citation numbering & system + + - Homepages: + [https://www.doc_reform.org] + [https://www.sisudoc.org] + + - Git + [https://git.sisudoc.org/projects/?p=software/spine.git;a=summary] + ++/ +/++ + regex: regular expressions used in sisu document parser ++/ +module doc_reform.meta.rgx_files; +static template spineRgxFiles() { + static struct RgxFiles { + static src_pth_sst_or_ssm = ctRegex!(`^(?P<path>[/]?(?:[a-zA-Z0-9._-]+/)*)(?P<filename>[a-zA-Z0-9._-]+[.](?P<extension>ss[tm]))$`); + static src_pth_pod_sst_or_ssm = ctRegex!(`^(?P<podpath>[/]?(?:[a-zA-Z0-9._-]+/)*)media/text/[a-z]{2}/(?P<filename>[a-zA-Z0-9][a-zA-Z0-9._-]*?[.]ss[tm])$`); + static src_pth_contents = ctRegex!(`^(?P<path>[/]?(?:[a-zA-Z0-9._-]+/)*)(?P<filename>[a-zA-Z0-9][a-zA-Z0-9._-]*)/pod[.]manifest$`); + static src_pth_zip = ctRegex!(`^(?P<path>[/]?(?:[a-zA-Z0-9._-]+/)*)(?P<filename>[a-zA-Z0-9._-]+[.]zip)$`); + static src_pth_types = ctRegex!(`^(?P<path>[/]?[a-zA-Z0-9._-]+/)*(?P<gotfile>(?P<filename>[a-zA-Z0-9._-]+[.]ss[tm])|(?P<filelist>[a-zA-Z0-9._-]+/pod[.]manifest)|(?P<filezip>[a-zA-Z0-9._-]+[.]zip))$`); + static src_fn = ctRegex!(`^([/]?(?:[a-zA-Z0-9._-]+/)*)(?P<fn_src>(?P<fn_base>[a-zA-Z0-9._-]+)[.](?P<fn_src_suffix>ss[tm]))$`); + static src_fn_master = ctRegex!(`^(?P<path>/?(?:[a-zA-Z0-9._-]+/)*)(?P<filename>[a-zA-Z0-9._-]+[.]ssm)$`); + static src_fn_find_inserts = ctRegex!(`^(?P<path>/?(?:[a-zA-Z0-9._-]+/)*)(?P<filename>[a-zA-Z0-9._-]+[.]ss[im])$`); + static insert_src_fn_ssi_or_sst = ctRegex!(`^<<\s*(?P<path>[a-zA-Z0-9._-]+/)*(?P<filename>[a-zA-Z0-9._-]+[.]ss[ti])$`); + static src_base_parent_dir_name = ctRegex!(`[/](?P<dir>(?:[a-zA-Z0-9._-]+))(?:/media/text/[a-z]{2})$`); // formalizes dir structure + static src_formalised_file_path_parts = ctRegex!(`(?P<pth>(?:[/a-zA-Z0-9._-]+?)(?P<dir>[a-zA-Z0-9._-]+))(?:/media/text/[a-z]{2})$`); // formalizes dir structure + /+ language codes +/ + auto language_code_and_filename = + ctRegex!("(?:^|[/])(am|bg|bn|br|ca|cs|cy|da|de|el|en|eo|es|et|eu|fi|fr|ga|gl|he|hi|hr|hy|ia|is|it|ja|ko|la|lo|lt|lv|ml|mr|nl|no|nn|oc|pl|pt|pt_BR|ro|ru|sa|se|sk|sl|sq|sr|sv|ta|te|th|tk|tr|uk|ur|vi|zh)/[A-Za-z0-9._-].+?[.](?:sst|ssm)$"); + } +} diff --git a/src/doc_reform/meta/rgx_yaml_tags.d b/src/doc_reform/meta/rgx_yaml_tags.d new file mode 100644 index 0000000..b2a15c1 --- /dev/null +++ b/src/doc_reform/meta/rgx_yaml_tags.d @@ -0,0 +1,62 @@ +/+ +- Name: Spine, Doc Reform [a part of] + - Description: documents, structuring, processing, publishing, search + - static content generator + + - Author: Ralph Amissah + [ralph.amissah@gmail.com] + + - Copyright: (C) 2015 - 2022 Ralph Amissah, All Rights + Reserved. + + - License: AGPL 3 or later: + + Spine (SiSU), a framework for document structuring, publishing and + search + + Copyright (C) Ralph Amissah + + This program is free software: you can redistribute it and/or modify it + under the terms of the GNU AFERO General Public License as published by the + Free Software Foundation, either version 3 of the License, or (at your + option) any later version. + + This program is distributed in the hope that it will be useful, but WITHOUT + ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for + more details. + + You should have received a copy of the GNU General Public License along with + this program. If not, see [https://www.gnu.org/licenses/]. + + If you have Internet connection, the latest version of the AGPL should be + available at these locations: + [https://www.fsf.org/licensing/licenses/agpl.html] + [https://www.gnu.org/licenses/agpl.html] + + - Spine (by Doc Reform, related to SiSU) uses standard: + - docReform markup syntax + - standard SiSU markup syntax with modified headers and minor modifications + - docReform object numbering + - standard SiSU object citation numbering & system + + - Homepages: + [https://www.doc_reform.org] + [https://www.sisudoc.org] + + - Git + [https://git.sisudoc.org/projects/?p=software/spine.git;a=summary] + ++/ +/++ + regex: regular expressions used in sisu document parser ++/ +module doc_reform.meta.rgx_yaml; +static template spineRgxYamlTags() { + static struct RgxYaml { + static yaml_tag_is_str = ctRegex!(`:str$`); + static yaml_tag_is_int = ctRegex!(`:int$`); + static yaml_tag_is_map = ctRegex!(`:map$`); + static yaml_tag_is_seq = ctRegex!(`:seq$`); + } +} diff --git a/src/doc_reform/spine.d b/src/doc_reform/spine.d index cd780c6..4fca299 100755 --- a/src/doc_reform/spine.d +++ b/src/doc_reform/spine.d @@ -75,6 +75,8 @@ import doc_reform.meta.defaults, doc_reform.meta.doc_debugs, doc_reform.meta.rgx, + doc_reform.meta.rgx_yaml, + doc_reform.meta.rgx_files, doc_reform.io_in.paths_source, doc_reform.io_in.read_config_files, doc_reform.io_in.read_source_files, @@ -86,6 +88,8 @@ string project_name = "spine"; string program_name = "spine"; @system void main(string[] args) { mixin spineRgxIn; + mixin spineRgxYamlTags; + mixin spineRgxFiles; mixin spineBiblio; mixin outputHub; auto hvst = spineCurateMetadata!(); @@ -93,6 +97,8 @@ string program_name = "spine"; string arg_unrecognized; enum dAM { abstraction, matters } static auto rgx = RgxI(); + static auto rgx_y = RgxYaml(); + static auto rgx_files = RgxFiles(); scope(success) { writefln( "~ run complete, ok ~ (%s-%s.%s.%s, %s D:%s, %s %s)", @@ -858,7 +864,7 @@ string program_name = "spine"; } else if (_opt_action.require_processing_files) { /+ cli, assumed to be path to source files +/ auto _manifest_start = PodManifest!()(_opt_action, arg); if ( /+ pod files +/ - !(arg.match(rgx.src_pth_sst_or_ssm)) + !(arg.match(rgx_files.src_pth_sst_or_ssm)) && _manifest_start.pod_manifest_file_with_path && _opt_action.abstraction ) { @@ -886,10 +892,10 @@ string program_name = "spine"; } if ("doc" in pod_manifest_yaml) { if (pod_manifest_yaml["doc"].type.mapping - && pod_manifest_yaml["doc"].tag.match(rgx.yaml_tag_is_map) + && pod_manifest_yaml["doc"].tag.match(rgx_y.yaml_tag_is_map) ) { if ("path" in pod_manifest_yaml["doc"]) { - if (pod_manifest_yaml["doc"]["path"].tag.match(rgx.yaml_tag_is_seq)) { + if (pod_manifest_yaml["doc"]["path"].tag.match(rgx_y.yaml_tag_is_seq)) { foreach (string _path; pod_manifest_yaml["doc"]["path"]) { markup_contents_location_ ~= _path ~ "\n"; pod_manifest_root_content_paths_to_markup_location_raw_ ~= @@ -897,7 +903,7 @@ string program_name = "spine"; } } else if ( pod_manifest_yaml["doc"]["path"].type.string - && pod_manifest_yaml["doc"]["path"].tag.match(rgx.yaml_tag_is_str) + && pod_manifest_yaml["doc"]["path"].tag.match(rgx_y.yaml_tag_is_str) ) { markup_contents_location_ = pod_manifest_yaml["doc"]["path"].get!string; pod_manifest_root_content_paths_to_markup_location_raw_ = @@ -905,17 +911,17 @@ string program_name = "spine"; } } if ("filename" in pod_manifest_yaml["doc"]) { - if (pod_manifest_yaml["doc"]["filename"].tag.match(rgx.yaml_tag_is_seq)) { + if (pod_manifest_yaml["doc"]["filename"].tag.match(rgx_y.yaml_tag_is_seq)) { foreach (string _filename; pod_manifest_yaml["doc"]["filename"]) { if ("language" in pod_manifest_yaml["doc"]) { - if (pod_manifest_yaml["doc"]["language"].tag.match(rgx.yaml_tag_is_seq)) { + if (pod_manifest_yaml["doc"]["language"].tag.match(rgx_y.yaml_tag_is_seq)) { foreach (string _lang; pod_manifest_yaml["doc"]["language"]) { markup_contents_location_ ~= "media/text/" ~ _lang ~ "/" ~ _filename ~ "\n"; } - } else if (pod_manifest_yaml["doc"]["language"].tag.match(rgx.yaml_tag_is_str) + } else if (pod_manifest_yaml["doc"]["language"].tag.match(rgx_y.yaml_tag_is_str) ) { markup_contents_location_ = "media/text/" @@ -938,17 +944,17 @@ string program_name = "spine"; } } else if ( pod_manifest_yaml["doc"]["filename"].type.string - && pod_manifest_yaml["doc"]["filename"].tag.match(rgx.yaml_tag_is_str) + && pod_manifest_yaml["doc"]["filename"].tag.match(rgx_y.yaml_tag_is_str) ) { if ("language" in pod_manifest_yaml["doc"]) { - if (pod_manifest_yaml["doc"]["language"].tag.match(rgx.yaml_tag_is_seq)) { + if (pod_manifest_yaml["doc"]["language"].tag.match(rgx_y.yaml_tag_is_seq)) { foreach (string _lang; pod_manifest_yaml["doc"]["language"]) { markup_contents_location_ ~= "media/text/" ~ _lang ~ "/" ~ pod_manifest_yaml["doc"]["filename"].get!string ~ "\n"; } - } else if (pod_manifest_yaml["doc"]["language"].tag.match(rgx.yaml_tag_is_str)) { + } else if (pod_manifest_yaml["doc"]["language"].tag.match(rgx_y.yaml_tag_is_str)) { markup_contents_location_ = "media/text/" ~ pod_manifest_yaml["doc"]["language"].get!string @@ -985,7 +991,7 @@ string program_name = "spine"; = (cast(char[]) markup_contents_location_).split; auto tmp_dir_ = (sisudoc_txt_).dirName.array; foreach (markup_contents_location; markup_contents_locations_arr) { - assert(markup_contents_location.match(rgx.src_pth_sst_or_ssm), + assert(markup_contents_location.match(rgx_files.src_pth_sst_or_ssm), "not a recognised file: «" ~ markup_contents_location ~ "»" ); @@ -999,14 +1005,14 @@ string program_name = "spine"; _manifests ~= _manifested; } } - } else if (arg.match(rgx.src_pth_sst_or_ssm)) { /+ markup txt files +/ + } else if (arg.match(rgx_files.src_pth_sst_or_ssm)) { /+ markup txt files +/ if (exists(arg)==0) { writeln("ERROR >> Processing Skipped! File not found: ", arg); } else { _manifested = PathMatters!()(_opt_action, _env, arg, arg); _manifests ~= _manifested; } - } else if (arg.match(rgx.src_pth_zip)) { + } else if (arg.match(rgx_files.src_pth_zip)) { // fns_src ~= arg; // gather input markup source file names for processing } else { // anything remaining, unused arg_unrecognized ~= " " ~ arg; @@ -1042,7 +1048,7 @@ string program_name = "spine"; } } enforce( - manifest.src.filename.match(rgx.src_pth_types), + manifest.src.filename.match(rgx_files.src_pth_types), "not a sisu markup filename: «" ~ manifest.src.filename ~ "»" ); @@ -1155,7 +1161,7 @@ string program_name = "spine"; } } enforce( - manifest.src.filename.match(rgx.src_pth_types), + manifest.src.filename.match(rgx_files.src_pth_types), "not a sisu markup filename: «" ~ manifest.src.filename ~ "»" ); |