aboutsummaryrefslogtreecommitdiffhomepage
path: root/org/ao_abstract_doc_source.org
diff options
context:
space:
mode:
authorRalph Amissah <ralph@amissah.com>2016-06-14 22:52:15 -0400
committerRalph Amissah <ralph@amissah.com>2019-04-04 14:48:15 -0400
commit0245c394af1a4a1400f87916bd10c398005f40da (patch)
tree716c1bf10b055740e417d2d9c7283f04d94dc246 /org/ao_abstract_doc_source.org
parentconfig rearranged, more put in maker.org (diff)
step4 some additional work
Diffstat (limited to 'org/ao_abstract_doc_source.org')
-rw-r--r--org/ao_abstract_doc_source.org228
1 files changed, 116 insertions, 112 deletions
diff --git a/org/ao_abstract_doc_source.org b/org/ao_abstract_doc_source.org
index d8f2637..3c82dba 100644
--- a/org/ao_abstract_doc_source.org
+++ b/org/ao_abstract_doc_source.org
@@ -17,7 +17,7 @@
* document abstraction :abstract:process:
Process markup document, create document abstraction.
-** pre loop processing :pre:
+** 1. pre loop processing :pre:
*** imports :imports:
[[./ao_defaults.org][ao_defaults]]
@@ -159,7 +159,7 @@ scope(exit) {
}
auto type = flags_type_init;
auto dochead_make = parseJSON(header_make_jsonstr).object;
-auto dochead_metadata = parseJSON(header_metadata_jsonstr).object;
+auto dochead_meta = parseJSON(header_metadata_jsonstr).object;
mixin ScreenTxtColors;
int tell_lo(string color, int obj_cite_number, in char[] line) {
writefln(
@@ -226,7 +226,7 @@ auto heading_match_rgx = [
];
#+END_SRC
-** loop: process document body [+6] :loop:
+** 2. loop: process document body [+6] :loop:
*** loop scope :scope:
#+name: abs_in_loop_body_00
@@ -279,11 +279,12 @@ if (type["code"] == TriState.on) {
code_block(line, an_object, type);
continue;
#+END_SRC
+
**** non code objects (other blocks or regular text) [+4] :non_code:
#+name: abs_in_loop_body_00
#+BEGIN_SRC d
-} else if (!match(line, rgx.regular_parse_skip)) {
+} else if (!matchFirst(line, rgx.regular_parse_skip)) {
/+ object other than code block object (includes regular text paragraph) +/
#+END_SRC
@@ -292,10 +293,10 @@ if (type["code"] == TriState.on) {
#+name: abs_in_loop_body_non_code_obj
#+BEGIN_SRC d
-if (((match(line, rgx.heading_biblio)
+if (((matchFirst(line, rgx.heading_biblio)
|| (type["heading_biblio"] == State.on)))
-&& (!match(line, rgx.heading))
-&& (!match(line, rgx.comment))) {
+&& (!matchFirst(line, rgx.heading))
+&& (!matchFirst(line, rgx.comment))) {
/+ within block object: biblio +/
biblio_block(line, type, bib_entry, biblio_arr_json);
continue;
@@ -352,12 +353,12 @@ if (((match(line, rgx.heading_biblio)
continue;
#+END_SRC
-***** not (yet) identified as being within block group [+3]
+***** not identified as being within block group (could still be, or not) [+3]
#+name: abs_in_loop_body_non_code_obj
#+BEGIN_SRC d
} else {
-/+ not within a block group +/
+ /+ not within a block group +/
#+END_SRC
****** assert
@@ -376,8 +377,8 @@ assertions_flag_types_block_status_none_or_closed(type);
#+name: abs_in_loop_body_open_block_obj
#+BEGIN_SRC d
-if (match(line, rgx.block_open)) {
- if (match(line, (rgx.block_poem_open))) {
+if (matchFirst(line, rgx.block_open)) {
+ if (matchFirst(line, (rgx.block_poem_open))) {
/+ poem to verse exceptions! +/
object_reset(an_object);
processing.remove("verse");
@@ -415,8 +416,8 @@ if (match(line, rgx.block_open)) {
tell_l("red", line);
}
assert(
- match(line, rgx.book_index)
- || match(line, rgx.book_index_open)
+ matchFirst(line, rgx.book_index)
+ || matchFirst(line, rgx.book_index_open)
|| type["book_index"] == State.on
);
}
@@ -424,8 +425,8 @@ if (match(line, rgx.block_open)) {
******* book index :bookindex:
#+name: abs_in_loop_body_not_block_obj
#+BEGIN_SRC d
- if ((match(line, rgx.book_index))
- || (match(line, rgx.book_index_open))
+ if ((matchFirst(line, rgx.book_index))
+ || (matchFirst(line, rgx.book_index_open))
|| (type["book_index"] == State.on )) {
/+ book_index +/
book_index(line, book_idx_tmp, an_object, type);
@@ -440,7 +441,7 @@ if (match(line, rgx.block_open)) {
******** matched: comment :comment:match:
#+name: abs_in_loop_body_not_block_obj
#+BEGIN_SRC d
- if (auto m = match(line, rgx.comment)) {
+ if (auto m = matchFirst(line, rgx.comment)) {
/+ matched comment +/
debug(comment) {
tell_l("blue", line);
@@ -457,8 +458,8 @@ if (match(line, rgx.block_open)) {
******** matched: header make :header:
#+name: abs_in_loop_body_not_block_obj
#+BEGIN_SRC d
- } else if ((match(line, rgx.header_make))
- || (match(line, rgx.header_metadata))
+ } else if ((matchFirst(line, rgx.header_make))
+ || (matchFirst(line, rgx.header_metadata))
|| (type["header_make"] == State.on
&& (line_occur["header_make"] > State.off))
|| (type["header_metadata"] == State.on
@@ -489,9 +490,9 @@ if (match(line, rgx.block_open)) {
/+ heading make set +/
heading_make_set(line, line_occur, heading_match_rgx, type);
}
- if (auto m = match(line, rgx.heading)) {
+ if (matchFirst(line, rgx.heading)) {
/+ heading match +/
- heading_match(line, line_occur, an_object, lv, collapsed_lev, type);
+ heading_match(line, line_occur, an_object, lv, collapsed_lev, type, dochead_meta);
} else if (line_occur["para"] == State.off) {
/+ para match +/
para_match(line, an_object, indent, bullet, type);
@@ -585,9 +586,9 @@ if ((type["header_make"] == State.on)
&& (line_occur["header_make"] > State.off)) {
/+ header_make instructions (current line empty) +/
auto dochead_metadata_and_make =
- set_header.header_metadata_and_make_jsonstr(strip(an_object["obj"]), dochead_metadata, dochead_make);
+ set_header.header_metadata_and_make_jsonstr(strip(an_object["obj"]), dochead_meta, dochead_make);
static assert(!isTypeTuple!(dochead_metadata_and_make));
- dochead_metadata = dochead_metadata_and_make[0];
+ dochead_meta = dochead_metadata_and_make[0];
dochead_make = dochead_metadata_and_make[1];
header_set_common(line_occur, an_object, type);
processing.remove("verse");
@@ -601,9 +602,9 @@ if ((type["header_make"] == State.on)
&& (line_occur["header_metadata"] > State.off)) {
/+ header_metadata (current line empty) +/
auto dochead_metadata_and_make =
- set_header.header_metadata_and_make_jsonstr(strip(an_object["obj"]), dochead_metadata, dochead_make);
- static assert(!isTypeTuple!(dochead_metadata_and_make));
- dochead_metadata = dochead_metadata_and_make[0];
+ set_header.header_metadata_and_make_jsonstr(strip(an_object["obj"]), dochead_meta, dochead_make);
+ static assert(!isTypeTuple!(dochead_meta));
+ dochead_meta = dochead_metadata_and_make[0];
dochead_make = dochead_metadata_and_make[1];
header_set_common(line_occur, an_object, type);
type["header_make"] = State.off;
@@ -752,7 +753,7 @@ if (((contents_the_objects[$-1].is_a == "para")
}
#+END_SRC
-** post loop processing :post:
+** 3. post loop processing :post:
*** misc
@@ -923,7 +924,7 @@ auto t =
tuple(
document_the,
dochead_make,
- dochead_metadata,
+ dochead_meta,
bookindex_unordered_hashes,
biblio_ordered
);
@@ -977,15 +978,15 @@ auto header_set_common(
auto check_obj_cite_number_status(char[] line, ref int[string] type) {
if ((!line.empty) && (type["obj_cite_number_status_multi_obj"] == TriState.off)) {
/+ not multi-line object, check whether obj_cite_number is on or turned off +/
- if (match(line, rgx.obj_cite_number_block_marks)) {
+ if (matchFirst(line, rgx.obj_cite_number_block_marks)) {
/+ switch off obj_cite_number +/
- if (match(line, rgx.obj_cite_number_off_block)) {
+ if (matchFirst(line, rgx.obj_cite_number_off_block)) {
type["obj_cite_number_status_multi_obj"] = TriState.on;
debug(ocnoff) {
tell_l("fuchsia", line);
}
}
- if (match(line, rgx.obj_cite_number_off_block_dh)) {
+ if (matchFirst(line, rgx.obj_cite_number_off_block_dh)) {
type["obj_cite_number_status_multi_obj"] = TriState.closing;
debug(ocnoff) {
tell_l("fuchsia", line);
@@ -993,9 +994,9 @@ auto check_obj_cite_number_status(char[] line, ref int[string] type) {
}
} else {
if (type["obj_cite_number_status_multi_obj"] == TriState.off) {
- if (match(line, rgx.obj_cite_number_off)) {
+ if (matchFirst(line, rgx.obj_cite_number_off)) {
type["obj_cite_number_status"] = TriState.on;
- } else if (match(line, rgx.obj_cite_number_off_dh)) {
+ } else if (matchFirst(line, rgx.obj_cite_number_off_dh)) {
type["obj_cite_number_status"] = TriState.closing;
} else {
// type["obj_cite_number_status"] = TriState.closing;
@@ -1007,7 +1008,7 @@ auto check_obj_cite_number_status(char[] line, ref int[string] type) {
}
}
} else if ((!line.empty) && (type["obj_cite_number_status_multi_obj"] > TriState.off)) {
- if (auto m = match(line, rgx.obj_cite_number_off_block_close)) {
+ if (matchFirst(line, rgx.obj_cite_number_off_block_close)) {
type["obj_cite_number_status_multi_obj"] = TriState.off;
type["obj_cite_number_status"] = TriState.off;
debug(ocnoff) {
@@ -1036,7 +1037,7 @@ auto start_block(
#+name: abs_functions
#+BEGIN_SRC d
- if (match(line, rgx.block_curly_code_open)) {
+ if (matchFirst(line, rgx.block_curly_code_open)) {
/+ curly code open +/
debug(code) { // code (curly) open
writefln(
@@ -1049,7 +1050,7 @@ auto start_block(
type["blocks"] = TriState.on;
type["code"] = TriState.on;
type["curly_code"] = TriState.on;
- } else if (match(line, rgx.block_curly_poem_open)) {
+ } else if (matchFirst(line, rgx.block_curly_poem_open)) {
/+ curly poem open +/
debug(poem) { // poem (curly) open
writefln(
@@ -1065,7 +1066,7 @@ auto start_block(
type["verse_new"] = State.on;
type["poem"] = TriState.on;
type["curly_poem"] = TriState.on;
- } else if (match(line, rgx.block_curly_group_open)) {
+ } else if (matchFirst(line, rgx.block_curly_group_open)) {
/+ curly group open +/
debug(group) { // group (curly) open
writefln(
@@ -1078,7 +1079,7 @@ auto start_block(
type["blocks"] = TriState.on;
type["group"] = TriState.on;
type["curly_group"] = TriState.on;
- } else if (match(line, rgx.block_curly_block_open)) {
+ } else if (matchFirst(line, rgx.block_curly_block_open)) {
/+ curly block open +/
debug(block) { // block (curly) open
writefln(
@@ -1091,7 +1092,7 @@ auto start_block(
type["blocks"] = TriState.on;
type["block"] = TriState.on;
type["curly_block"] = TriState.on;
- } else if (match(line, rgx.block_curly_quote_open)) {
+ } else if (matchFirst(line, rgx.block_curly_quote_open)) {
/+ curly quote open +/
debug(quote) { // quote (curly) open
writefln(
@@ -1104,7 +1105,7 @@ auto start_block(
type["blocks"] = TriState.on;
type["quote"] = TriState.on;
type["curly_quote"] = TriState.on;
- } else if (match(line, rgx.block_curly_table_open)) {
+ } else if (matchFirst(line, rgx.block_curly_table_open)) {
/+ curly table open +/
debug(table) { // table (curly) open
writefln(
@@ -1123,7 +1124,7 @@ auto start_block(
#+name: abs_functions
#+BEGIN_SRC d
- } else if (match(line, rgx.block_tic_code_open)) {
+ } else if (matchFirst(line, rgx.block_tic_code_open)) {
/+ tic code open +/
debug(code) { // code (tic) open
writefln(
@@ -1136,7 +1137,7 @@ auto start_block(
type["blocks"] = TriState.on;
type["code"] = TriState.on;
type["tic_code"] = TriState.on;
- } else if (match(line, rgx.block_tic_poem_open)) {
+ } else if (matchFirst(line, rgx.block_tic_poem_open)) {
/+ tic poem open +/
debug(poem) { // poem (tic) open
writefln(
@@ -1151,7 +1152,7 @@ auto start_block(
type["verse_new"] = State.on;
type["poem"] = TriState.on;
type["tic_poem"] = TriState.on;
- } else if (match(line, rgx.block_tic_group_open)) {
+ } else if (matchFirst(line, rgx.block_tic_group_open)) {
/+ tic group open +/
debug(group) { // group (tic) open
writefln(
@@ -1164,7 +1165,7 @@ auto start_block(
type["blocks"] = TriState.on;
type["group"] = TriState.on;
type["tic_group"] = TriState.on;
- } else if (match(line, rgx.block_tic_block_open)) {
+ } else if (matchFirst(line, rgx.block_tic_block_open)) {
/+ tic block open +/
debug(block) { // block (tic) open
writefln(
@@ -1177,7 +1178,7 @@ auto start_block(
type["blocks"] = TriState.on;
type["block"] = TriState.on;
type["tic_block"] = TriState.on;
- } else if (match(line, rgx.block_tic_quote_open)) {
+ } else if (matchFirst(line, rgx.block_tic_quote_open)) {
/+ tic quote open +/
debug(quote) { // quote (tic) open
writefln(
@@ -1190,7 +1191,7 @@ auto start_block(
type["blocks"] = TriState.on;
type["quote"] = TriState.on;
type["tic_quote"] = TriState.on;
- } else if (match(line, rgx.block_tic_table_open)) {
+ } else if (matchFirst(line, rgx.block_tic_table_open)) {
/+ tic table open +/
debug(table) { // table (tic) open
writefln(
@@ -1225,7 +1226,7 @@ auto code_block(
ref int[string] type
) {
if (type["curly_code"] == TriState.on) {
- if (auto m = match(line, rgx.block_curly_code_close)) {
+ if (matchFirst(line, rgx.block_curly_code_close)) {
debug(code) { // code (curly) close
tell_l("blue", line);
}
@@ -1236,10 +1237,10 @@ auto code_block(
debug(code) { // code (curly) line
tell_l("blue", line);
}
- an_object["obj"] ~= line ~= "\n"; // code (curly) line
+ an_object["obj"] ~= line ~= "\n"; // code (curly) line
}
} else if (type["tic_code"] == TriState.on) {
- if (auto m = match(line, rgx.block_tic_close)) {
+ if (matchFirst(line, rgx.block_tic_close)) {
debug(code) { // code (tic) close
tell_l("blue", line);
}
@@ -1250,7 +1251,7 @@ auto code_block(
debug(code) { // code (tic) line
tell_l("blue", line);
}
- an_object["obj"] ~= line ~= "\n"; // code (tic) line
+ an_object["obj"] ~= line ~= "\n"; // code (tic) line
}
}
return 0;
@@ -1351,7 +1352,7 @@ auto biblio_block(
ref int bib_entry,
ref string[] biblio_arr_json
) {
- if (match(line, rgx.heading_biblio)) {
+ if (matchFirst(line, rgx.heading_biblio)) {
type["heading_biblio"] = TriState.on;
}
if (empty(line) && (bib_entry == TriState.off)) {
@@ -1366,7 +1367,7 @@ auto biblio_block(
line
);
}
- if (match(line, rgx.biblio_tags)) {
+ if (matchFirst(line, rgx.biblio_tags)) {
auto bt = match(line, rgx.biblio_tags);
bib_entry = 0;
st=to!string(bt.captures[1]);
@@ -1448,7 +1449,7 @@ auto poem_block(
string[string] obj_cite_number_poem
) {
if (type["curly_poem"] == TriState.on) {
- if (auto m = match(line, rgx.block_curly_poem_close)) {
+ if (matchFirst(line, rgx.block_curly_poem_close)) {
an_object["obj"]="verse"; // check that this is as you please
debug(poem) { // poem (curly) close
writefln(
@@ -1507,7 +1508,7 @@ auto poem_block(
obj_cite_number =
obj_cite_number_emit(type["obj_cite_number_status"]);
type["verse_new"] = State.off;
- } else if (match(line, rgx.line_delimiter_only)) {
+ } else if (matchFirst(line, rgx.line_delimiter_only)) {
verse_line = TriState.off;
type["verse_new"] = State.on;
}
@@ -1548,7 +1549,7 @@ auto poem_block(
}
}
} else if (type["tic_poem"] == TriState.on) {
- if (auto m = match(line, rgx.block_tic_close)) { // tic_poem_close
+ if (auto m = matchFirst(line, rgx.block_tic_close)) { // tic_poem_close
an_object["obj"]="verse"; // check that this is as you please
debug(poem) { // poem (curly) close
writefln(
@@ -1593,7 +1594,7 @@ auto poem_block(
obj_cite_number =
obj_cite_number_emit(type["obj_cite_number_status"]);
type["verse_new"] = State.off;
- } else if (match(line, rgx.line_delimiter_only)) {
+ } else if (matchFirst(line, rgx.line_delimiter_only)) {
type["verse_new"] = State.on;
verse_line = TriState.off;
}
@@ -1649,7 +1650,7 @@ auto group_block(
ref int[string] type
) {
if (type["curly_group"] == State.on) {
- if (match(line, rgx.block_curly_group_close)) {
+ if (matchFirst(line, rgx.block_curly_group_close)) {
debug(group) { // group (curly) close
tell_l("blue", line);
}
@@ -1663,7 +1664,7 @@ auto group_block(
an_object["obj"] ~= line ~= "\n"; // build group array (or string)
}
} else if (type["tic_group"] == TriState.on) {
- if (match(line, rgx.block_tic_close)) {
+ if (matchFirst(line, rgx.block_tic_close)) {
debug(group) { // group (tic) close
tell_l("blue", line);
}
@@ -1691,7 +1692,7 @@ auto block_block(
ref int[string] type
) {
if (type["curly_block"] == TriState.on) {
- if (match(line, rgx.block_curly_block_close)) {
+ if (matchFirst(line, rgx.block_curly_block_close)) {
debug(block) { // block (curly) close
tell_l("blue", line);
}
@@ -1705,7 +1706,7 @@ auto block_block(
an_object["obj"] ~= line ~= "\n"; // build block array (or string)
}
} else if (type["tic_block"] == TriState.on) {
- if (match(line, rgx.block_tic_close)) {
+ if (matchFirst(line, rgx.block_tic_close)) {
debug(block) { // block (tic) close
tell_l("blue", line);
}
@@ -1729,7 +1730,7 @@ auto block_block(
#+BEGIN_SRC d
auto quote_block(char[] line, ref string[string] an_object, ref int[string] type) {
if (type["curly_quote"] == TriState.on) {
- if (match(line, rgx.block_curly_quote_close)) {
+ if (matchFirst(line, rgx.block_curly_quote_close)) {
debug(quote) { // quote (curly) close
tell_l("blue", line);
}
@@ -1743,7 +1744,7 @@ auto quote_block(char[] line, ref string[string] an_object, ref int[string] type
an_object["obj"] ~= line ~= "\n"; // build quote array (or string)
}
} else if (type["tic_quote"] == TriState.on) {
- if (match(line, rgx.block_tic_close)) {
+ if (matchFirst(line, rgx.block_tic_close)) {
debug(quote) { // quote (tic) close
tell_l("blue", line);
}
@@ -1767,7 +1768,7 @@ auto quote_block(char[] line, ref string[string] an_object, ref int[string] type
#+BEGIN_SRC d
auto table_block(char[] line, ref string[string] an_object, ref int[string] type) {
if (type["curly_table"] == TriState.on) {
- if (match(line, rgx.block_curly_table_close)) {
+ if (matchFirst(line, rgx.block_curly_table_close)) {
debug(table) { // table (curly) close
tell_l("blue", line);
}
@@ -1781,7 +1782,7 @@ auto table_block(char[] line, ref string[string] an_object, ref int[string] type
an_object["obj"] ~= line ~= "\n"; // build table array (or string)
}
} else if (type["tic_table"] == TriState.on) {
- if (match(line, rgx.block_tic_close)) {
+ if (matchFirst(line, rgx.block_tic_close)) {
debug(table) { // table (tic) close
tell_l("blue", line);
}
@@ -2083,7 +2084,7 @@ auto header_extract(
ref string[string] an_object,
ref int[string] type
) {
- if (auto m = match(line, rgx.header_make)) {
+ if (matchFirst(line, rgx.header_make)) {
/+ matched header_make +/
debug(header1) { // header
tell_l("yellow", line);
@@ -2095,7 +2096,7 @@ auto header_extract(
type["para"] = State.off;
++line_occur["header_make"];
an_object["obj"] ~= line ~= "\n";
- } else if (auto m = match(line, rgx.header_metadata)) {
+ } else if (matchFirst(line, rgx.header_metadata)) {
/+ matched header_metadata +/
debug(header1) { // header
tell_l("yellow", line);
@@ -2110,7 +2111,7 @@ auto header_extract(
} else if (type["header_make"] == State.on
&& (line_occur["header_make"] > State.off)) {
/+ header_make flag set +/
- if (auto m = match(line, rgx.header_sub)) {
+ if (matchFirst(line, rgx.header_sub)) {
/+ sub-header +/
debug(header1) {
tell_l("yellow", line);
@@ -2122,7 +2123,7 @@ auto header_extract(
} else if (type["header_metadata"] == State.on
&& (line_occur["header_metadata"] > State.off)) {
/+ header_metadata flag set +/
- if (auto m = match(line, rgx.header_sub)) {
+ if (matchFirst(line, rgx.header_sub)) {
/+ sub-header +/
debug(header1) {
tell_l("yellow", line);
@@ -2246,43 +2247,43 @@ auto heading_make_set(
&& ((type["para"] == State.off)
&& (type["heading"] == State.off))) {
/+ heading make set +/
- if (match(line, heading_match_rgx["h_B"])) {
+ if (matchFirst(line, heading_match_rgx["h_B"])) {
line = "B~ " ~ line;
debug(headingsfound) {
writeln(line);
}
}
- if (match(line, heading_match_rgx["h_C"])) {
+ if (matchFirst(line, heading_match_rgx["h_C"])) {
line = "C~ " ~ line;
debug(headingsfound) {
writeln(line);
}
}
- if (match(line, heading_match_rgx["h_D"])) {
+ if (matchFirst(line, heading_match_rgx["h_D"])) {
line = "D~ " ~ line;
debug(headingsfound) {
writeln(line);
}
}
- if (match(line, heading_match_rgx["h_1"])) {
+ if (matchFirst(line, heading_match_rgx["h_1"])) {
line = "1~ " ~ line;
debug(headingsfound) {
writeln(line);
}
}
- if (match(line, heading_match_rgx["h_2"])) {
+ if (matchFirst(line, heading_match_rgx["h_2"])) {
line = "2~ " ~ line;
debug(headingsfound) {
writeln(line);
}
}
- if (match(line, heading_match_rgx["h_3"])) {
+ if (matchFirst(line, heading_match_rgx["h_3"])) {
line = "3~ " ~ line;
debug(headingsfound) {
writeln(line);
}
}
- if (match(line, heading_match_rgx["h_4"])) {
+ if (matchFirst(line, heading_match_rgx["h_4"])) {
line = "4~ " ~ line;
debug(headingsfound) {
writeln(line);
@@ -2302,7 +2303,8 @@ auto heading_match(
ref string[string] an_object,
ref int[string] lv,
ref int[string] collapsed_lev,
- ref int[string] type
+ ref int[string] type,
+ ref JSONValue[string] dochead_meta
) {
if (auto m = match(line, rgx.heading)) {
/+ heading match +/
@@ -2318,6 +2320,8 @@ auto heading_match(
assertions_doc_structure(an_object, lv); // includes most of the logic for collapsed levels
switch (an_object["lev"]) {
case "A":
+ an_object["obj"]=replaceFirst(an_object["obj"], rgx.head_value_title, to!string(dochead_meta["title"]["main"]));
+ an_object["obj"]=replaceFirst(an_object["obj"], rgx.head_value_author, to!string(dochead_meta["creator"]["author"]));
collapsed_lev["h0"] = 1;
an_object["lev_collapsed_number"] =
to!string(collapsed_lev["h0"]);
@@ -2451,7 +2455,7 @@ auto para_match(
/+ para matches +/
// paragraphs
// (fl ag_type["heading"] = true) &&
- if (auto m = match(line, rgx.para_indent)) {
+ if (auto m = matchFirst(line, rgx.para_indent)) {
debug(paraindent) { // para indent
tell_l("blue", line);
}
@@ -2460,7 +2464,7 @@ auto para_match(
indent["first"] = to!string(m.captures[1]);
indent["second"] = "0";
bullet = false;
- } else if (auto m = match(line, rgx.para_bullet)) {
+ } else if (matchFirst(line, rgx.para_bullet)) {
debug(parabullet) { // para bullet
tell_l("blue", line);
}
@@ -2469,7 +2473,7 @@ auto para_match(
indent["first"] = "0";
indent["second"] = "0";
bullet = true;
- } else if (auto m = match(line, rgx.para_indent_hang)) {
+ } else if (auto m = matchFirst(line, rgx.para_indent_hang)) {
debug(paraindenthang) { // para indent hang
tell_l("blue", line);
}
@@ -2478,7 +2482,7 @@ auto para_match(
indent["first"] = to!string(m.captures[1]);
indent["second"] = to!string(m.captures[2]);
bullet = false;
- } else if (auto m = match(line, rgx.para_bullet_indent)) {
+ } else if (auto m = matchFirst(line, rgx.para_bullet_indent)) {
debug(parabulletindent) { // para bullet indent
tell_l("blue", line);
}
@@ -2537,19 +2541,19 @@ struct ObjAttributes {
body {
auto rgx = Rgx();
obj_txt["munge"]=obj_txt_in;
- if (match(obj_txt_in, rgx.para_bullet)) {
+ if (matchFirst(obj_txt_in, rgx.para_bullet)) {
obj_txt["attrib"] =" \"bullet\": \"true\","
~ " \"indent_first\": 0,"
~ " \"indent_rest\": 0,";
- } else if (auto m = match(obj_txt_in, rgx.para_bullet_indent)) {
+ } else if (auto m = matchFirst(obj_txt_in, rgx.para_bullet_indent)) {
obj_txt["attrib"] =" \"bullet\": \"true\","
~ " \"indent_first\": " ~ to!string(m.captures[1]) ~ ","
~ " \"indent_rest\": " ~ to!string(m.captures[1]) ~ ",";
- } else if (auto m = match(obj_txt_in, rgx.para_indent_hang)) {
+ } else if (auto m = matchFirst(obj_txt_in, rgx.para_indent_hang)) {
obj_txt["attrib"] =" \"bullet\": \"false\","
~ " \"indent_first\": " ~ to!string(m.captures[1]) ~ ","
~ " \"indent_rest\": " ~ to!string(m.captures[2]) ~ ",";
- } else if (auto m = match(obj_txt_in, rgx.para_indent)) {
+ } else if (auto m = matchFirst(obj_txt_in, rgx.para_indent)) {
obj_txt["attrib"] =" \"bullet\": \"false\","
~ " \"indent_first\": " ~ to!string(m.captures[1]) ~ ","
~ " \"indent_rest\": " ~ to!string(m.captures[1]) ~ ",";
@@ -3048,14 +3052,14 @@ struct HeaderDocMetadataMakeJson {
string hm, hs;
auto header_metadata_and_make_jsonstr(
string header,
- JSONValue[string] dochead_metadata,
+ JSONValue[string] dochead_meta,
JSONValue[string] dochead_make
)
in { }
body {
scope(exit) {
destroy(header);
- destroy(dochead_metadata);
+ destroy(dochead_meta);
destroy(dochead_make);
}
if (auto t = match(header, rgx.head_main)) {
@@ -3069,13 +3073,13 @@ struct HeaderDocMetadataMakeJson {
if (auto m = match(line, rgx.head_main)) {
if (!empty(m.captures[2])) {
if (hm == "creator") {
- dochead_metadata[hm]["author"].str =
+ dochead_meta[hm]["author"].str =
to!string(m.captures[2]);
} else if (hm == "title") {
- dochead_metadata[hm]["main"].str =
+ dochead_meta[hm]["main"].str =
to!string(m.captures[2]);
} else if (hm == "publisher") {
- dochead_metadata[hm]["name"].str =
+ dochead_meta[hm]["name"].str =
to!string(m.captures[2]);
}
}
@@ -3099,12 +3103,12 @@ struct HeaderDocMetadataMakeJson {
default:
break;
}
- } else if (dochead_metadata[hm].type() == JSON_TYPE.OBJECT) {
+ } else if (dochead_meta[hm].type() == JSON_TYPE.OBJECT) {
switch (hm) {
case "creator":
if (match(hs, rgx.subhead_creator)) {
- if (dochead_metadata[hm][hs].type() == JSON_TYPE.STRING) {
- dochead_metadata[hm][hs].str =
+ if (dochead_meta[hm][hs].type() == JSON_TYPE.STRING) {
+ dochead_meta[hm][hs].str =
to!string(s.captures[2]);
}
} else {
@@ -3116,11 +3120,11 @@ struct HeaderDocMetadataMakeJson {
case "title":
if (match(hs, rgx.subhead_title)) {
if ((hs == "subtitle")
- && (dochead_metadata[hm]["sub"].type() == JSON_TYPE.STRING)) {
- dochead_metadata[hm]["sub"].str =
+ && (dochead_meta[hm]["sub"].type() == JSON_TYPE.STRING)) {
+ dochead_meta[hm]["sub"].str =
to!string(s.captures[2]);
- } else if (dochead_metadata[hm][hs].type() == JSON_TYPE.STRING) {
- dochead_metadata[hm][hs].str =
+ } else if (dochead_meta[hm][hs].type() == JSON_TYPE.STRING) {
+ dochead_meta[hm][hs].str =
to!string(s.captures[2]);
}
} else {
@@ -3131,8 +3135,8 @@ struct HeaderDocMetadataMakeJson {
break;
case "rights":
if (match(hs, rgx.subhead_rights)) {
- if (dochead_metadata[hm][hs].type() == JSON_TYPE.STRING) {
- dochead_metadata[hm][hs].str =
+ if (dochead_meta[hm][hs].type() == JSON_TYPE.STRING) {
+ dochead_meta[hm][hs].str =
to!string(s.captures[2]);
}
} else {
@@ -3143,8 +3147,8 @@ struct HeaderDocMetadataMakeJson {
break;
case "date":
if (match(hs, rgx.subhead_date)) {
- if (dochead_metadata[hm][hs].type() == JSON_TYPE.STRING) {
- dochead_metadata[hm][hs].str =
+ if (dochead_meta[hm][hs].type() == JSON_TYPE.STRING) {
+ dochead_meta[hm][hs].str =
to!string(s.captures[2]);
}
} else {
@@ -3155,8 +3159,8 @@ struct HeaderDocMetadataMakeJson {
break;
case "original":
if (match(hs, rgx.subhead_original)) {
- if (dochead_metadata[hm][hs].type() == JSON_TYPE.STRING) {
- dochead_metadata[hm][hs].str =
+ if (dochead_meta[hm][hs].type() == JSON_TYPE.STRING) {
+ dochead_meta[hm][hs].str =
to!string(s.captures[2]);
}
} else {
@@ -3167,8 +3171,8 @@ struct HeaderDocMetadataMakeJson {
break;
case "classify":
if (match(hs, rgx.subhead_classify)) {
- if (dochead_metadata[hm][hs].type() == JSON_TYPE.STRING) {
- dochead_metadata[hm][hs].str =
+ if (dochead_meta[hm][hs].type() == JSON_TYPE.STRING) {
+ dochead_meta[hm][hs].str =
to!string(s.captures[2]);
}
} else {
@@ -3179,8 +3183,8 @@ struct HeaderDocMetadataMakeJson {
break;
case "identifier":
if (match(hs, rgx.subhead_identifier)) {
- if (dochead_metadata[hm][hs].type() == JSON_TYPE.STRING) {
- dochead_metadata[hm][hs].str =
+ if (dochead_meta[hm][hs].type() == JSON_TYPE.STRING) {
+ dochead_meta[hm][hs].str =
to!string(s.captures[2]);
}
} else {
@@ -3191,8 +3195,8 @@ struct HeaderDocMetadataMakeJson {
break;
case "notes":
if (match(hs, rgx.subhead_notes)) {
- if (dochead_metadata[hm][hs].type() == JSON_TYPE.STRING) {
- dochead_metadata[hm][hs].str =
+ if (dochead_meta[hm][hs].type() == JSON_TYPE.STRING) {
+ dochead_meta[hm][hs].str =
to!string(s.captures[2]);
}
} else {
@@ -3203,8 +3207,8 @@ struct HeaderDocMetadataMakeJson {
break;
case "publisher":
if (match(hs, rgx.subhead_publisher)) {
- if (dochead_metadata[hm][hs].type() == JSON_TYPE.STRING) {
- dochead_metadata[hm][hs].str =
+ if (dochead_meta[hm][hs].type() == JSON_TYPE.STRING) {
+ dochead_meta[hm][hs].str =
to!string(s.captures[2]);
}
} else {
@@ -3217,8 +3221,8 @@ struct HeaderDocMetadataMakeJson {
destroy(hm);
destroy(hs);
// if (match(hs, rgx.subhead_links)) {
- // if (dochead_metadata[hm][hs].type() == JSON_TYPE.STRING) {
- // dochead_metadata[hm][hs].str = to!string(s.captures[2]);
+ // if (dochead_meta[hm][hs].type() == JSON_TYPE.STRING) {
+ // dochead_meta[hm][hs].str = to!string(s.captures[2]);
// }
// } else {
// writeln("not a valid header type:", hm, ":", hs);
@@ -3237,7 +3241,7 @@ struct HeaderDocMetadataMakeJson {
writeln("not a valid header type:", hm);
}
}
- auto t = tuple(dochead_metadata, dochead_make);
+ auto t = tuple(dochead_meta, dochead_make);
static assert(!isTypeTuple!(t));
return t;
}