From f6d28b62f0e02b8a88a1832589e203c7a613f45b Mon Sep 17 00:00:00 2001 From: Ralph Amissah Date: Fri, 25 Nov 2022 22:06:40 -0500 Subject: 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 --- src/doc_reform/meta/conf_make_meta_structs.d | 3 + src/doc_reform/meta/conf_make_meta_yaml.d | 252 ++++++++++++++------------- src/doc_reform/meta/metadoc.d | 53 +++++- src/doc_reform/meta/metadoc_from_src.d | 27 +-- src/doc_reform/meta/package.d | 3 +- src/doc_reform/meta/rgx.d | 10 +- src/doc_reform/meta/rgx_files.d | 72 ++++++++ src/doc_reform/meta/rgx_yaml_tags.d | 62 +++++++ 8 files changed, 332 insertions(+), 150 deletions(-) create mode 100644 src/doc_reform/meta/rgx_files.d create mode 100644 src/doc_reform/meta/rgx_yaml_tags.d (limited to 'src/doc_reform/meta') 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^[ ]+|[ ]{2,})`, "mg"); // code, verse, block @@ -210,8 +203,7 @@ static template spineRgxIn() { static src_pth_contents = ctRegex!(`^(?P[/]?(?:[a-zA-Z0-9._-]+/)*)(?P[a-zA-Z0-9][a-zA-Z0-9._-]*)/pod[.]manifest$`); static src_pth_zip = ctRegex!(`^(?P[/]?(?:[a-zA-Z0-9._-]+/)*)(?P[a-zA-Z0-9._-]+[.]zip)$`); static src_pth_types = ctRegex!(`^(?P[/]?[a-zA-Z0-9._-]+/)*(?P(?P[a-zA-Z0-9._-]+[.]ss[tm])|(?P[a-zA-Z0-9._-]+/pod[.]manifest)|(?P[a-zA-Z0-9._-]+[.]zip))$`); - static src_fn = - ctRegex!(`^([/]?(?:[a-zA-Z0-9._-]+/)*)(?P(?P[a-zA-Z0-9._-]+)[.](?Pss[tm]))$`); + static src_fn = ctRegex!(`^([/]?(?:[a-zA-Z0-9._-]+/)*)(?P(?P[a-zA-Z0-9._-]+)[.](?Pss[tm]))$`); static src_fn_master = ctRegex!(`^(?P/?(?:[a-zA-Z0-9._-]+/)*)(?P[a-zA-Z0-9._-]+[.]ssm)$`); static src_fn_find_inserts = ctRegex!(`^(?P/?(?:[a-zA-Z0-9._-]+/)*)(?P[a-zA-Z0-9._-]+[.]ss[im])$`); static insert_src_fn_ssi_or_sst = ctRegex!(`^<<\s*(?P[a-zA-Z0-9._-]+/)*(?P[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[/]?(?:[a-zA-Z0-9._-]+/)*)(?P[a-zA-Z0-9._-]+[.](?Pss[tm]))$`); + static src_pth_pod_sst_or_ssm = ctRegex!(`^(?P[/]?(?:[a-zA-Z0-9._-]+/)*)media/text/[a-z]{2}/(?P[a-zA-Z0-9][a-zA-Z0-9._-]*?[.]ss[tm])$`); + static src_pth_contents = ctRegex!(`^(?P[/]?(?:[a-zA-Z0-9._-]+/)*)(?P[a-zA-Z0-9][a-zA-Z0-9._-]*)/pod[.]manifest$`); + static src_pth_zip = ctRegex!(`^(?P[/]?(?:[a-zA-Z0-9._-]+/)*)(?P[a-zA-Z0-9._-]+[.]zip)$`); + static src_pth_types = ctRegex!(`^(?P[/]?[a-zA-Z0-9._-]+/)*(?P(?P[a-zA-Z0-9._-]+[.]ss[tm])|(?P[a-zA-Z0-9._-]+/pod[.]manifest)|(?P[a-zA-Z0-9._-]+[.]zip))$`); + static src_fn = ctRegex!(`^([/]?(?:[a-zA-Z0-9._-]+/)*)(?P(?P[a-zA-Z0-9._-]+)[.](?Pss[tm]))$`); + static src_fn_master = ctRegex!(`^(?P/?(?:[a-zA-Z0-9._-]+/)*)(?P[a-zA-Z0-9._-]+[.]ssm)$`); + static src_fn_find_inserts = ctRegex!(`^(?P/?(?:[a-zA-Z0-9._-]+/)*)(?P[a-zA-Z0-9._-]+[.]ss[im])$`); + static insert_src_fn_ssi_or_sst = ctRegex!(`^<<\s*(?P[a-zA-Z0-9._-]+/)*(?P[a-zA-Z0-9._-]+[.]ss[ti])$`); + static src_base_parent_dir_name = ctRegex!(`[/](?P(?:[a-zA-Z0-9._-]+))(?:/media/text/[a-z]{2})$`); // formalizes dir structure + static src_formalised_file_path_parts = ctRegex!(`(?P(?:[/a-zA-Z0-9._-]+?)(?P[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$`); + } +} -- cgit v1.2.3