diff options
author | Ralph Amissah <ralph.amissah@gmail.com> | 2020-04-28 14:20:01 -0400 |
---|---|---|
committer | Ralph Amissah <ralph.amissah@gmail.com> | 2020-05-20 11:27:26 -0400 |
commit | 69a5eaad6c474bc7d397dbade39c8180e8351a81 (patch) | |
tree | 3569714522b6bc7ac742f508eddcbba5747e2322 /org/in_source_files.org | |
parent | markup conversion (diff) |
0.11.0 in_source_files, changed tracking of code blocks
Diffstat (limited to 'org/in_source_files.org')
-rw-r--r-- | org/in_source_files.org | 55 |
1 files changed, 29 insertions, 26 deletions
diff --git a/org/in_source_files.org b/org/in_source_files.org index 05e9889..49c4a5e 100644 --- a/org/in_source_files.org +++ b/org/in_source_files.org @@ -516,7 +516,9 @@ split is on first match of level A~ (which is required) #+NAME: meta_inserts_scan #+BEGIN_SRC d 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]; #+END_SRC @@ -525,33 +527,33 @@ auto markup_src_file_path = fn_pth_full.captures[1]; #+NAME: meta_inserts_scan_loop #+BEGIN_SRC d -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 @@ -582,8 +584,8 @@ if (type1["curly_code"] == 1) { - 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); @@ -611,7 +613,8 @@ return t; #+NAME: meta_master_doc_scan_for_insert_filenames #+BEGIN_SRC d 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; @@ -623,21 +626,21 @@ string[] insert_file_list =[]; #+NAME: meta_master_doc_scan_for_insert_filenames_loop #+BEGIN_SRC d -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]; |