aboutsummaryrefslogtreecommitdiffhomepage
path: root/org/ao_scan_inserts.org
diff options
context:
space:
mode:
Diffstat (limited to 'org/ao_scan_inserts.org')
-rw-r--r--org/ao_scan_inserts.org259
1 files changed, 0 insertions, 259 deletions
diff --git a/org/ao_scan_inserts.org b/org/ao_scan_inserts.org
deleted file mode 100644
index 2b76960..0000000
--- a/org/ao_scan_inserts.org
+++ /dev/null
@@ -1,259 +0,0 @@
-#+TITLE: sdp scan inserts
-#+AUTHOR: Ralph Amissah
-#+EMAIL: ralph.amissah@gmail.com
-#+STARTUP: indent
-#+LANGUAGE: en
-#+OPTIONS: H:3 num:nil toc:t \n:nil @:t ::t |:t ^:nil _:nil -:t f:t *:t <:t
-#+OPTIONS: TeX:t LaTeX:t skip:nil d:nil todo:t pri:nil tags:not-in-toc
-#+OPTIONS: author:nil email:nil creator:nil timestamp:nil
-#+PROPERTY: header-args :padline no :exports code :noweb yes
-#+EXPORT_SELECT_TAGS: export
-#+EXPORT_EXCLUDE_TAGS: noexport
-#+FILETAGS: :sdp:rel:ao:
-#+TAGS: assert(a) class(c) debug(d) mixin(m) sdp(s) tangle(T) template(t) WEB(W) noexport(n)
-
-* inserts :inserts:
-[[./sdp.org][sdp]] [[./][org/]]
-
-** scan inserts (sub-document) source :scan_insert_src:
-*** scan subdoc source
-#+name: ao_inserts_scan
-#+BEGIN_SRC d
-char[][] contents_insert;
-auto ft1 = flag_type.dup;
-mixin ScreenTxtColors;
-auto rgx = Rgx();
-int tell_l(string color, in char[] line) {
- writeln(scr_txt_marker[color], line);
- return 0;
-}
-auto fn_pth_full = match(fn_src, rgx.src_pth);
-auto markup_src_file_path = fn_pth_full.captures[1];
-#+END_SRC
-
-*** loop insert (sub-document)
-#+name: ao_inserts_scan_loop
-#+BEGIN_SRC d
-if (ft1["curly_code"] == 1) {
- ft1["header_make"] = 0;
- ft1["header_metadata"] = 0;
- if (auto m = match(line, rgx.block_curly_code_close)) {
- ft1["curly_code"] = 0;
- }
- contents_insert ~= line;
-} else if (auto m = match(line, rgx.block_curly_code_open)) {
- ft1["curly_code"] = 1;
- ft1["header_make"] = 0;
- ft1["header_metadata"] = 0;
- contents_insert ~= line;
-} else if (ft1["tic_code"] == 1) {
- ft1["header_make"] = 0;
- ft1["header_metadata"] = 0;
- if (auto m = match(line, rgx.block_tic_close)) {
- ft1["tic_code"] = 0;
- }
- contents_insert ~= line;
-} else if (auto m = match(line, rgx.block_tic_code_open)) {
- ft1["tic_code"] = 1;
- ft1["header_make"] = 0;
- ft1["header_metadata"] = 0;
- contents_insert ~= line;
-} else if (
- (ft1["header_make"] == 1)
- && match(line, rgx.header_sub)
-) {
- ft1["header_make"] = 1;
- ft1["header_metadata"] = 0;
-} else if (
- (ft1["header_metadata"] == 1)
- && match(line, rgx.header_sub)
-) {
- ft1["header_metadata"] = 1;
- ft1["header_make"] = 0;
-} else if (auto m = match(line, rgx.insert_src_fn_ssi_or_sst)) {
- ft1["header_make"] = 0;
- ft1["header_metadata"] = 0;
- auto insert_fn = m.captures[2];
- auto insert_sub_pth = m.captures[1];
- auto fn_src_insert =
- (markup_src_file_path ~ insert_sub_pth ~ insert_fn);
- auto raw = MarkupRaw();
- auto markup_sourcesubfile_insert_content =
- raw.markupInsertSourceContentRawLineArray(fn_src_insert);
- debug(insert) { // insert file
- tell_l("red", line);
- tell_l("red", fn_src_insert);
- tell_l("fuchsia", "ERROR");
- writeln(
- " length contents insert array: ",
- markup_sourcesubfile_insert_content.length
- );
- }
- auto ins = Inserts();
- /+
- 1. load file,
- 2. read lines;
- 3. scan lines,
- 4. if filename insert, and insert filename
- 5. repeat 1
- 6. else
- 7. add line to new array;
- +/
-} else {
- ft1["header_make"] = 0;
- ft1["header_metadata"] = 0;
- contents_insert ~= line;
-}
-#+END_SRC
-
-*** post loop
-#+name: ao_inserts_scan_post
-#+BEGIN_SRC d
-return contents_insert;
-#+END_SRC
-
-** scan document source :scan_src:
-*** scan doc source
-#+name: ao_doc_scan
-#+BEGIN_SRC d
-char[][] contents;
-auto ft = flag_type.dup;
-mixin ScreenTxtColors;
-auto rgx = Rgx();
-int tell_l(string color, in char[] line) {
- writeln(scr_txt_marker[color], line);
- return 0;
-}
-auto fn_pth_full = match(fn_src, rgx.src_pth);
-auto markup_src_file_path = fn_pth_full.captures[1];
-#+END_SRC
-
-*** loop insert (document)
-#+name: ao_doc_scan_loop
-#+BEGIN_SRC d
-if (ft["curly_code"] == 1) {
- ft["header_make"] = 0;
- ft["header_metadata"] = 0;
- if (auto m = match(line, rgx.block_curly_code_close)) {
- ft["curly_code"] = 0;
- }
- contents ~= line;
-} else if (auto m = match(line, rgx.block_curly_code_open)) {
- ft["curly_code"] = 1;
- ft["header_make"] = 0;
- ft["header_metadata"] = 0;
- contents ~= line;
-} else if (ft["tic_code"] == 1) {
- ft["header_make"] = 0;
- ft["header_metadata"] = 0;
- if (auto m = match(line, rgx.block_tic_close)) {
- ft["tic_code"] = 0;
- }
- contents ~= line;
-} else if (auto m = match(line, rgx.block_tic_code_open)) {
- ft["tic_code"] = 1;
- ft["header_make"] = 0;
- ft["header_metadata"] = 0;
- contents ~= line;
-} else if (
- (ft["header_make"] == 1)
- && match(line, rgx.header_sub)
-) {
- contents ~= line;
-} else if (
- (ft["header_metadata"] == 1)
- && match(line, rgx.header_sub)
-) {
- contents ~= line;
-} else if (auto m = match(line, rgx.header_make)) {
- ft["header_make"] = 1;
- ft["header_metadata"] = 0;
- contents ~= line;
-} else if (auto m = match(line, rgx.header_metadata)) {
- ft["header_make"] = 0;
- ft["header_metadata"] = 1;
- contents ~= line;
-} else if (auto m = match(line, rgx.insert_src_fn_ssi_or_sst)) {
- ft["header_make"] = 0;
- ft["header_metadata"] = 0;
- auto insert_fn = m.captures[2];
- auto insert_sub_pth = m.captures[1];
- auto fn_src_insert =
- (markup_src_file_path ~ insert_sub_pth ~ insert_fn);
- auto raw = MarkupRaw();
- auto markup_sourcefile_insert_content =
- raw.markupInsertSourceContentRawLineArray(fn_src_insert);
- debug(insert) { // insert file
- tell_l("red", line);
- tell_l("red", fn_src_insert);
- writeln(
- " length contents insert array: ",
- markup_sourcefile_insert_content.length
- );
- }
- auto ins = Inserts();
- auto contents_insert = ins.scan_subdoc_source(
- markup_sourcefile_insert_content,
- to!string(fn_src_insert)
- );
- contents ~= contents_insert;
- /+
- 1. load file,
- 2. read lines;
- 3. scan lines,
- 4. if filename insert, and insert filename
- 5. repeat 1
- 6. else
- 7. add line to new array;
- +/
-} else {
- ft["header_make"] = 0;
- ft["header_metadata"] = 0;
- contents ~= line;
-}
-#+END_SRC
-
-*** post loop
-#+name: ao_doc_scan_post
-#+BEGIN_SRC d
-debug(insert) { // insert file
- writeln(__LINE__);
- writeln(contents.length);
-}
-return contents;
-#+END_SRC
-
-* tangles :tangle:
-** code structure: :ao_inserts.d:
-#+name: tangle_ao_inserts
-#+BEGIN_SRC d :tangle ../lib/sdp/ao_scan_inserts.d
-/+
- inserts
- ao_inserts.d
-+/
-mixin template SiSUdocInserts() {
- private:
- struct Inserts {
- auto scan_subdoc_source(
- char[][] markup_sourcefile_insert_content,
- string fn_src
- ) {
- <<ao_inserts_scan>>
- foreach (line; markup_sourcefile_insert_content) {
- <<ao_inserts_scan_loop>>
- } // end src subdoc (inserts) loop
- <<ao_inserts_scan_post>>
- }
- auto scan_doc_source(
- char[][] markup_sourcefile_content,
- string fn_src
- ) {
- <<ao_doc_scan>>
- foreach (line; markup_sourcefile_content) {
- <<ao_doc_scan_loop>>
- } // end src doc loop
- <<ao_doc_scan_post>>
- }
- }
-}
-#+END_SRC