aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/doc_reform/io_in/paths_source.d
diff options
context:
space:
mode:
authorRalph Amissah <ralph.amissah@gmail.com>2022-11-25 22:06:40 -0500
committerRalph Amissah <ralph.amissah@gmail.com>2022-12-23 18:17:41 -0500
commitf6d28b62f0e02b8a88a1832589e203c7a613f45b (patch)
treeb5d6462e45bae998190194784e02b143a83f79a3 /src/doc_reform/io_in/paths_source.d
parentgitignore & things nix (diff)
regex review, match speed & compile time, ctregex
- improve match time - add interim fontface identifier marker - improve compile time - remove unused regexs - separate out some specialized output matches
Diffstat (limited to 'src/doc_reform/io_in/paths_source.d')
-rw-r--r--src/doc_reform/io_in/paths_source.d38
1 files changed, 17 insertions, 21 deletions
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)