aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/doc_reform/io_in/read_source_files.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/read_source_files.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/read_source_files.d')
-rw-r--r--src/doc_reform/io_in/read_source_files.d24
1 files changed, 14 insertions, 10 deletions
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);