aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/doc_reform/io_in
diff options
context:
space:
mode:
authorRalph Amissah <ralph.amissah@gmail.com>2020-04-28 14:20:01 -0400
committerRalph Amissah <ralph.amissah@gmail.com>2020-05-20 11:27:26 -0400
commit69a5eaad6c474bc7d397dbade39c8180e8351a81 (patch)
tree3569714522b6bc7ac742f508eddcbba5747e2322 /src/doc_reform/io_in
parentmarkup conversion (diff)
0.11.0 in_source_files, changed tracking of code blocks
Diffstat (limited to 'src/doc_reform/io_in')
-rw-r--r--src/doc_reform/io_in/read_source_files.d55
1 files changed, 29 insertions, 26 deletions
diff --git a/src/doc_reform/io_in/read_source_files.d b/src/doc_reform/io_in/read_source_files.d
index 2959cc6..349729d 100644
--- a/src/doc_reform/io_in/read_source_files.d
+++ b/src/doc_reform/io_in/read_source_files.d
@@ -175,37 +175,39 @@ template spineRawMarkupContent() {
) {
mixin spineRgxDocStructFlags;
char[][] contents_insert;
- int[string] type1 = flags_type_init;
+ int code_block_status = 0;
+ enum codeBlock { off, curly, tic, }
+ int[string] type = flags_type_init;
auto fn_pth_full = fn_src.match(rgx.src_pth_sst_or_ssm);
auto markup_src_file_path = fn_pth_full.captures[1];
foreach (line; markup_sourcefile_insert_content) {
- if (type1["curly_code"] == 1) {
- type1["header_make"] = 0;
- type1["header_meta"] = 0;
+ if (code_block_status == codeBlock.curly) {
+ type["header_make"] = 0;
+ type["header_meta"] = 0;
if (line.matchFirst(rgx.block_curly_code_close)) {
- type1["curly_code"] = 0;
+ code_block_status = codeBlock.off;
}
contents_insert ~= line;
} else if (line.matchFirst(rgx.block_curly_code_open)) {
- type1["curly_code"] = 1;
- type1["header_make"] = 0;
- type1["header_meta"] = 0;
+ code_block_status = codeBlock.curly;
+ type["header_make"] = 0;
+ type["header_meta"] = 0;
contents_insert ~= line;
- } else if (type1["tic_code"] == 1) {
- type1["header_make"] = 0;
- type1["header_meta"] = 0;
+ } else if (code_block_status == codeBlock.tic) {
+ type["header_make"] = 0;
+ type["header_meta"] = 0;
if (line.matchFirst(rgx.block_tic_close)) {
- type1["tic_code"] = 0;
+ code_block_status = codeBlock.off;
}
contents_insert ~= line;
} else if (line.matchFirst(rgx.block_tic_code_open)) {
- type1["tic_code"] = 1;
- type1["header_make"] = 0;
- type1["header_meta"] = 0;
+ code_block_status = codeBlock.tic;
+ type["header_make"] = 0;
+ type["header_meta"] = 0;
contents_insert ~= line;
} else if (auto m = line.match(rgx.insert_src_fn_ssi_or_sst)) {
- type1["header_make"] = 0;
- type1["header_meta"] = 0;
+ type["header_make"] = 0;
+ type["header_meta"] = 0;
auto insert_fn = m.captures[2];
auto insert_sub_pth = m.captures[1];
auto fn_src_insert
@@ -236,8 +238,8 @@ template spineRawMarkupContent() {
- build image list, search for any image files to add to image list
+/
} else {
- type1["header_make"] = 0;
- type1["header_meta"] = 0;
+ type["header_make"] = 0;
+ type["header_meta"] = 0;
contents_insert ~= line; // images to extract for image list?
if (_opt_action.source || _opt_action.pod) {
string[] _image_linelist = _extract_images(line);
@@ -261,28 +263,29 @@ template spineRawMarkupContent() {
import std.algorithm;
mixin spineRgxDocStructFlags;
char[][] contents;
- int[string] type = flags_type_init;
+ int code_block_status = 0;
+ enum codeBlock { off, curly, tic, }
auto fn_pth_full = fn_src.match(rgx.src_pth_sst_or_ssm);
auto markup_src_file_path = fn_pth_full.captures[1];
char[][] contents_insert;
string[] _images =[];
string[] insert_file_list =[];
foreach (line; sourcefile_body_content) {
- if (type["curly_code"] == 1) {
+ if (code_block_status == codeBlock.curly) {
if (line.matchFirst(rgx.block_curly_code_close)) {
- type["curly_code"] = 0;
+ code_block_status = codeBlock.off;
}
contents ~= line;
} else if (line.matchFirst(rgx.block_curly_code_open)) {
- type["curly_code"] = 1;
+ code_block_status = codeBlock.curly;
contents ~= line;
- } else if (type["tic_code"] == 1) {
+ } else if (code_block_status == codeBlock.tic) {
if (line.matchFirst(rgx.block_tic_close)) {
- type["tic_code"] = 0;
+ code_block_status = codeBlock.off;
}
contents ~= line;
} else if (line.matchFirst(rgx.block_tic_code_open)) {
- type["tic_code"] = 1;
+ code_block_status = codeBlock.tic;
contents ~= line;
} else if (auto m = line.match(rgx.insert_src_fn_ssi_or_sst)) {
auto insert_fn = m.captures[2];