diff options
author | Ralph Amissah <ralph@amissah.com> | 2017-07-20 06:13:50 -0400 |
---|---|---|
committer | Ralph Amissah <ralph@amissah.com> | 2019-04-10 15:14:14 -0400 |
commit | cad1a09a1ed2494947dd35aaf4592fbbee5fbff1 (patch) | |
tree | 64da0edd3826ab6d86aa3475ef6162bd9c6bef21 | |
parent | static, liberal use of keyword (diff) |
naming things
-rw-r--r-- | org/default_misc.org | 64 | ||||
-rw-r--r-- | org/meta_abstraction.org | 599 | ||||
-rw-r--r-- | src/sdp/meta/defaults.d | 64 | ||||
-rw-r--r-- | src/sdp/meta/metadoc_from_src.d | 599 |
4 files changed, 660 insertions, 666 deletions
diff --git a/org/default_misc.org b/org/default_misc.org index fdba922..50d3b9c 100644 --- a/org/default_misc.org +++ b/org/default_misc.org @@ -396,38 +396,38 @@ template SiSUrgxInitFlags() { /+ regex flags +/ static int[string] flags_type_init() { int[string] flags_type_init = [ - "make_headings" : 0, - "header_make" : 0, - "header_meta" : 0, - "heading" : 0, - "biblio_section" : 0, - "glossary_section" : 0, - "blurb_section" : 0, - "para" : 0, - "blocks" : 0, // 0..2 generic - "code" : 0, // 0..2 - "poem" : 0, // 0..2 - "table" : 0, // 0..2 - "group" : 0, // 0..2 - "block" : 0, // 0..2 - "quote" : 0, // 0..2 - "verse_new" : 0, - "curly_code" : 0, - "curly_poem" : 0, - "curly_group" : 0, - "curly_block" : 0, - "curly_quote" : 0, - "curly_table" : 0, - "curly_table_special_markup" : 0, - "tic_code" : 0, - "tic_poem" : 0, - "tic_group" : 0, - "tic_block" : 0, - "tic_quote" : 0, - "tic_table" : 0, - "ocn_status" : 0, // 0 obj_cite_number; 1 no obj_cite_number; 2 no obj_cite_number & dummy headings - "ocn_status_multi_obj" : 0, // 0 obj_cite_number; 1 no obj_cite_number; 2 no obj_cite_number & dummy headings - "book_index" : 0, + "make_headings" : 0, + "header_make" : 0, + "header_meta" : 0, + "heading" : 0, + "biblio_section" : 0, + "glossary_section" : 0, + "blurb_section" : 0, + "para" : 0, + "blocks" : 0, // 0..2 generic + "code" : 0, // 0..2 + "poem" : 0, // 0..2 + "table" : 0, // 0..2 + "group" : 0, // 0..2 + "block" : 0, // 0..2 + "quote" : 0, // 0..2 + "verse_new" : 0, + "curly_code" : 0, + "curly_poem" : 0, + "curly_group" : 0, + "curly_block" : 0, + "curly_quote" : 0, + "curly_table" : 0, + "curly_table_special_markup" : 0, + "tic_code" : 0, + "tic_poem" : 0, + "tic_group" : 0, + "tic_block" : 0, + "tic_quote" : 0, + "tic_table" : 0, + "ocn_status" : 0, // 0 obj_cite_number; 1 no obj_cite_number; 2 no obj_cite_number & dummy headings + "ocn_status_off_for_multiple_objects" : 0, // 0 obj_cite_number; 1 no obj_cite_number; 2 no obj_cite_number & dummy headings + "book_index" : 0, ]; return flags_type_init; } diff --git a/org/meta_abstraction.org b/org/meta_abstraction.org index cf86961..d017407 100644 --- a/org/meta_abstraction.org +++ b/org/meta_abstraction.org @@ -56,7 +56,7 @@ template SiSUdocAbstraction() { foreach (line; markup_sourcefile_content) { /+ ↓ markup document/text line by line +/ <<abs_in_loop_body_00>> - if (type["code"] == TriState.on) { + if (obj_type_status["code"] == TriState.on) { <<abs_in_loop_body_00_code_block>> } else if (!matchFirst(line, rgx.skip_from_regular_parse)) { /+ object other than "code block" object @@ -72,7 +72,7 @@ template SiSUdocAbstraction() { /+ line not empty +/ /+ non blocks (headings, paragraphs) & closed blocks +/ <<abs_in_loop_body_not_block_obj>> - } else if (type["blocks"] == TriState.closing) { + } else if (obj_type_status["blocks"] == TriState.closing) { /+ line empty, with blocks flag +/ <<abs_in_loop_body_not_block_obj_line_empty_blocks_flags>> } else { @@ -438,7 +438,7 @@ line_occur = [ "glossary" : 0, "blurb" : 0, ]; -auto type = flags_type_init; +auto obj_type_status = flags_type_init; string[string] obj_cite_number_poem = [ "start" : "", "end" : "" @@ -560,7 +560,7 @@ debug(srclines) { #+name: abs_in_loop_body_00 #+BEGIN_SRC d if (!line.empty) { - type = _check_ocn_status_(line, type); + obj_type_status = _check_ocn_status_(line, obj_type_status); } #+END_SRC @@ -570,7 +570,7 @@ if (!line.empty) { #+name: abs_in_loop_body_00_code_block #+BEGIN_SRC d /+ block object: code +/ -_code_block_(line, an_object, type); +_code_block_(line, an_object, obj_type_status); continue; #+END_SRC @@ -581,16 +581,16 @@ continue; #+name: abs_in_loop_body_non_code_obj #+BEGIN_SRC d if (line.matchFirst(rgx.heading_biblio) -|| (type["biblio_section"] == State.on +|| (obj_type_status["biblio_section"] == State.on && (!(line.matchFirst(rgx.heading_blurb_glossary))) && (!(line.matchFirst(rgx.heading))) && (!(line.matchFirst(rgx.comment))))) { /+ within section (block object): biblio +/ - type["glossary_section"] = State.off; - type["biblio_section"] = State.on; - type["blurb_section"] = State.off; + obj_type_status["glossary_section"] = State.off; + obj_type_status["biblio_section"] = State.on; + obj_type_status["blurb_section"] = State.off; if (opt_action["backmatter"] && opt_action["section_biblio"]) { - _biblio_block_(line, type, bib_entry, biblio_entry_str_json, biblio_arr_json); + _biblio_block_(line, obj_type_status, bib_entry, biblio_entry_str_json, biblio_arr_json); debug(bibliobuild) { writeln("- ", biblio_entry_str_json); writeln("-> ", biblio_arr_json.length); @@ -611,7 +611,7 @@ if there is a glossary section you need to: #+name: abs_in_loop_body_non_code_obj #+BEGIN_SRC d } else if (line.matchFirst(rgx.heading_glossary) -|| (type["glossary_section"] == State.on +|| (obj_type_status["glossary_section"] == State.on && (!(line.matchFirst(rgx.heading_biblio_blurb))) && (!(line.matchFirst(rgx.heading))) && (!(line.matchFirst(rgx.comment))))) { @@ -620,16 +620,16 @@ if there is a glossary section you need to: writeln(__LINE__); writeln(line); } - type["glossary_section"] = State.on; - type["biblio_section"] = State.off; - type["blurb_section"] = State.off; + obj_type_status["glossary_section"] = State.on; + obj_type_status["biblio_section"] = State.off; + obj_type_status["blurb_section"] = State.off; if (opt_action["backmatter"] && opt_action["section_glossary"]) { indent=[ "hang_position" : 0, "base_position" : 0, ]; bullet = false; - type["para"] = State.on; + obj_type_status["para"] = State.on; line_occur["para"] = State.off; an_object_key="glossary_nugget"; // if (line.matchFirst(rgx.heading_glossary)) { @@ -667,7 +667,7 @@ if there is a glossary section you need to: comp_obj_heading_.anchor_tags = ["glossary"]; the_glossary_section ~= comp_obj_heading_; } else { - _para_match_(line, an_object, an_object_key, indent, bullet, type, line_occur); + _para_match_(line, an_object, an_object_key, indent, bullet, obj_type_status, line_occur); comp_obj_para = comp_obj_para.init; comp_obj_para.use = "backmatter"; comp_obj_para.is_of = "para"; @@ -680,7 +680,7 @@ if there is a glossary section you need to: comp_obj_para.bullet = bullet; the_glossary_section ~= comp_obj_para; } - type["ocn_status"] = TriState.off; + obj_type_status["ocn_status"] = TriState.off; } continue; #+END_SRC @@ -697,7 +697,7 @@ if there is a blurb section you need to: #+name: abs_in_loop_body_non_code_obj #+BEGIN_SRC d } else if (line.matchFirst(rgx.heading_blurb) -|| (type["blurb_section"] == State.on +|| (obj_type_status["blurb_section"] == State.on && (!(line.matchFirst(rgx.heading_biblio_glossary))) && (!(line.matchFirst(rgx.heading))) && (!(line.matchFirst(rgx.comment))))) { @@ -706,16 +706,16 @@ if there is a blurb section you need to: writeln(__LINE__); writeln(line); } - type["glossary_section"] = State.off; - type["biblio_section"] = State.off; - type["blurb_section"] = State.on; + obj_type_status["glossary_section"] = State.off; + obj_type_status["biblio_section"] = State.off; + obj_type_status["blurb_section"] = State.on; if (opt_action["backmatter"] && opt_action["section_blurb"]) { indent=[ "hang_position" : 0, "base_position" : 0, ]; bullet = false; - type["para"] = State.on; + obj_type_status["para"] = State.on; line_occur["para"] = State.off; an_object_key="blurb_nugget"; if (line.matchFirst(rgx.heading_blurb)) { @@ -769,7 +769,7 @@ if there is a blurb section you need to: comp_obj_heading_.parent_lev_markup = 0; the_blurb_section ~= comp_obj_heading_; } else { - _para_match_(line, an_object, an_object_key, indent, bullet, type, line_occur); + _para_match_(line, an_object, an_object_key, indent, bullet, obj_type_status, line_occur); comp_obj_para = comp_obj_para.init; comp_obj_para.use = "backmatter"; comp_obj_para.is_of = "para"; @@ -782,7 +782,7 @@ if there is a blurb section you need to: comp_obj_para.bullet = bullet; the_blurb_section ~= comp_obj_para; } - type["ocn_status"] = TriState.off; + obj_type_status["ocn_status"] = TriState.off; } continue; #+END_SRC @@ -792,9 +792,9 @@ if there is a blurb section you need to: #+name: abs_in_loop_body_non_code_obj #+BEGIN_SRC d -} else if (type["quote"] == TriState.on) { +} else if (obj_type_status["quote"] == TriState.on) { /+ within block object: quote +/ - _quote_block_(line, an_object, type); + _quote_block_(line, an_object, obj_type_status); continue; #+END_SRC @@ -803,11 +803,11 @@ if there is a blurb section you need to: #+name: abs_in_loop_body_non_code_obj #+BEGIN_SRC d /+ within block object: group +/ -} else if (type["group"] == TriState.on) { +} else if (obj_type_status["group"] == TriState.on) { /+ within block object: group +/ line = (line) .replaceAll(rgx.para_delimiter, mkup.br_paragraph ~ "$1"); - _group_block_(line, an_object, type); + _group_block_(line, an_object, obj_type_status); continue; #+END_SRC @@ -815,7 +815,7 @@ if there is a blurb section you need to: #+name: abs_in_loop_body_non_code_obj #+BEGIN_SRC d -} else if (type["block"] == TriState.on) { +} else if (obj_type_status["block"] == TriState.on) { /+ within block object: block +/ if (auto m = line.match(rgx.spaces_line_start)) { line = (line) @@ -825,7 +825,7 @@ if there is a blurb section you need to: line = (line) .replaceAll(rgx.spaces_multiple, (m.captures[1]).translate([ ' ' : mkup.nbsp ])); } - _block_block_(line, an_object, type); + _block_block_(line, an_object, obj_type_status); continue; #+END_SRC @@ -833,9 +833,9 @@ if there is a blurb section you need to: #+name: abs_in_loop_body_non_code_obj #+BEGIN_SRC d -} else if (type["poem"] == TriState.on) { +} else if (obj_type_status["poem"] == TriState.on) { /+ within block object: poem +/ - _poem_block_(line, an_object, type, cntr, obj_cite_number_poem, dochead_make_aa); + _poem_block_(line, an_object, obj_type_status, cntr, obj_cite_number_poem, dochead_make_aa); continue; #+END_SRC @@ -843,9 +843,9 @@ if there is a blurb section you need to: #+name: abs_in_loop_body_non_code_obj #+BEGIN_SRC d -} else if (type["table"] == TriState.on) { +} else if (obj_type_status["table"] == TriState.on) { /+ within block object: table +/ - _table_block_(line, an_object, type, dochead_make_aa); + _table_block_(line, an_object, obj_type_status, dochead_make_aa); continue; #+END_SRC @@ -855,11 +855,11 @@ if there is a blurb section you need to: #+name: abs_in_loop_body_open_block_obj_assert #+BEGIN_SRC d assert( - (type["blocks"] == TriState.off) - || (type["blocks"] == TriState.closing), + (obj_type_status["blocks"] == TriState.off) + || (obj_type_status["blocks"] == TriState.closing), "block status: none or closed" ); -assertions_flag_types_block_status_none_or_closed(type); +assertions_flag_types_block_status_none_or_closed(obj_type_status); #+END_SRC ****** catch misc +block open+ @@ -872,7 +872,7 @@ if (line.matchFirst(rgx.block_poem_open)) { processing.remove("verse"); obj_cite_number_poem["start"] = obj_cite_number.to!string; } -_start_block_(line, type, obj_cite_number_poem); +_start_block_(line, obj_type_status, obj_cite_number_poem); continue; #+END_SRC @@ -886,11 +886,11 @@ assert( "line tested, line not empty surely:\n \"" ~ line ~ "\"" ); assert( - (type["blocks"] == TriState.off) - || (type["blocks"] == TriState.closing), + (obj_type_status["blocks"] == TriState.off) + || (obj_type_status["blocks"] == TriState.closing), "code block status: none or closed" ); -if (type["blocks"] == TriState.closing) { +if (obj_type_status["blocks"] == TriState.closing) { debug(check) { // block writeln(__LINE__); writeln(line); @@ -898,7 +898,7 @@ if (type["blocks"] == TriState.closing) { assert( line.matchFirst(rgx.book_index) || line.matchFirst(rgx.book_index_open) - || type["book_index"] == State.on, + || obj_type_status["book_index"] == State.on, "\nblocks closed, unless followed by book index, non-matching line:\n \"" ~ line ~ "\"" ); @@ -911,9 +911,9 @@ if (type["blocks"] == TriState.closing) { #+BEGIN_SRC d if (line.matchFirst(rgx.book_index) || line.matchFirst(rgx.book_index_open) -|| type["book_index"] == State.on ) { +|| obj_type_status["book_index"] == State.on ) { /+ book_index +/ - _book_index_(line, book_idx_tmp, an_object, type, opt_action); + _book_index_(line, book_idx_tmp, an_object, obj_type_status, opt_action); #+END_SRC ******* not book index [+1] @@ -941,7 +941,7 @@ if (line.matchFirst(rgx.book_index) comp_obj_comment.is_a = "comment"; comp_obj_comment.text = an_object[an_object_key].strip; the_document_body_section ~= comp_obj_comment; - _common_reset_(line_occur, an_object, type); + _common_reset_(line_occur, an_object, obj_type_status); processing.remove("verse"); ++cntr; #+END_SRC @@ -952,21 +952,21 @@ if (line.matchFirst(rgx.book_index) #+BEGIN_SRC d } else if (((line_occur["para"] == State.off) && (line_occur["heading"] == State.off)) - && ((type["para"] == State.off) - && (type["heading"] == State.off))) { + && ((obj_type_status["para"] == State.off) + && (obj_type_status["heading"] == State.off))) { /+ heading or para but neither flag nor line exists +/ if ((dochead_make_aa["make"]["headings"].length > 2) - && (type["make_headings"] == State.off)) { + && (obj_type_status["make_headings"] == State.off)) { /+ heading found +/ - _heading_found_(line, dochead_make_aa["make"]["headings"], heading_match_str, heading_match_rgx, type); + _heading_found_(line, dochead_make_aa["make"]["headings"], heading_match_str, heading_match_rgx, obj_type_status); } - if ((type["make_headings"] == State.on) + if ((obj_type_status["make_headings"] == State.on) && ((line_occur["para"] == State.off) && (line_occur["heading"] == State.off)) - && ((type["para"] == State.off) - && (type["heading"] == State.off))) { + && ((obj_type_status["para"] == State.off) + && (obj_type_status["heading"] == State.off))) { /+ heading make set +/ - line = _heading_make_set_(line, line_occur, heading_match_rgx, type); + line = _heading_make_set_(line, line_occur, heading_match_rgx, obj_type_status); } /+ TODO node info: all headings identified at this point, - extract node info here?? @@ -976,11 +976,11 @@ if (line.matchFirst(rgx.book_index) +/ if (line.matchFirst(rgx.heading)) { /+ heading match +/ - _heading_matched_(line, line_occur, an_object, an_object_key, lv, collapsed_lev, type, dochead_meta_aa); + _heading_matched_(line, line_occur, an_object, an_object_key, lv, collapsed_lev, obj_type_status, dochead_meta_aa); } else if (line_occur["para"] == State.off) { /+ para match +/ an_object_key="body_nugget"; - _para_match_(line, an_object, an_object_key, indent, bullet, type, line_occur); + _para_match_(line, an_object, an_object_key, indent, bullet, obj_type_status, line_occur); } #+END_SRC @@ -1025,7 +1025,7 @@ _block_flag_line_empty_( obj_cite_number, comp_obj_heading, cntr, - type, + obj_type_status, obj_cite_number_poem, dochead_make_aa ); @@ -1042,7 +1042,7 @@ assert( ~ line ~ "\"" ); assert( - (type["blocks"] == State.off), + (obj_type_status["blocks"] == State.off), "code block status: none" ); #+END_SRC @@ -1051,12 +1051,12 @@ assert( #+name: abs_in_loop_body_not_block_obj_line_empty #+BEGIN_SRC d -if ((type["heading"] == State.on) +if ((obj_type_status["heading"] == State.on) && (line_occur["heading"] > State.off)) { /+ heading object (current line empty) +/ obj_cite_number = (an_object["lev_markup_number"].to!int == 0) ? (ocn_emit(3)) - : (obj_cite_number = ocn_emit(type["ocn_status"])); + : (obj_cite_number = ocn_emit(obj_type_status["ocn_status"])); an_object["is"] = "heading"; an_object_key="body_nugget"; auto substantive_object_and_anchor_tags_tuple = @@ -1139,7 +1139,7 @@ if ((type["heading"] == State.on) debug(objectrelated1) { // check writeln(line); } - _common_reset_(line_occur, an_object, type); + _common_reset_(line_occur, an_object, obj_type_status); an_object.remove("lev"); an_object.remove("lev_markup_number"); processing.remove("verse"); @@ -1150,10 +1150,10 @@ if ((type["heading"] == State.on) #+name: abs_in_loop_body_not_block_obj_line_empty #+BEGIN_SRC d -} else if ((type["para"] == State.on) +} else if ((obj_type_status["para"] == State.on) && (line_occur["para"] > State.off)) { /+ paragraph object (current line empty) +/ - obj_cite_number = ocn_emit(type["ocn_status"]); + obj_cite_number = ocn_emit(obj_type_status["ocn_status"]); an_object["bookindex_nugget"] = ("bookindex_nugget" in an_object) ? an_object["bookindex_nugget"] : ""; bookindex_unordered_hashes = @@ -1187,7 +1187,7 @@ if ((type["heading"] == State.on) comp_obj_para.inline_notes_star = substantive_obj_misc_tuple[sObj.notes_star]; comp_obj_para.inline_links = substantive_obj_misc_tuple[sObj.links]; the_document_body_section ~= comp_obj_para; - _common_reset_(line_occur, an_object, type); + _common_reset_(line_occur, an_object, obj_type_status); indent=[ "hang_position" : 0, "base_position" : 0, @@ -1218,9 +1218,9 @@ if (the_document_body_section.length > 0) { && (the_document_body_section.length > previous_length)) { if ((the_document_body_section[$-1].is_a == "heading") && (the_document_body_section[$-1].heading_lev_markup < 5)) { - type["biblio_section"] = State.off; - type["glossary_section"] = State.off; - type["blurb_section"] = State.off; + obj_type_status["biblio_section"] = State.off; + obj_type_status["glossary_section"] = State.off; + obj_type_status["blurb_section"] = State.off; } if (the_document_body_section[$-1].is_a == "verse") { /+ scan for endnotes for whole poem (each verse in poem) +/ @@ -2174,9 +2174,6 @@ comp_obj_heading_.parent_ocn = 0; comp_obj_heading_.parent_lev_markup = 0; comp_obj_heading_.dom_markedup = dom_markedup.dup; comp_obj_heading_.dom_collapsed = dom_collapsed.dup; -obj_dom_set_markup_tags(comp_obj_heading_, dom_markedup, 0); -obj_dom_set_collapsed_tags(comp_obj_heading_, dom_collapsed, 0); -obj_heading_ancestors(comp_obj_heading_, lv_ancestors_txt); comp_obj_heading_ = obj_dom_set_markup_tags(comp_obj_heading_, dom_markedup, 0); comp_obj_heading_ = obj_dom_set_collapsed_tags(comp_obj_heading_, dom_collapsed, 0); comp_obj_heading_ = obj_heading_ancestors(comp_obj_heading_, lv_ancestors_txt); @@ -2327,17 +2324,17 @@ static auto object_reset(O)(O an_object) { auto _common_reset_(L,O,T)( return ref L line_occur, return ref O an_object, - return ref T type + return ref T obj_type_status ) { debug(asserts) { - static assert(is(typeof(line_occur) == int[string])); - static assert(is(typeof(an_object) == string[string])); - static assert(is(typeof(type) == int[string])); - } - line_occur["heading"] = State.off; - line_occur["para"] = State.off; - type["heading"] = State.off; - type["para"] = State.off; + static assert(is(typeof(line_occur) == int[string])); + static assert(is(typeof(an_object) == string[string])); + static assert(is(typeof(obj_type_status) == int[string])); + } + line_occur["heading"] = State.off; + line_occur["para"] = State.off; + obj_type_status["heading"] = State.off; + obj_type_status["para"] = State.off; an_object = object_reset(an_object); } #+END_SRC @@ -2348,53 +2345,53 @@ auto _common_reset_(L,O,T)( #+BEGIN_SRC d static auto _check_ocn_status_(L,T)( L line, - T type + T obj_type_status ) { debug(asserts) { static assert(is(typeof(line) == char[])); - static assert(is(typeof(type) == int[string])); + static assert(is(typeof(obj_type_status) == int[string])); } static auto rgx = Rgx(); - if ((!line.empty) && (type["ocn_status_multi_obj"] == TriState.off)) { + if ((!line.empty) && (obj_type_status["ocn_status_off_for_multiple_objects"] == TriState.off)) { /+ not multi-line object, check whether obj_cite_number is on or turned off +/ if (line.matchFirst(rgx.obj_cite_number_block_marks)) { /+ switch off obj_cite_number +/ if (line.matchFirst(rgx.obj_cite_number_off_block)) { - type["ocn_status_multi_obj"] = TriState.on; + obj_type_status["ocn_status_off_for_multiple_objects"] = TriState.on; debug(ocnoff) { writeln(line); } } if (line.matchFirst(rgx.obj_cite_number_off_block_dh)) { - type["ocn_status_multi_obj"] = TriState.closing; + obj_type_status["ocn_status_off_for_multiple_objects"] = TriState.closing; debug(ocnoff) { writeln(line); } } } else { - if (type["ocn_status_multi_obj"] == TriState.off) { + if (obj_type_status["ocn_status_off_for_multiple_objects"] == TriState.off) { if (line.matchFirst(rgx.obj_cite_number_off)) { - type["ocn_status"] = TriState.on; + obj_type_status["ocn_status"] = TriState.on; } else if (line.matchFirst(rgx.obj_cite_number_off_dh)) { - type["ocn_status"] = TriState.closing; + obj_type_status["ocn_status"] = TriState.closing; } else { - type["ocn_status"] = TriState.off; + obj_type_status["ocn_status"] = TriState.off; } } else { - type["ocn_status"] = - type["ocn_status_multi_obj"]; + obj_type_status["ocn_status"] = + obj_type_status["ocn_status_off_for_multiple_objects"]; } } - } else if ((!line.empty) && (type["ocn_status_multi_obj"] > TriState.off)) { + } else if ((!line.empty) && (obj_type_status["ocn_status_off_for_multiple_objects"] > TriState.off)) { if (line.matchFirst(rgx.obj_cite_number_off_block_close)) { - type["ocn_status_multi_obj"] = TriState.off; - type["ocn_status"] = TriState.off; + obj_type_status["ocn_status_off_for_multiple_objects"] = TriState.off; + obj_type_status["ocn_status"] = TriState.off; debug(ocnoff) { writeln(line); } } } - return type; + return obj_type_status; } #+END_SRC @@ -2406,12 +2403,12 @@ static auto _check_ocn_status_(L,T)( #+BEGIN_SRC d void _start_block_(L,T,N)( L line, - return ref T type, + return ref T obj_type_status, return ref N obj_cite_number_poem ) { debug(asserts) { static assert(is(typeof(line) == char[])); - static assert(is(typeof(type) == int[string])); + static assert(is(typeof(obj_type_status) == int[string])); static assert(is(typeof(obj_cite_number_poem) == string[string])); } #+END_SRC @@ -2433,9 +2430,9 @@ void _start_block_(L,T,N)( line ); } - type["blocks"] = TriState.on; - type["code"] = TriState.on; - type["curly_code"] = TriState.on; + obj_type_status["blocks"] = TriState.on; + obj_type_status["code"] = TriState.on; + obj_type_status["curly_code"] = TriState.on; } else if (line.matchFirst(rgx.block_curly_poem_open)) { /+ curly poem open +/ debug(poem) { // poem (curly) open @@ -2446,10 +2443,10 @@ void _start_block_(L,T,N)( } obj_cite_number_poem["start"] = obj_cite_number.to!string; - type["blocks"] = TriState.on; - type["verse_new"] = State.on; - type["poem"] = TriState.on; - type["curly_poem"] = TriState.on; + obj_type_status["blocks"] = TriState.on; + obj_type_status["verse_new"] = State.on; + obj_type_status["poem"] = TriState.on; + obj_type_status["curly_poem"] = TriState.on; } else if (line.matchFirst(rgx.block_curly_group_open)) { /+ curly group open +/ debug(group) { // group (curly) open @@ -2458,9 +2455,9 @@ void _start_block_(L,T,N)( line ); } - type["blocks"] = TriState.on; - type["group"] = TriState.on; - type["curly_group"] = TriState.on; + obj_type_status["blocks"] = TriState.on; + obj_type_status["group"] = TriState.on; + obj_type_status["curly_group"] = TriState.on; } else if (line.matchFirst(rgx.block_curly_block_open)) { /+ curly block open +/ debug(block) { // block (curly) open @@ -2469,9 +2466,9 @@ void _start_block_(L,T,N)( line ); } - type["blocks"] = TriState.on; - type["block"] = TriState.on; - type["curly_block"] = TriState.on; + obj_type_status["blocks"] = TriState.on; + obj_type_status["block"] = TriState.on; + obj_type_status["curly_block"] = TriState.on; } else if (line.matchFirst(rgx.block_curly_quote_open)) { /+ curly quote open +/ debug(quote) { // quote (curly) open @@ -2480,9 +2477,9 @@ void _start_block_(L,T,N)( line ); } - type["blocks"] = TriState.on; - type["quote"] = TriState.on; - type["curly_quote"] = TriState.on; + obj_type_status["blocks"] = TriState.on; + obj_type_status["quote"] = TriState.on; + obj_type_status["curly_quote"] = TriState.on; } else if (auto m = line.matchFirst(rgx.block_curly_table_open)) { /+ curly table open +/ debug(table) { // table (curly) open @@ -2491,18 +2488,18 @@ void _start_block_(L,T,N)( line ); } - an_object["table_head"] = m.captures[1].to!string; - an_object["block_type"] = "curly"; - type["blocks"] = TriState.on; - type["table"] = TriState.on; - type["curly_table"] = TriState.on; + an_object["table_head"] = m.captures[1].to!string; + an_object["block_type"] = "curly"; + obj_type_status["blocks"] = TriState.on; + obj_type_status["table"] = TriState.on; + obj_type_status["curly_table"] = TriState.on; } else if (auto m = line.matchFirst(rgx.block_curly_table_special_markup)) { /+ table: special table block markup syntax! +/ - an_object["table_head"] = m.captures[1].to!string; - an_object["block_type"] = "special"; - type["blocks"] = TriState.on; - type["table"] = TriState.on; - type["curly_table_special_markup"] = TriState.on; + an_object["table_head"] = m.captures[1].to!string; + an_object["block_type"] = "special"; + obj_type_status["blocks"] = TriState.on; + obj_type_status["table"] = TriState.on; + obj_type_status["curly_table_special_markup"] = TriState.on; #+END_SRC ***** block (various) tic open :tic: @@ -2519,9 +2516,9 @@ void _start_block_(L,T,N)( line ); } - type["blocks"] = TriState.on; - type["code"] = TriState.on; - type["tic_code"] = TriState.on; + obj_type_status["blocks"] = TriState.on; + obj_type_status["code"] = TriState.on; + obj_type_status["tic_code"] = TriState.on; } else if (line.matchFirst(rgx.block_tic_poem_open)) { /+ tic poem open +/ debug(poem) { // poem (tic) open @@ -2531,10 +2528,10 @@ void _start_block_(L,T,N)( ); } obj_cite_number_poem["start"] = obj_cite_number.to!string; - type["blocks"] = TriState.on; - type["verse_new"] = State.on; - type["poem"] = TriState.on; - type["tic_poem"] = TriState.on; + obj_type_status["blocks"] = TriState.on; + obj_type_status["verse_new"] = State.on; + obj_type_status["poem"] = TriState.on; + obj_type_status["tic_poem"] = TriState.on; } else if (line.matchFirst(rgx.block_tic_group_open)) { /+ tic group open +/ debug(group) { // group (tic) open @@ -2543,9 +2540,9 @@ void _start_block_(L,T,N)( line ); } - type["blocks"] = TriState.on; - type["group"] = TriState.on; - type["tic_group"] = TriState.on; + obj_type_status["blocks"] = TriState.on; + obj_type_status["group"] = TriState.on; + obj_type_status["tic_group"] = TriState.on; } else if (line.matchFirst(rgx.block_tic_block_open)) { /+ tic block open +/ debug(block) { // block (tic) open @@ -2554,9 +2551,9 @@ void _start_block_(L,T,N)( line ); } - type["blocks"] = TriState.on; - type["block"] = TriState.on; - type["tic_block"] = TriState.on; + obj_type_status["blocks"] = TriState.on; + obj_type_status["block"] = TriState.on; + obj_type_status["tic_block"] = TriState.on; } else if (line.matchFirst(rgx.block_tic_quote_open)) { /+ tic quote open +/ debug(quote) { // quote (tic) open @@ -2565,9 +2562,9 @@ void _start_block_(L,T,N)( line ); } - type["blocks"] = TriState.on; - type["quote"] = TriState.on; - type["tic_quote"] = TriState.on; + obj_type_status["blocks"] = TriState.on; + obj_type_status["quote"] = TriState.on; + obj_type_status["tic_quote"] = TriState.on; } else if (auto m = line.matchFirst(rgx.block_tic_table_open)) { /+ tic table open +/ debug(table) { // table (tic) open @@ -2576,11 +2573,11 @@ void _start_block_(L,T,N)( line ); } - an_object["table_head"] = m.captures[1].to!string; - an_object["block_type"] = "tic"; - type["blocks"] = TriState.on; - type["table"] = TriState.on; - type["tic_table"] = TriState.on; + an_object["table_head"] = m.captures[1].to!string; + an_object["block_type"] = "tic"; + obj_type_status["blocks"] = TriState.on; + obj_type_status["table"] = TriState.on; + obj_type_status["tic_table"] = TriState.on; } #+END_SRC @@ -2599,15 +2596,15 @@ void _start_block_(L,T,N)( void _code_block_(L,O,T)( L line, return ref O an_object, - return ref T type + return ref T obj_type_status ) { debug(asserts) { - static assert(is(typeof(line) == char[])); - static assert(is(typeof(an_object) == string[string])); - static assert(is(typeof(type) == int[string])); + static assert(is(typeof(line) == char[])); + static assert(is(typeof(an_object) == string[string])); + static assert(is(typeof(obj_type_status) == int[string])); } static auto rgx = Rgx(); - if (type["curly_code"] == TriState.on) { + if (obj_type_status["curly_code"] == TriState.on) { if (line.matchFirst(rgx.block_curly_code_close)) { debug(code) { // code (curly) close writeln(line); @@ -2615,16 +2612,16 @@ void _code_block_(L,O,T)( an_object[an_object_key] = an_object[an_object_key] .replaceFirst(rgx.newline_eol_delimiter_only, "") .stripRight; - type["blocks"] = TriState.closing; - type["code"] = TriState.closing; - type["curly_code"] = TriState.off; + obj_type_status["blocks"] = TriState.closing; + obj_type_status["code"] = TriState.closing; + obj_type_status["curly_code"] = TriState.off; } else { debug(code) { // code (curly) line writeln(line); } an_object[an_object_key] ~= line ~= "\n"; // code (curly) line } - } else if (type["tic_code"] == TriState.on) { + } else if (obj_type_status["tic_code"] == TriState.on) { if (line.matchFirst(rgx.block_tic_close)) { debug(code) { // code (tic) close writeln(line); @@ -2632,9 +2629,9 @@ void _code_block_(L,O,T)( an_object[an_object_key] = an_object[an_object_key] .replaceFirst(rgx.newline_eol_delimiter_only, "") .stripRight; - type["blocks"] = TriState.closing; - type["code"] = TriState.closing; - type["tic_code"] = TriState.off; + obj_type_status["blocks"] = TriState.closing; + obj_type_status["code"] = TriState.closing; + obj_type_status["tic_code"] = TriState.off; } else { debug(code) { // code (tic) line writeln(line); @@ -2740,7 +2737,7 @@ final string biblio_tag_map_(A)(A abr) { #+BEGIN_SRC d void _biblio_block_( char[] line, - return ref int[string] type, + return ref int[string] obj_type_status, return ref int bib_entry, return ref string biblio_entry_str_json, return ref string[] biblio_arr_json @@ -2749,9 +2746,9 @@ void _biblio_block_( auto jsn = BibJsnStr(); static auto rgx = Rgx(); if (line.matchFirst(rgx.heading_biblio)) { - type["biblio_section"] = TriState.on; - type["blurb_section"] = State.off; - type["glossary_section"] = State.off; + obj_type_status["biblio_section"] = TriState.on; + obj_type_status["blurb_section"] = State.off; + obj_type_status["glossary_section"] = State.off; } if (line.empty) { debug { @@ -2869,38 +2866,38 @@ void _biblio_block_( void _quote_block_(L,O,T)( L line, return ref O an_object, - return ref T type + return ref T obj_type_status ) { debug(asserts) { - static assert(is(typeof(line) == char[])); - static assert(is(typeof(an_object) == string[string])); - static assert(is(typeof(type) == int[string])); + static assert(is(typeof(line) == char[])); + static assert(is(typeof(an_object) == string[string])); + static assert(is(typeof(obj_type_status) == int[string])); } static auto rgx = Rgx(); - if (type["curly_quote"] == TriState.on) { + if (obj_type_status["curly_quote"] == TriState.on) { if (line.matchFirst(rgx.block_curly_quote_close)) { debug(quote) { // quote (curly) close writeln(line); } an_object[an_object_key] = an_object[an_object_key].stripRight; - type["blocks"] = TriState.closing; - type["quote"] = TriState.closing; - type["curly_quote"] = TriState.off; + obj_type_status["blocks"] = TriState.closing; + obj_type_status["quote"] = TriState.closing; + obj_type_status["curly_quote"] = TriState.off; } else { debug(quote) { writeln(line); } an_object[an_object_key] ~= line ~= "\n"; // build quote array (or string) } - } else if (type["tic_quote"] == TriState.on) { + } else if (obj_type_status["tic_quote"] == TriState.on) { if (line.matchFirst(rgx.block_tic_close)) { debug(quote) { // quote (tic) close writeln(line); } an_object[an_object_key] = an_object[an_object_key].stripRight; - type["blocks"] = TriState.closing; - type["quote"] = TriState.closing; - type["tic_quote"] = TriState.off; + obj_type_status["blocks"] = TriState.closing; + obj_type_status["quote"] = TriState.closing; + obj_type_status["tic_quote"] = TriState.off; } else { debug(quote) { writeln(line); @@ -2921,38 +2918,38 @@ void _quote_block_(L,O,T)( void _group_block_(L,O,T)( L line, return ref O an_object, - return ref T type + return ref T obj_type_status ) { debug(asserts) { - static assert(is(typeof(line) == char[])); - static assert(is(typeof(an_object) == string[string])); - static assert(is(typeof(type) == int[string])); + static assert(is(typeof(line) == char[])); + static assert(is(typeof(an_object) == string[string])); + static assert(is(typeof(obj_type_status) == int[string])); } static auto rgx = Rgx(); - if (type["curly_group"] == State.on) { + if (obj_type_status["curly_group"] == State.on) { if (line.matchFirst(rgx.block_curly_group_close)) { debug(group) { writeln(line); } an_object[an_object_key] = an_object[an_object_key].stripRight; - type["blocks"] = TriState.closing; - type["group"] = TriState.closing; - type["curly_group"] = TriState.off; + obj_type_status["blocks"] = TriState.closing; + obj_type_status["group"] = TriState.closing; + obj_type_status["curly_group"] = TriState.off; } else { debug(group) { writeln(line); } an_object[an_object_key] ~= line ~= "\n"; // build group array (or string) } - } else if (type["tic_group"] == TriState.on) { + } else if (obj_type_status["tic_group"] == TriState.on) { if (line.matchFirst(rgx.block_tic_close)) { debug(group) { writeln(line); } an_object[an_object_key] = an_object[an_object_key].stripRight; - type["blocks"] = TriState.closing; - type["group"] = TriState.closing; - type["tic_group"] = TriState.off; + obj_type_status["blocks"] = TriState.closing; + obj_type_status["group"] = TriState.closing; + obj_type_status["tic_group"] = TriState.off; } else { debug(group) { // group writeln(line); @@ -2974,38 +2971,38 @@ void _group_block_(L,O,T)( void _block_block_(L,O,T)( L line, return ref O an_object, - return ref T type + return ref T obj_type_status ) { debug(asserts) { - static assert(is(typeof(line) == char[])); - static assert(is(typeof(an_object) == string[string])); - static assert(is(typeof(type) == int[string])); + static assert(is(typeof(line) == char[])); + static assert(is(typeof(an_object) == string[string])); + static assert(is(typeof(obj_type_status) == int[string])); } static auto rgx = Rgx(); - if (type["curly_block"] == TriState.on) { + if (obj_type_status["curly_block"] == TriState.on) { if (line.matchFirst(rgx.block_curly_block_close)) { debug(block) { // block (curly) close writeln(line); } an_object[an_object_key] = an_object[an_object_key].stripRight; - type["blocks"] = TriState.closing; - type["block"] = TriState.closing; - type["curly_block"] = TriState.off; + obj_type_status["blocks"] = TriState.closing; + obj_type_status["block"] = TriState.closing; + obj_type_status["curly_block"] = TriState.off; } else { debug(block) { writeln(line); } an_object[an_object_key] ~= line ~= "\n"; // build block array (or string) } - } else if (type["tic_block"] == TriState.on) { + } else if (obj_type_status["tic_block"] == TriState.on) { if (line.matchFirst(rgx.block_tic_close)) { debug(block) { writeln(line); } an_object[an_object_key] = an_object[an_object_key].stripRight; - type["blocks"] = TriState.closing; - type["block"] = TriState.closing; - type["tic_block"] = TriState.off; + obj_type_status["blocks"] = TriState.closing; + obj_type_status["block"] = TriState.closing; + obj_type_status["tic_block"] = TriState.off; } else { debug(block) { writeln(line); @@ -3025,7 +3022,7 @@ why extra object stuff only in poem/verse? void _poem_block_(L,O,T,C,N,Ma)( L line, return ref O an_object, - return ref T type, + return ref T obj_type_status, return ref C cntr, N obj_cite_number_poem, Ma dochead_make_aa, @@ -3033,13 +3030,13 @@ void _poem_block_(L,O,T,C,N,Ma)( debug(asserts) { static assert(is(typeof(line) == char[])); static assert(is(typeof(an_object) == string[string])); - static assert(is(typeof(type) == int[string])); + static assert(is(typeof(obj_type_status) == int[string])); static assert(is(typeof(cntr) == int)); static assert(is(typeof(obj_cite_number_poem) == string[string])); static assert(is(typeof(dochead_make_aa) == string[string][string])); } static auto rgx = Rgx(); - if (type["curly_poem"] == TriState.on) { + if (obj_type_status["curly_poem"] == TriState.on) { if (line.matchFirst(rgx.block_curly_poem_close)) { if (an_object_key in an_object || processing.length > 0) { @@ -3091,21 +3088,21 @@ void _poem_block_(L,O,T,C,N,Ma)( } obj_cite_number_poem["end"] = obj_cite_number.to!string; - type["blocks"] = TriState.closing; - type["poem"] = TriState.closing; - type["curly_poem"] = TriState.off; + obj_type_status["blocks"] = TriState.closing; + obj_type_status["poem"] = TriState.closing; + obj_type_status["curly_poem"] = TriState.off; } else { processing["verse"] ~= line ~= "\n"; - if (type["verse_new"] == State.on) { + if (obj_type_status["verse_new"] == State.on) { obj_cite_number = - ocn_emit(type["ocn_status"]); - type["verse_new"] = State.off; + ocn_emit(obj_type_status["ocn_status"]); + obj_type_status["verse_new"] = State.off; } else if (line.matchFirst(rgx.newline_eol_delimiter_only)) { processing["verse"] = processing["verse"].stripRight; verse_line = TriState.off; - type["verse_new"] = State.on; + obj_type_status["verse_new"] = State.on; } - if (type["verse_new"] == State.on) { + if (obj_type_status["verse_new"] == State.on) { verse_line=1; an_object[an_object_key] = processing["verse"]; debug(poem) { // poem verse @@ -3145,7 +3142,7 @@ void _poem_block_(L,O,T,C,N,Ma)( ++cntr; } } - } else if (type["tic_poem"] == TriState.on) { + } else if (obj_type_status["tic_poem"] == TriState.on) { if (auto m = line.matchFirst(rgx.block_tic_close)) { // tic_poem_close an_object[an_object_key]="verse"; debug(poem) { // poem (curly) close @@ -3184,21 +3181,21 @@ void _poem_block_(L,O,T,C,N,Ma)( processing.remove("verse"); ++cntr; } - type["blocks"] = TriState.closing; - type["poem"] = TriState.closing; - type["tic_poem"] = TriState.off; + obj_type_status["blocks"] = TriState.closing; + obj_type_status["poem"] = TriState.closing; + obj_type_status["tic_poem"] = TriState.off; } else { processing["verse"] ~= line ~= "\n"; - if (type["verse_new"] == State.on) { + if (obj_type_status["verse_new"] == State.on) { obj_cite_number = - ocn_emit(type["ocn_status"]); - type["verse_new"] = State.off; + ocn_emit(obj_type_status["ocn_status"]); + obj_type_status["verse_new"] = State.off; } else if (line.matchFirst(rgx.newline_eol_delimiter_only)) { processing["verse"] = processing["verse"].stripRight; - type["verse_new"] = State.on; + obj_type_status["verse_new"] = State.on; verse_line = TriState.off; } - if (type["verse_new"] == State.on) { + if (obj_type_status["verse_new"] == State.on) { verse_line=1; an_object[an_object_key] = processing["verse"]; debug(poem) { // poem (tic) close @@ -3266,34 +3263,34 @@ you need: void _table_block_(L,O,T,Ma)( L line, return ref O an_object, - return ref T type, + return ref T obj_type_status, return ref Ma dochead_make_aa ) { debug(asserts) { - static assert(is(typeof(line) == char[])); - static assert(is(typeof(an_object) == string[string])); - static assert(is(typeof(type) == int[string])); + static assert(is(typeof(line) == char[])); + static assert(is(typeof(an_object) == string[string])); + static assert(is(typeof(obj_type_status) == int[string])); } static auto rgx = Rgx(); - if (type["curly_table"] == TriState.on) { + if (obj_type_status["curly_table"] == TriState.on) { if (line.matchFirst(rgx.block_curly_table_close)) { debug(table) { // table (curly) close writeln(line); } - type["blocks"] = TriState.closing; - type["table"] = TriState.closing; - type["curly_table"] = TriState.off; + obj_type_status["blocks"] = TriState.closing; + obj_type_status["table"] = TriState.closing; + obj_type_status["curly_table"] = TriState.off; } else { debug(table) { // table writeln(line); } an_object[an_object_key] ~= line ~= "\n"; // build table array (or string) } - } else if (type["curly_table_special_markup"] == TriState.on) { + } else if (obj_type_status["curly_table_special_markup"] == TriState.on) { if (line.empty) { - type["blocks"] = TriState.off; - type["table"] = TriState.off; - type["curly_table_special_markup"] = TriState.off; + obj_type_status["blocks"] = TriState.off; + obj_type_status["table"] = TriState.off; + obj_type_status["curly_table_special_markup"] = TriState.off; _table_closed_make_special_notation_table_( line, an_object, @@ -3301,7 +3298,7 @@ void _table_block_(L,O,T,Ma)( obj_cite_number, comp_obj_heading, cntr, - type, + obj_type_status, dochead_make_aa ); } else { @@ -3310,14 +3307,14 @@ void _table_block_(L,O,T,Ma)( } an_object[an_object_key] ~= line ~= "\n"; } - } else if (type["tic_table"] == TriState.on) { + } else if (obj_type_status["tic_table"] == TriState.on) { if (line.matchFirst(rgx.block_tic_close)) { debug(table) { // table (tic) close writeln(line); } - type["blocks"] = TriState.closing; - type["table"] = TriState.closing; - type["tic_table"] = TriState.off; + obj_type_status["blocks"] = TriState.closing; + obj_type_status["table"] = TriState.closing; + obj_type_status["tic_table"] = TriState.off; } else { debug(table) { // table writeln(line); @@ -3345,12 +3342,12 @@ void _table_closed_make_special_notation_table_( return ref int obj_cite_number, return ref ObjGenericComposite _comp_obj_heading, return ref int cntr, - return ref int[string] type, + return ref int[string] obj_type_status, string[string][string] dochead_make_aa, ) { comp_obj_block = comp_obj_block.init; obj_cite_number = - ocn_emit(type["ocn_status"]); + ocn_emit(obj_type_status["ocn_status"]); auto comp_obj_location = node_construct.node_location_emitter( content_non_header, @@ -3390,7 +3387,7 @@ void _block_flag_line_empty_(B)( return ref int obj_cite_number, return ref ObjGenericComposite _comp_obj_heading, return ref int cntr, - return ref int[string] type, + return ref int[string] obj_type_status, string[string] obj_cite_number_poem, string[string][string] dochead_make_aa, ) { @@ -3400,19 +3397,19 @@ void _block_flag_line_empty_(B)( ~ line ~ "\"" ); assert( - (type["blocks"] == TriState.closing), + (obj_type_status["blocks"] == TriState.closing), "code block status: closed" ); - assertions_flag_types_block_status_none_or_closed(type); + assertions_flag_types_block_status_none_or_closed(obj_type_status); #+END_SRC ***** make: quote block #+name: abs_functions_block_line_status_empty #+BEGIN_SRC d - if (type["quote"] == TriState.closing) { + if (obj_type_status["quote"] == TriState.closing) { obj_cite_number = - ocn_emit(type["ocn_status"]); + ocn_emit(obj_type_status["ocn_status"]); an_object["bookindex_nugget"] = ("bookindex_nugget" in an_object) ? an_object["bookindex_nugget"] : ""; bookindex_unordered_hashes = @@ -3446,8 +3443,8 @@ void _block_flag_line_empty_(B)( comp_obj_block.inline_notes_star = substantive_obj_misc_tuple[sObj.notes_star]; comp_obj_block.inline_links = substantive_obj_misc_tuple[sObj.links]; the_document_body_section ~= comp_obj_block; - type["blocks"] = TriState.off; - type["quote"] = TriState.off; + obj_type_status["blocks"] = TriState.off; + obj_type_status["quote"] = TriState.off; object_reset(an_object); processing.remove("verse"); ++cntr; @@ -3457,9 +3454,9 @@ void _block_flag_line_empty_(B)( #+name: abs_functions_block_line_status_empty #+BEGIN_SRC d - } else if (type["group"] == TriState.closing) { + } else if (obj_type_status["group"] == TriState.closing) { obj_cite_number = - ocn_emit(type["ocn_status"]); + ocn_emit(obj_type_status["ocn_status"]); an_object["bookindex_nugget"] = ("bookindex_nugget" in an_object) ? an_object["bookindex_nugget"] : ""; bookindex_unordered_hashes = @@ -3493,8 +3490,8 @@ void _block_flag_line_empty_(B)( comp_obj_block.inline_notes_star = substantive_obj_misc_tuple[sObj.notes_star]; comp_obj_block.inline_links = substantive_obj_misc_tuple[sObj.links]; the_document_body_section ~= comp_obj_block; - type["blocks"] = TriState.off; - type["group"] = TriState.off; + obj_type_status["blocks"] = TriState.off; + obj_type_status["group"] = TriState.off; object_reset(an_object); processing.remove("verse"); ++cntr; @@ -3504,8 +3501,8 @@ void _block_flag_line_empty_(B)( #+name: abs_functions_block_line_status_empty #+BEGIN_SRC d - } else if (type["block"] == TriState.closing) { - obj_cite_number = ocn_emit(type["ocn_status"]); + } else if (obj_type_status["block"] == TriState.closing) { + obj_cite_number = ocn_emit(obj_type_status["ocn_status"]); an_object["bookindex_nugget"] = ("bookindex_nugget" in an_object) ? an_object["bookindex_nugget"] : ""; bookindex_unordered_hashes = @@ -3538,8 +3535,8 @@ void _block_flag_line_empty_(B)( comp_obj_block.inline_notes_star = substantive_obj_misc_tuple[sObj.notes_star]; comp_obj_block.inline_links = substantive_obj_misc_tuple[sObj.links]; the_document_body_section ~= comp_obj_block; - type["blocks"] = TriState.off; - type["block"] = TriState.off; + obj_type_status["blocks"] = TriState.off; + obj_type_status["block"] = TriState.off; object_reset(an_object); processing.remove("verse"); ++cntr; @@ -3549,7 +3546,7 @@ void _block_flag_line_empty_(B)( #+name: abs_functions_block_line_status_empty #+BEGIN_SRC d - } else if (type["poem"] == TriState.closing) { + } else if (obj_type_status["poem"] == TriState.closing) { an_object["bookindex_nugget"] = ("bookindex_nugget" in an_object) ? an_object["bookindex_nugget"] : ""; bookindex_unordered_hashes = @@ -3576,8 +3573,8 @@ void _block_flag_line_empty_(B)( comp_obj_poem_ocn.obj_cite_number = (obj_cite_number_poem["start"], obj_cite_number_poem["end"]); comp_obj_poem_ocn.text = ""; the_document_body_section ~= comp_obj_poem_ocn; - type["blocks"] = TriState.off; - type["poem"] = TriState.off; + obj_type_status["blocks"] = TriState.off; + obj_type_status["poem"] = TriState.off; object_reset(an_object); processing.remove("verse"); #+END_SRC @@ -3586,9 +3583,9 @@ void _block_flag_line_empty_(B)( #+name: abs_functions_block_line_status_empty #+BEGIN_SRC d - } else if (type["code"] == TriState.closing) { + } else if (obj_type_status["code"] == TriState.closing) { obj_cite_number = - ocn_emit(type["ocn_status"]); + ocn_emit(obj_type_status["ocn_status"]); an_object["bookindex_nugget"] = ("bookindex_nugget" in an_object) ? an_object["bookindex_nugget"] : ""; bookindex_unordered_hashes = @@ -3622,8 +3619,8 @@ void _block_flag_line_empty_(B)( comp_obj_code.inline_notes_star = substantive_obj_misc_tuple[sObj.notes_star]; comp_obj_code.inline_links = substantive_obj_misc_tuple[sObj.links]; the_document_body_section ~= comp_obj_code; - type["blocks"] = TriState.off; - type["code"] = TriState.off; + obj_type_status["blocks"] = TriState.off; + obj_type_status["code"] = TriState.off; object_reset(an_object); processing.remove("verse"); ++cntr; @@ -3633,10 +3630,10 @@ void _block_flag_line_empty_(B)( #+name: abs_functions_block_line_status_empty #+BEGIN_SRC d - } else if (type["table"] == TriState.closing) { + } else if (obj_type_status["table"] == TriState.closing) { comp_obj_block = comp_obj_block.init; obj_cite_number = - ocn_emit(type["ocn_status"]); + ocn_emit(obj_type_status["ocn_status"]); an_object["bookindex_nugget"] = ("bookindex_nugget" in an_object) ? an_object["bookindex_nugget"] : ""; bookindex_unordered_hashes = @@ -3664,8 +3661,8 @@ void _block_flag_line_empty_(B)( comp_obj_block = table_instructions(comp_obj_block, an_object["table_head"]); comp_obj_block = table_substantive_munge(comp_obj_block, an_object["substantive"]); the_document_body_section ~= comp_obj_block; - type["blocks"] = TriState.off; - type["table"] = TriState.off; + obj_type_status["blocks"] = TriState.off; + obj_type_status["table"] = TriState.off; object_reset(an_object); processing.remove("verse"); ++cntr; @@ -3687,14 +3684,14 @@ auto _book_index_(L,I,O,T,B)( L line, return ref I book_idx_tmp, return ref O an_object, - return ref T type, + return ref T obj_type_status, B opt_action, ) { debug(asserts) { static assert(is(typeof(line) == char[])); static assert(is(typeof(book_idx_tmp) == string)); static assert(is(typeof(an_object) == string[string])); - static assert(is(typeof(type) == int[string])); + static assert(is(typeof(obj_type_status) == int[string])); static assert(is(typeof(opt_action) == bool[string])); } static auto rgx = Rgx(); @@ -3709,7 +3706,7 @@ auto _book_index_(L,I,O,T,B)( an_object["bookindex_nugget"] = m.captures[1].to!string; } else if (auto m = line.match(rgx.book_index_open)) { /+ match open book_index +/ - type["book_index"] = State.on; + obj_type_status["book_index"] = State.on; if (opt_action["backmatter"] && opt_action["section_bookindex"]) { book_idx_tmp = m.captures[1].to!string; debug(bookindexmatch) { // book index @@ -3719,10 +3716,10 @@ auto _book_index_(L,I,O,T,B)( ); } } - } else if (type["book_index"] == State.on ) { + } else if (obj_type_status["book_index"] == State.on ) { /+ book_index flag set +/ if (auto m = line.match(rgx.book_index_close)) { - type["book_index"] = State.off; + obj_type_status["book_index"] = State.off; if (opt_action["backmatter"] && opt_action["section_bookindex"]) { an_object["bookindex_nugget"] = book_idx_tmp ~ m.captures[1].to!string; @@ -3754,18 +3751,18 @@ auto _heading_found_(L,X,H,R,T)( X dochead_make_identify_unmarked_headings, return ref H heading_match_str, return ref R heading_match_rgx, - return ref T type + return ref T obj_type_status ) { debug(asserts) { static assert(is(typeof(line) == char[])); static assert(is(typeof(dochead_make_identify_unmarked_headings) == string)); static assert(is(typeof(heading_match_str) == string[string])); static assert(is(typeof(heading_match_rgx) == Regex!(char)[string])); - static assert(is(typeof(type) == int[string])); + static assert(is(typeof(obj_type_status) == int[string])); } static auto rgx = Rgx(); if ((dochead_make_identify_unmarked_headings.length > 2) - && (type["make_headings"] == State.off)) { + && (obj_type_status["make_headings"] == State.off)) { /+ headings found +/ debug(headingsfound) { writeln(dochead_make_identify_unmarked_headings); @@ -3837,7 +3834,7 @@ auto _heading_found_(L,X,H,R,T)( default: break; } - type["make_headings"] = State.on; + obj_type_status["make_headings"] = State.on; } } #+END_SRC @@ -3850,19 +3847,19 @@ auto _heading_make_set_(L,C,R,T)( L line, C line_occur, return ref R heading_match_rgx, - return ref T type + return ref T obj_type_status ) { debug(asserts) { static assert(is(typeof(line) == char[])); static assert(is(typeof(line_occur) == int[string])); static assert(is(typeof(heading_match_rgx) == Regex!(char)[string])); - static assert(is(typeof(type) == int[string])); + static assert(is(typeof(obj_type_status) == int[string])); } - if ((type["make_headings"] == State.on) + if ((obj_type_status["make_headings"] == State.on) && ((line_occur["para"] == State.off) && (line_occur["heading"] == State.off)) - && ((type["para"] == State.off) - && (type["heading"] == State.off))) { + && ((obj_type_status["para"] == State.off) + && (obj_type_status["heading"] == State.off))) { /+ heading make set +/ if (line.matchFirst(heading_match_rgx["h_B"])) { line = "B~ " ~ line; @@ -3922,7 +3919,7 @@ auto _heading_matched_(L,C,O,K,Lv,Lc,T,Me)( return ref K an_object_key, return ref Lv lv, return ref Lc collapsed_lev, - return ref T type, + return ref T obj_type_status, return ref Me dochead_meta_aa, ) { debug(asserts) { @@ -3932,19 +3929,19 @@ auto _heading_matched_(L,C,O,K,Lv,Lc,T,Me)( static assert(is(typeof(an_object_key) == string)); static assert(is(typeof(lv) == int[string])); static assert(is(typeof(collapsed_lev) == int[string])); - static assert(is(typeof(type) == int[string])); + static assert(is(typeof(obj_type_status) == int[string])); static assert(is(typeof(dochead_meta_aa) == string[string][string])); } static auto rgx = Rgx(); if (auto m = line.match(rgx.heading)) { /+ heading match +/ - type["heading"] = State.on; + obj_type_status["heading"] = State.on; if (line.match(rgx.heading_seg_and_above)) { - type["biblio_section"] = State.off; - type["glossary_section"] = State.off; - type["blurb_section"] = State.off; + obj_type_status["biblio_section"] = State.off; + obj_type_status["glossary_section"] = State.off; + obj_type_status["blurb_section"] = State.off; } - type["para"] = State.off; + obj_type_status["para"] = State.off; ++line_occur["heading"]; an_object[an_object_key] ~= line ~= "\n"; an_object["lev"] ~= m.captures[1]; @@ -4082,23 +4079,23 @@ void _para_match_(L,O,K,I,B,T,C)( return ref K an_object_key, return ref I indent, return ref B bullet, - return ref T type, + return ref T obj_type_status, return ref C line_occur, ) { debug(asserts) { - static assert(is(typeof(line) == char[])); - static assert(is(typeof(an_object) == string[string])); - static assert(is(typeof(an_object_key) == string)); - static assert(is(typeof(indent) == int[string])); - static assert(is(typeof(bullet) == bool)); - static assert(is(typeof(type) == int[string])); - static assert(is(typeof(line_occur) == int[string])); + static assert(is(typeof(line) == char[])); + static assert(is(typeof(an_object) == string[string])); + static assert(is(typeof(an_object_key) == string)); + static assert(is(typeof(indent) == int[string])); + static assert(is(typeof(bullet) == bool)); + static assert(is(typeof(obj_type_status) == int[string])); + static assert(is(typeof(line_occur) == int[string])); } static auto rgx = Rgx(); if (line_occur["para"] == State.off) { line = font_faces_line(line); /+ para matches +/ - type["para"] = State.on; + obj_type_status["para"] = State.on; an_object[an_object_key] ~= line; // body_nugget indent=[ "hang_position" : 0, @@ -6855,29 +6852,29 @@ pure void assertions_doc_structure(O,Lv)( #+name: abs_functions_assertions #+BEGIN_SRC d -pure void assertions_flag_types_block_status_none_or_closed(T)(T type) { +pure void assertions_flag_types_block_status_none_or_closed(T)(T obj_type_status) { debug(asserts) { - static assert(is(typeof(type) == int[string])); + static assert(is(typeof(obj_type_status) == int[string])); } assert( - (type["code"] == TriState.off) - || (type["code"] == TriState.closing), + (obj_type_status["code"] == TriState.off) + || (obj_type_status["code"] == TriState.closing), "code block status: off or closing"); assert( - (type["poem"] == TriState.off) - || (type["poem"] == TriState.closing), + (obj_type_status["poem"] == TriState.off) + || (obj_type_status["poem"] == TriState.closing), "poem status: off or closing"); assert( - (type["table"] == TriState.off) - || (type["table"] == TriState.closing), + (obj_type_status["table"] == TriState.off) + || (obj_type_status["table"] == TriState.closing), "table status: off or closing"); assert( - (type["group"] == TriState.off) - || (type["group"] == TriState.closing), + (obj_type_status["group"] == TriState.off) + || (obj_type_status["group"] == TriState.closing), "group block status: off or closing"); assert( - (type["block"] == TriState.off) - || (type["block"] == TriState.closing), + (obj_type_status["block"] == TriState.off) + || (obj_type_status["block"] == TriState.closing), "block status: off or closing"); } #+END_SRC diff --git a/src/sdp/meta/defaults.d b/src/sdp/meta/defaults.d index ecc558b..4880f5b 100644 --- a/src/sdp/meta/defaults.d +++ b/src/sdp/meta/defaults.d @@ -256,38 +256,38 @@ template SiSUrgxInitFlags() { /+ regex flags +/ static int[string] flags_type_init() { int[string] flags_type_init = [ - "make_headings" : 0, - "header_make" : 0, - "header_meta" : 0, - "heading" : 0, - "biblio_section" : 0, - "glossary_section" : 0, - "blurb_section" : 0, - "para" : 0, - "blocks" : 0, // 0..2 generic - "code" : 0, // 0..2 - "poem" : 0, // 0..2 - "table" : 0, // 0..2 - "group" : 0, // 0..2 - "block" : 0, // 0..2 - "quote" : 0, // 0..2 - "verse_new" : 0, - "curly_code" : 0, - "curly_poem" : 0, - "curly_group" : 0, - "curly_block" : 0, - "curly_quote" : 0, - "curly_table" : 0, - "curly_table_special_markup" : 0, - "tic_code" : 0, - "tic_poem" : 0, - "tic_group" : 0, - "tic_block" : 0, - "tic_quote" : 0, - "tic_table" : 0, - "ocn_status" : 0, // 0 obj_cite_number; 1 no obj_cite_number; 2 no obj_cite_number & dummy headings - "ocn_status_multi_obj" : 0, // 0 obj_cite_number; 1 no obj_cite_number; 2 no obj_cite_number & dummy headings - "book_index" : 0, + "make_headings" : 0, + "header_make" : 0, + "header_meta" : 0, + "heading" : 0, + "biblio_section" : 0, + "glossary_section" : 0, + "blurb_section" : 0, + "para" : 0, + "blocks" : 0, // 0..2 generic + "code" : 0, // 0..2 + "poem" : 0, // 0..2 + "table" : 0, // 0..2 + "group" : 0, // 0..2 + "block" : 0, // 0..2 + "quote" : 0, // 0..2 + "verse_new" : 0, + "curly_code" : 0, + "curly_poem" : 0, + "curly_group" : 0, + "curly_block" : 0, + "curly_quote" : 0, + "curly_table" : 0, + "curly_table_special_markup" : 0, + "tic_code" : 0, + "tic_poem" : 0, + "tic_group" : 0, + "tic_block" : 0, + "tic_quote" : 0, + "tic_table" : 0, + "ocn_status" : 0, // 0 obj_cite_number; 1 no obj_cite_number; 2 no obj_cite_number & dummy headings + "ocn_status_off_for_multiple_objects" : 0, // 0 obj_cite_number; 1 no obj_cite_number; 2 no obj_cite_number & dummy headings + "book_index" : 0, ]; return flags_type_init; } diff --git a/src/sdp/meta/metadoc_from_src.d b/src/sdp/meta/metadoc_from_src.d index ebcfe71..cc6311e 100644 --- a/src/sdp/meta/metadoc_from_src.d +++ b/src/sdp/meta/metadoc_from_src.d @@ -266,7 +266,7 @@ template SiSUdocAbstraction() { "glossary" : 0, "blurb" : 0, ]; - auto type = flags_type_init; + auto obj_type_status = flags_type_init; string[string] obj_cite_number_poem = [ "start" : "", "end" : "" @@ -380,27 +380,27 @@ template SiSUdocAbstraction() { } } if (!line.empty) { - type = _check_ocn_status_(line, type); + obj_type_status = _check_ocn_status_(line, obj_type_status); } - if (type["code"] == TriState.on) { + if (obj_type_status["code"] == TriState.on) { /+ block object: code +/ - _code_block_(line, an_object, type); + _code_block_(line, an_object, obj_type_status); continue; } else if (!matchFirst(line, rgx.skip_from_regular_parse)) { /+ object other than "code block" object (includes regular text paragraph, headings & blocks other than code) +/ /+ heading, glossary, blurb, poem, group, block, quote, table +/ if (line.matchFirst(rgx.heading_biblio) - || (type["biblio_section"] == State.on + || (obj_type_status["biblio_section"] == State.on && (!(line.matchFirst(rgx.heading_blurb_glossary))) && (!(line.matchFirst(rgx.heading))) && (!(line.matchFirst(rgx.comment))))) { /+ within section (block object): biblio +/ - type["glossary_section"] = State.off; - type["biblio_section"] = State.on; - type["blurb_section"] = State.off; + obj_type_status["glossary_section"] = State.off; + obj_type_status["biblio_section"] = State.on; + obj_type_status["blurb_section"] = State.off; if (opt_action["backmatter"] && opt_action["section_biblio"]) { - _biblio_block_(line, type, bib_entry, biblio_entry_str_json, biblio_arr_json); + _biblio_block_(line, obj_type_status, bib_entry, biblio_entry_str_json, biblio_arr_json); debug(bibliobuild) { writeln("- ", biblio_entry_str_json); writeln("-> ", biblio_arr_json.length); @@ -408,7 +408,7 @@ template SiSUdocAbstraction() { } continue; } else if (line.matchFirst(rgx.heading_glossary) - || (type["glossary_section"] == State.on + || (obj_type_status["glossary_section"] == State.on && (!(line.matchFirst(rgx.heading_biblio_blurb))) && (!(line.matchFirst(rgx.heading))) && (!(line.matchFirst(rgx.comment))))) { @@ -417,16 +417,16 @@ template SiSUdocAbstraction() { writeln(__LINE__); writeln(line); } - type["glossary_section"] = State.on; - type["biblio_section"] = State.off; - type["blurb_section"] = State.off; + obj_type_status["glossary_section"] = State.on; + obj_type_status["biblio_section"] = State.off; + obj_type_status["blurb_section"] = State.off; if (opt_action["backmatter"] && opt_action["section_glossary"]) { indent=[ "hang_position" : 0, "base_position" : 0, ]; bullet = false; - type["para"] = State.on; + obj_type_status["para"] = State.on; line_occur["para"] = State.off; an_object_key="glossary_nugget"; // if (line.matchFirst(rgx.heading_glossary)) { @@ -464,7 +464,7 @@ template SiSUdocAbstraction() { comp_obj_heading_.anchor_tags = ["glossary"]; the_glossary_section ~= comp_obj_heading_; } else { - _para_match_(line, an_object, an_object_key, indent, bullet, type, line_occur); + _para_match_(line, an_object, an_object_key, indent, bullet, obj_type_status, line_occur); comp_obj_para = comp_obj_para.init; comp_obj_para.use = "backmatter"; comp_obj_para.is_of = "para"; @@ -477,11 +477,11 @@ template SiSUdocAbstraction() { comp_obj_para.bullet = bullet; the_glossary_section ~= comp_obj_para; } - type["ocn_status"] = TriState.off; + obj_type_status["ocn_status"] = TriState.off; } continue; } else if (line.matchFirst(rgx.heading_blurb) - || (type["blurb_section"] == State.on + || (obj_type_status["blurb_section"] == State.on && (!(line.matchFirst(rgx.heading_biblio_glossary))) && (!(line.matchFirst(rgx.heading))) && (!(line.matchFirst(rgx.comment))))) { @@ -490,16 +490,16 @@ template SiSUdocAbstraction() { writeln(__LINE__); writeln(line); } - type["glossary_section"] = State.off; - type["biblio_section"] = State.off; - type["blurb_section"] = State.on; + obj_type_status["glossary_section"] = State.off; + obj_type_status["biblio_section"] = State.off; + obj_type_status["blurb_section"] = State.on; if (opt_action["backmatter"] && opt_action["section_blurb"]) { indent=[ "hang_position" : 0, "base_position" : 0, ]; bullet = false; - type["para"] = State.on; + obj_type_status["para"] = State.on; line_occur["para"] = State.off; an_object_key="blurb_nugget"; if (line.matchFirst(rgx.heading_blurb)) { @@ -553,7 +553,7 @@ template SiSUdocAbstraction() { comp_obj_heading_.parent_lev_markup = 0; the_blurb_section ~= comp_obj_heading_; } else { - _para_match_(line, an_object, an_object_key, indent, bullet, type, line_occur); + _para_match_(line, an_object, an_object_key, indent, bullet, obj_type_status, line_occur); comp_obj_para = comp_obj_para.init; comp_obj_para.use = "backmatter"; comp_obj_para.is_of = "para"; @@ -566,21 +566,21 @@ template SiSUdocAbstraction() { comp_obj_para.bullet = bullet; the_blurb_section ~= comp_obj_para; } - type["ocn_status"] = TriState.off; + obj_type_status["ocn_status"] = TriState.off; } continue; - } else if (type["quote"] == TriState.on) { + } else if (obj_type_status["quote"] == TriState.on) { /+ within block object: quote +/ - _quote_block_(line, an_object, type); + _quote_block_(line, an_object, obj_type_status); continue; /+ within block object: group +/ - } else if (type["group"] == TriState.on) { + } else if (obj_type_status["group"] == TriState.on) { /+ within block object: group +/ line = (line) .replaceAll(rgx.para_delimiter, mkup.br_paragraph ~ "$1"); - _group_block_(line, an_object, type); + _group_block_(line, an_object, obj_type_status); continue; - } else if (type["block"] == TriState.on) { + } else if (obj_type_status["block"] == TriState.on) { /+ within block object: block +/ if (auto m = line.match(rgx.spaces_line_start)) { line = (line) @@ -590,24 +590,24 @@ template SiSUdocAbstraction() { line = (line) .replaceAll(rgx.spaces_multiple, (m.captures[1]).translate([ ' ' : mkup.nbsp ])); } - _block_block_(line, an_object, type); + _block_block_(line, an_object, obj_type_status); continue; - } else if (type["poem"] == TriState.on) { + } else if (obj_type_status["poem"] == TriState.on) { /+ within block object: poem +/ - _poem_block_(line, an_object, type, cntr, obj_cite_number_poem, dochead_make_aa); + _poem_block_(line, an_object, obj_type_status, cntr, obj_cite_number_poem, dochead_make_aa); continue; - } else if (type["table"] == TriState.on) { + } else if (obj_type_status["table"] == TriState.on) { /+ within block object: table +/ - _table_block_(line, an_object, type, dochead_make_aa); + _table_block_(line, an_object, obj_type_status, dochead_make_aa); continue; } else { /+ not within a block group +/ assert( - (type["blocks"] == TriState.off) - || (type["blocks"] == TriState.closing), + (obj_type_status["blocks"] == TriState.off) + || (obj_type_status["blocks"] == TriState.closing), "block status: none or closed" ); - assertions_flag_types_block_status_none_or_closed(type); + assertions_flag_types_block_status_none_or_closed(obj_type_status); if (line.matchFirst(rgx.block_open)) { if (line.matchFirst(rgx.block_poem_open)) { /+ poem to verse exceptions! +/ @@ -615,7 +615,7 @@ template SiSUdocAbstraction() { processing.remove("verse"); obj_cite_number_poem["start"] = obj_cite_number.to!string; } - _start_block_(line, type, obj_cite_number_poem); + _start_block_(line, obj_type_status, obj_cite_number_poem); continue; } else if (!line.empty) { /+ line not empty +/ @@ -625,11 +625,11 @@ template SiSUdocAbstraction() { "line tested, line not empty surely:\n \"" ~ line ~ "\"" ); assert( - (type["blocks"] == TriState.off) - || (type["blocks"] == TriState.closing), + (obj_type_status["blocks"] == TriState.off) + || (obj_type_status["blocks"] == TriState.closing), "code block status: none or closed" ); - if (type["blocks"] == TriState.closing) { + if (obj_type_status["blocks"] == TriState.closing) { debug(check) { // block writeln(__LINE__); writeln(line); @@ -637,16 +637,16 @@ template SiSUdocAbstraction() { assert( line.matchFirst(rgx.book_index) || line.matchFirst(rgx.book_index_open) - || type["book_index"] == State.on, + || obj_type_status["book_index"] == State.on, "\nblocks closed, unless followed by book index, non-matching line:\n \"" ~ line ~ "\"" ); } if (line.matchFirst(rgx.book_index) || line.matchFirst(rgx.book_index_open) - || type["book_index"] == State.on ) { + || obj_type_status["book_index"] == State.on ) { /+ book_index +/ - _book_index_(line, book_idx_tmp, an_object, type, opt_action); + _book_index_(line, book_idx_tmp, an_object, obj_type_status, opt_action); } else { /+ not book_index +/ an_object_key="body_nugget"; @@ -662,26 +662,26 @@ template SiSUdocAbstraction() { comp_obj_comment.is_a = "comment"; comp_obj_comment.text = an_object[an_object_key].strip; the_document_body_section ~= comp_obj_comment; - _common_reset_(line_occur, an_object, type); + _common_reset_(line_occur, an_object, obj_type_status); processing.remove("verse"); ++cntr; } else if (((line_occur["para"] == State.off) && (line_occur["heading"] == State.off)) - && ((type["para"] == State.off) - && (type["heading"] == State.off))) { + && ((obj_type_status["para"] == State.off) + && (obj_type_status["heading"] == State.off))) { /+ heading or para but neither flag nor line exists +/ if ((dochead_make_aa["make"]["headings"].length > 2) - && (type["make_headings"] == State.off)) { + && (obj_type_status["make_headings"] == State.off)) { /+ heading found +/ - _heading_found_(line, dochead_make_aa["make"]["headings"], heading_match_str, heading_match_rgx, type); + _heading_found_(line, dochead_make_aa["make"]["headings"], heading_match_str, heading_match_rgx, obj_type_status); } - if ((type["make_headings"] == State.on) + if ((obj_type_status["make_headings"] == State.on) && ((line_occur["para"] == State.off) && (line_occur["heading"] == State.off)) - && ((type["para"] == State.off) - && (type["heading"] == State.off))) { + && ((obj_type_status["para"] == State.off) + && (obj_type_status["heading"] == State.off))) { /+ heading make set +/ - line = _heading_make_set_(line, line_occur, heading_match_rgx, type); + line = _heading_make_set_(line, line_occur, heading_match_rgx, obj_type_status); } /+ TODO node info: all headings identified at this point, - extract node info here?? @@ -691,11 +691,11 @@ template SiSUdocAbstraction() { +/ if (line.matchFirst(rgx.heading)) { /+ heading match +/ - _heading_matched_(line, line_occur, an_object, an_object_key, lv, collapsed_lev, type, dochead_meta_aa); + _heading_matched_(line, line_occur, an_object, an_object_key, lv, collapsed_lev, obj_type_status, dochead_meta_aa); } else if (line_occur["para"] == State.off) { /+ para match +/ an_object_key="body_nugget"; - _para_match_(line, an_object, an_object_key, indent, bullet, type, line_occur); + _para_match_(line, an_object, an_object_key, indent, bullet, obj_type_status, line_occur); } } else if (line_occur["heading"] > State.off) { /+ heading +/ @@ -713,7 +713,7 @@ template SiSUdocAbstraction() { ++line_occur["para"]; } } - } else if (type["blocks"] == TriState.closing) { + } else if (obj_type_status["blocks"] == TriState.closing) { /+ line empty, with blocks flag +/ _block_flag_line_empty_( bookindex_extract_hash, @@ -724,7 +724,7 @@ template SiSUdocAbstraction() { obj_cite_number, comp_obj_heading, cntr, - type, + obj_type_status, obj_cite_number_poem, dochead_make_aa ); @@ -736,15 +736,15 @@ template SiSUdocAbstraction() { ~ line ~ "\"" ); assert( - (type["blocks"] == State.off), + (obj_type_status["blocks"] == State.off), "code block status: none" ); - if ((type["heading"] == State.on) + if ((obj_type_status["heading"] == State.on) && (line_occur["heading"] > State.off)) { /+ heading object (current line empty) +/ obj_cite_number = (an_object["lev_markup_number"].to!int == 0) ? (ocn_emit(3)) - : (obj_cite_number = ocn_emit(type["ocn_status"])); + : (obj_cite_number = ocn_emit(obj_type_status["ocn_status"])); an_object["is"] = "heading"; an_object_key="body_nugget"; auto substantive_object_and_anchor_tags_tuple = @@ -827,15 +827,15 @@ template SiSUdocAbstraction() { debug(objectrelated1) { // check writeln(line); } - _common_reset_(line_occur, an_object, type); + _common_reset_(line_occur, an_object, obj_type_status); an_object.remove("lev"); an_object.remove("lev_markup_number"); processing.remove("verse"); ++cntr; - } else if ((type["para"] == State.on) + } else if ((obj_type_status["para"] == State.on) && (line_occur["para"] > State.off)) { /+ paragraph object (current line empty) +/ - obj_cite_number = ocn_emit(type["ocn_status"]); + obj_cite_number = ocn_emit(obj_type_status["ocn_status"]); an_object["bookindex_nugget"] = ("bookindex_nugget" in an_object) ? an_object["bookindex_nugget"] : ""; bookindex_unordered_hashes = @@ -869,7 +869,7 @@ template SiSUdocAbstraction() { comp_obj_para.inline_notes_star = substantive_obj_misc_tuple[sObj.notes_star]; comp_obj_para.inline_links = substantive_obj_misc_tuple[sObj.links]; the_document_body_section ~= comp_obj_para; - _common_reset_(line_occur, an_object, type); + _common_reset_(line_occur, an_object, obj_type_status); indent=[ "hang_position" : 0, "base_position" : 0, @@ -897,9 +897,9 @@ template SiSUdocAbstraction() { && (the_document_body_section.length > previous_length)) { if ((the_document_body_section[$-1].is_a == "heading") && (the_document_body_section[$-1].heading_lev_markup < 5)) { - type["biblio_section"] = State.off; - type["glossary_section"] = State.off; - type["blurb_section"] = State.off; + obj_type_status["biblio_section"] = State.off; + obj_type_status["glossary_section"] = State.off; + obj_type_status["blurb_section"] = State.off; } if (the_document_body_section[$-1].is_a == "verse") { /+ scan for endnotes for whole poem (each verse in poem) +/ @@ -1621,9 +1621,6 @@ template SiSUdocAbstraction() { comp_obj_heading_.parent_lev_markup = 0; comp_obj_heading_.dom_markedup = dom_markedup.dup; comp_obj_heading_.dom_collapsed = dom_collapsed.dup; - obj_dom_set_markup_tags(comp_obj_heading_, dom_markedup, 0); - obj_dom_set_collapsed_tags(comp_obj_heading_, dom_collapsed, 0); - obj_heading_ancestors(comp_obj_heading_, lv_ancestors_txt); comp_obj_heading_ = obj_dom_set_markup_tags(comp_obj_heading_, dom_markedup, 0); comp_obj_heading_ = obj_dom_set_collapsed_tags(comp_obj_heading_, dom_collapsed, 0); comp_obj_heading_ = obj_heading_ancestors(comp_obj_heading_, lv_ancestors_txt); @@ -1729,77 +1726,77 @@ template SiSUdocAbstraction() { auto _common_reset_(L,O,T)( return ref L line_occur, return ref O an_object, - return ref T type + return ref T obj_type_status ) { debug(asserts) { - static assert(is(typeof(line_occur) == int[string])); - static assert(is(typeof(an_object) == string[string])); - static assert(is(typeof(type) == int[string])); - } - line_occur["heading"] = State.off; - line_occur["para"] = State.off; - type["heading"] = State.off; - type["para"] = State.off; + static assert(is(typeof(line_occur) == int[string])); + static assert(is(typeof(an_object) == string[string])); + static assert(is(typeof(obj_type_status) == int[string])); + } + line_occur["heading"] = State.off; + line_occur["para"] = State.off; + obj_type_status["heading"] = State.off; + obj_type_status["para"] = State.off; an_object = object_reset(an_object); } static auto _check_ocn_status_(L,T)( L line, - T type + T obj_type_status ) { debug(asserts) { static assert(is(typeof(line) == char[])); - static assert(is(typeof(type) == int[string])); + static assert(is(typeof(obj_type_status) == int[string])); } static auto rgx = Rgx(); - if ((!line.empty) && (type["ocn_status_multi_obj"] == TriState.off)) { + if ((!line.empty) && (obj_type_status["ocn_status_off_for_multiple_objects"] == TriState.off)) { /+ not multi-line object, check whether obj_cite_number is on or turned off +/ if (line.matchFirst(rgx.obj_cite_number_block_marks)) { /+ switch off obj_cite_number +/ if (line.matchFirst(rgx.obj_cite_number_off_block)) { - type["ocn_status_multi_obj"] = TriState.on; + obj_type_status["ocn_status_off_for_multiple_objects"] = TriState.on; debug(ocnoff) { writeln(line); } } if (line.matchFirst(rgx.obj_cite_number_off_block_dh)) { - type["ocn_status_multi_obj"] = TriState.closing; + obj_type_status["ocn_status_off_for_multiple_objects"] = TriState.closing; debug(ocnoff) { writeln(line); } } } else { - if (type["ocn_status_multi_obj"] == TriState.off) { + if (obj_type_status["ocn_status_off_for_multiple_objects"] == TriState.off) { if (line.matchFirst(rgx.obj_cite_number_off)) { - type["ocn_status"] = TriState.on; + obj_type_status["ocn_status"] = TriState.on; } else if (line.matchFirst(rgx.obj_cite_number_off_dh)) { - type["ocn_status"] = TriState.closing; + obj_type_status["ocn_status"] = TriState.closing; } else { - type["ocn_status"] = TriState.off; + obj_type_status["ocn_status"] = TriState.off; } } else { - type["ocn_status"] = - type["ocn_status_multi_obj"]; + obj_type_status["ocn_status"] = + obj_type_status["ocn_status_off_for_multiple_objects"]; } } - } else if ((!line.empty) && (type["ocn_status_multi_obj"] > TriState.off)) { + } else if ((!line.empty) && (obj_type_status["ocn_status_off_for_multiple_objects"] > TriState.off)) { if (line.matchFirst(rgx.obj_cite_number_off_block_close)) { - type["ocn_status_multi_obj"] = TriState.off; - type["ocn_status"] = TriState.off; + obj_type_status["ocn_status_off_for_multiple_objects"] = TriState.off; + obj_type_status["ocn_status"] = TriState.off; debug(ocnoff) { writeln(line); } } } - return type; + return obj_type_status; } void _start_block_(L,T,N)( L line, - return ref T type, + return ref T obj_type_status, return ref N obj_cite_number_poem ) { debug(asserts) { static assert(is(typeof(line) == char[])); - static assert(is(typeof(type) == int[string])); + static assert(is(typeof(obj_type_status) == int[string])); static assert(is(typeof(obj_cite_number_poem) == string[string])); } static auto rgx = Rgx(); @@ -1815,9 +1812,9 @@ template SiSUdocAbstraction() { line ); } - type["blocks"] = TriState.on; - type["code"] = TriState.on; - type["curly_code"] = TriState.on; + obj_type_status["blocks"] = TriState.on; + obj_type_status["code"] = TriState.on; + obj_type_status["curly_code"] = TriState.on; } else if (line.matchFirst(rgx.block_curly_poem_open)) { /+ curly poem open +/ debug(poem) { // poem (curly) open @@ -1828,10 +1825,10 @@ template SiSUdocAbstraction() { } obj_cite_number_poem["start"] = obj_cite_number.to!string; - type["blocks"] = TriState.on; - type["verse_new"] = State.on; - type["poem"] = TriState.on; - type["curly_poem"] = TriState.on; + obj_type_status["blocks"] = TriState.on; + obj_type_status["verse_new"] = State.on; + obj_type_status["poem"] = TriState.on; + obj_type_status["curly_poem"] = TriState.on; } else if (line.matchFirst(rgx.block_curly_group_open)) { /+ curly group open +/ debug(group) { // group (curly) open @@ -1840,9 +1837,9 @@ template SiSUdocAbstraction() { line ); } - type["blocks"] = TriState.on; - type["group"] = TriState.on; - type["curly_group"] = TriState.on; + obj_type_status["blocks"] = TriState.on; + obj_type_status["group"] = TriState.on; + obj_type_status["curly_group"] = TriState.on; } else if (line.matchFirst(rgx.block_curly_block_open)) { /+ curly block open +/ debug(block) { // block (curly) open @@ -1851,9 +1848,9 @@ template SiSUdocAbstraction() { line ); } - type["blocks"] = TriState.on; - type["block"] = TriState.on; - type["curly_block"] = TriState.on; + obj_type_status["blocks"] = TriState.on; + obj_type_status["block"] = TriState.on; + obj_type_status["curly_block"] = TriState.on; } else if (line.matchFirst(rgx.block_curly_quote_open)) { /+ curly quote open +/ debug(quote) { // quote (curly) open @@ -1862,9 +1859,9 @@ template SiSUdocAbstraction() { line ); } - type["blocks"] = TriState.on; - type["quote"] = TriState.on; - type["curly_quote"] = TriState.on; + obj_type_status["blocks"] = TriState.on; + obj_type_status["quote"] = TriState.on; + obj_type_status["curly_quote"] = TriState.on; } else if (auto m = line.matchFirst(rgx.block_curly_table_open)) { /+ curly table open +/ debug(table) { // table (curly) open @@ -1873,18 +1870,18 @@ template SiSUdocAbstraction() { line ); } - an_object["table_head"] = m.captures[1].to!string; - an_object["block_type"] = "curly"; - type["blocks"] = TriState.on; - type["table"] = TriState.on; - type["curly_table"] = TriState.on; + an_object["table_head"] = m.captures[1].to!string; + an_object["block_type"] = "curly"; + obj_type_status["blocks"] = TriState.on; + obj_type_status["table"] = TriState.on; + obj_type_status["curly_table"] = TriState.on; } else if (auto m = line.matchFirst(rgx.block_curly_table_special_markup)) { /+ table: special table block markup syntax! +/ - an_object["table_head"] = m.captures[1].to!string; - an_object["block_type"] = "special"; - type["blocks"] = TriState.on; - type["table"] = TriState.on; - type["curly_table_special_markup"] = TriState.on; + an_object["table_head"] = m.captures[1].to!string; + an_object["block_type"] = "special"; + obj_type_status["blocks"] = TriState.on; + obj_type_status["table"] = TriState.on; + obj_type_status["curly_table_special_markup"] = TriState.on; } else if (auto m = line.matchFirst(rgx.block_tic_code_open)) { /+ tic code open +/ code_block_syntax = (m.captures[1]) ? m.captures[1].to!string : ""; @@ -1895,9 +1892,9 @@ template SiSUdocAbstraction() { line ); } - type["blocks"] = TriState.on; - type["code"] = TriState.on; - type["tic_code"] = TriState.on; + obj_type_status["blocks"] = TriState.on; + obj_type_status["code"] = TriState.on; + obj_type_status["tic_code"] = TriState.on; } else if (line.matchFirst(rgx.block_tic_poem_open)) { /+ tic poem open +/ debug(poem) { // poem (tic) open @@ -1907,10 +1904,10 @@ template SiSUdocAbstraction() { ); } obj_cite_number_poem["start"] = obj_cite_number.to!string; - type["blocks"] = TriState.on; - type["verse_new"] = State.on; - type["poem"] = TriState.on; - type["tic_poem"] = TriState.on; + obj_type_status["blocks"] = TriState.on; + obj_type_status["verse_new"] = State.on; + obj_type_status["poem"] = TriState.on; + obj_type_status["tic_poem"] = TriState.on; } else if (line.matchFirst(rgx.block_tic_group_open)) { /+ tic group open +/ debug(group) { // group (tic) open @@ -1919,9 +1916,9 @@ template SiSUdocAbstraction() { line ); } - type["blocks"] = TriState.on; - type["group"] = TriState.on; - type["tic_group"] = TriState.on; + obj_type_status["blocks"] = TriState.on; + obj_type_status["group"] = TriState.on; + obj_type_status["tic_group"] = TriState.on; } else if (line.matchFirst(rgx.block_tic_block_open)) { /+ tic block open +/ debug(block) { // block (tic) open @@ -1930,9 +1927,9 @@ template SiSUdocAbstraction() { line ); } - type["blocks"] = TriState.on; - type["block"] = TriState.on; - type["tic_block"] = TriState.on; + obj_type_status["blocks"] = TriState.on; + obj_type_status["block"] = TriState.on; + obj_type_status["tic_block"] = TriState.on; } else if (line.matchFirst(rgx.block_tic_quote_open)) { /+ tic quote open +/ debug(quote) { // quote (tic) open @@ -1941,9 +1938,9 @@ template SiSUdocAbstraction() { line ); } - type["blocks"] = TriState.on; - type["quote"] = TriState.on; - type["tic_quote"] = TriState.on; + obj_type_status["blocks"] = TriState.on; + obj_type_status["quote"] = TriState.on; + obj_type_status["tic_quote"] = TriState.on; } else if (auto m = line.matchFirst(rgx.block_tic_table_open)) { /+ tic table open +/ debug(table) { // table (tic) open @@ -1952,48 +1949,48 @@ template SiSUdocAbstraction() { line ); } - an_object["table_head"] = m.captures[1].to!string; - an_object["block_type"] = "tic"; - type["blocks"] = TriState.on; - type["table"] = TriState.on; - type["tic_table"] = TriState.on; + an_object["table_head"] = m.captures[1].to!string; + an_object["block_type"] = "tic"; + obj_type_status["blocks"] = TriState.on; + obj_type_status["table"] = TriState.on; + obj_type_status["tic_table"] = TriState.on; } } void _quote_block_(L,O,T)( L line, return ref O an_object, - return ref T type + return ref T obj_type_status ) { debug(asserts) { - static assert(is(typeof(line) == char[])); - static assert(is(typeof(an_object) == string[string])); - static assert(is(typeof(type) == int[string])); + static assert(is(typeof(line) == char[])); + static assert(is(typeof(an_object) == string[string])); + static assert(is(typeof(obj_type_status) == int[string])); } static auto rgx = Rgx(); - if (type["curly_quote"] == TriState.on) { + if (obj_type_status["curly_quote"] == TriState.on) { if (line.matchFirst(rgx.block_curly_quote_close)) { debug(quote) { // quote (curly) close writeln(line); } an_object[an_object_key] = an_object[an_object_key].stripRight; - type["blocks"] = TriState.closing; - type["quote"] = TriState.closing; - type["curly_quote"] = TriState.off; + obj_type_status["blocks"] = TriState.closing; + obj_type_status["quote"] = TriState.closing; + obj_type_status["curly_quote"] = TriState.off; } else { debug(quote) { writeln(line); } an_object[an_object_key] ~= line ~= "\n"; // build quote array (or string) } - } else if (type["tic_quote"] == TriState.on) { + } else if (obj_type_status["tic_quote"] == TriState.on) { if (line.matchFirst(rgx.block_tic_close)) { debug(quote) { // quote (tic) close writeln(line); } an_object[an_object_key] = an_object[an_object_key].stripRight; - type["blocks"] = TriState.closing; - type["quote"] = TriState.closing; - type["tic_quote"] = TriState.off; + obj_type_status["blocks"] = TriState.closing; + obj_type_status["quote"] = TriState.closing; + obj_type_status["tic_quote"] = TriState.off; } else { debug(quote) { writeln(line); @@ -2005,38 +2002,38 @@ template SiSUdocAbstraction() { void _group_block_(L,O,T)( L line, return ref O an_object, - return ref T type + return ref T obj_type_status ) { debug(asserts) { - static assert(is(typeof(line) == char[])); - static assert(is(typeof(an_object) == string[string])); - static assert(is(typeof(type) == int[string])); + static assert(is(typeof(line) == char[])); + static assert(is(typeof(an_object) == string[string])); + static assert(is(typeof(obj_type_status) == int[string])); } static auto rgx = Rgx(); - if (type["curly_group"] == State.on) { + if (obj_type_status["curly_group"] == State.on) { if (line.matchFirst(rgx.block_curly_group_close)) { debug(group) { writeln(line); } an_object[an_object_key] = an_object[an_object_key].stripRight; - type["blocks"] = TriState.closing; - type["group"] = TriState.closing; - type["curly_group"] = TriState.off; + obj_type_status["blocks"] = TriState.closing; + obj_type_status["group"] = TriState.closing; + obj_type_status["curly_group"] = TriState.off; } else { debug(group) { writeln(line); } an_object[an_object_key] ~= line ~= "\n"; // build group array (or string) } - } else if (type["tic_group"] == TriState.on) { + } else if (obj_type_status["tic_group"] == TriState.on) { if (line.matchFirst(rgx.block_tic_close)) { debug(group) { writeln(line); } an_object[an_object_key] = an_object[an_object_key].stripRight; - type["blocks"] = TriState.closing; - type["group"] = TriState.closing; - type["tic_group"] = TriState.off; + obj_type_status["blocks"] = TriState.closing; + obj_type_status["group"] = TriState.closing; + obj_type_status["tic_group"] = TriState.off; } else { debug(group) { // group writeln(line); @@ -2048,38 +2045,38 @@ template SiSUdocAbstraction() { void _block_block_(L,O,T)( L line, return ref O an_object, - return ref T type + return ref T obj_type_status ) { debug(asserts) { - static assert(is(typeof(line) == char[])); - static assert(is(typeof(an_object) == string[string])); - static assert(is(typeof(type) == int[string])); + static assert(is(typeof(line) == char[])); + static assert(is(typeof(an_object) == string[string])); + static assert(is(typeof(obj_type_status) == int[string])); } static auto rgx = Rgx(); - if (type["curly_block"] == TriState.on) { + if (obj_type_status["curly_block"] == TriState.on) { if (line.matchFirst(rgx.block_curly_block_close)) { debug(block) { // block (curly) close writeln(line); } an_object[an_object_key] = an_object[an_object_key].stripRight; - type["blocks"] = TriState.closing; - type["block"] = TriState.closing; - type["curly_block"] = TriState.off; + obj_type_status["blocks"] = TriState.closing; + obj_type_status["block"] = TriState.closing; + obj_type_status["curly_block"] = TriState.off; } else { debug(block) { writeln(line); } an_object[an_object_key] ~= line ~= "\n"; // build block array (or string) } - } else if (type["tic_block"] == TriState.on) { + } else if (obj_type_status["tic_block"] == TriState.on) { if (line.matchFirst(rgx.block_tic_close)) { debug(block) { writeln(line); } an_object[an_object_key] = an_object[an_object_key].stripRight; - type["blocks"] = TriState.closing; - type["block"] = TriState.closing; - type["tic_block"] = TriState.off; + obj_type_status["blocks"] = TriState.closing; + obj_type_status["block"] = TriState.closing; + obj_type_status["tic_block"] = TriState.off; } else { debug(block) { writeln(line); @@ -2091,7 +2088,7 @@ template SiSUdocAbstraction() { void _poem_block_(L,O,T,C,N,Ma)( L line, return ref O an_object, - return ref T type, + return ref T obj_type_status, return ref C cntr, N obj_cite_number_poem, Ma dochead_make_aa, @@ -2099,13 +2096,13 @@ template SiSUdocAbstraction() { debug(asserts) { static assert(is(typeof(line) == char[])); static assert(is(typeof(an_object) == string[string])); - static assert(is(typeof(type) == int[string])); + static assert(is(typeof(obj_type_status) == int[string])); static assert(is(typeof(cntr) == int)); static assert(is(typeof(obj_cite_number_poem) == string[string])); static assert(is(typeof(dochead_make_aa) == string[string][string])); } static auto rgx = Rgx(); - if (type["curly_poem"] == TriState.on) { + if (obj_type_status["curly_poem"] == TriState.on) { if (line.matchFirst(rgx.block_curly_poem_close)) { if (an_object_key in an_object || processing.length > 0) { @@ -2157,21 +2154,21 @@ template SiSUdocAbstraction() { } obj_cite_number_poem["end"] = obj_cite_number.to!string; - type["blocks"] = TriState.closing; - type["poem"] = TriState.closing; - type["curly_poem"] = TriState.off; + obj_type_status["blocks"] = TriState.closing; + obj_type_status["poem"] = TriState.closing; + obj_type_status["curly_poem"] = TriState.off; } else { processing["verse"] ~= line ~= "\n"; - if (type["verse_new"] == State.on) { + if (obj_type_status["verse_new"] == State.on) { obj_cite_number = - ocn_emit(type["ocn_status"]); - type["verse_new"] = State.off; + ocn_emit(obj_type_status["ocn_status"]); + obj_type_status["verse_new"] = State.off; } else if (line.matchFirst(rgx.newline_eol_delimiter_only)) { processing["verse"] = processing["verse"].stripRight; verse_line = TriState.off; - type["verse_new"] = State.on; + obj_type_status["verse_new"] = State.on; } - if (type["verse_new"] == State.on) { + if (obj_type_status["verse_new"] == State.on) { verse_line=1; an_object[an_object_key] = processing["verse"]; debug(poem) { // poem verse @@ -2211,7 +2208,7 @@ template SiSUdocAbstraction() { ++cntr; } } - } else if (type["tic_poem"] == TriState.on) { + } else if (obj_type_status["tic_poem"] == TriState.on) { if (auto m = line.matchFirst(rgx.block_tic_close)) { // tic_poem_close an_object[an_object_key]="verse"; debug(poem) { // poem (curly) close @@ -2250,21 +2247,21 @@ template SiSUdocAbstraction() { processing.remove("verse"); ++cntr; } - type["blocks"] = TriState.closing; - type["poem"] = TriState.closing; - type["tic_poem"] = TriState.off; + obj_type_status["blocks"] = TriState.closing; + obj_type_status["poem"] = TriState.closing; + obj_type_status["tic_poem"] = TriState.off; } else { processing["verse"] ~= line ~= "\n"; - if (type["verse_new"] == State.on) { + if (obj_type_status["verse_new"] == State.on) { obj_cite_number = - ocn_emit(type["ocn_status"]); - type["verse_new"] = State.off; + ocn_emit(obj_type_status["ocn_status"]); + obj_type_status["verse_new"] = State.off; } else if (line.matchFirst(rgx.newline_eol_delimiter_only)) { processing["verse"] = processing["verse"].stripRight; - type["verse_new"] = State.on; + obj_type_status["verse_new"] = State.on; verse_line = TriState.off; } - if (type["verse_new"] == State.on) { + if (obj_type_status["verse_new"] == State.on) { verse_line=1; an_object[an_object_key] = processing["verse"]; debug(poem) { // poem (tic) close @@ -2310,15 +2307,15 @@ template SiSUdocAbstraction() { void _code_block_(L,O,T)( L line, return ref O an_object, - return ref T type + return ref T obj_type_status ) { debug(asserts) { - static assert(is(typeof(line) == char[])); - static assert(is(typeof(an_object) == string[string])); - static assert(is(typeof(type) == int[string])); + static assert(is(typeof(line) == char[])); + static assert(is(typeof(an_object) == string[string])); + static assert(is(typeof(obj_type_status) == int[string])); } static auto rgx = Rgx(); - if (type["curly_code"] == TriState.on) { + if (obj_type_status["curly_code"] == TriState.on) { if (line.matchFirst(rgx.block_curly_code_close)) { debug(code) { // code (curly) close writeln(line); @@ -2326,16 +2323,16 @@ template SiSUdocAbstraction() { an_object[an_object_key] = an_object[an_object_key] .replaceFirst(rgx.newline_eol_delimiter_only, "") .stripRight; - type["blocks"] = TriState.closing; - type["code"] = TriState.closing; - type["curly_code"] = TriState.off; + obj_type_status["blocks"] = TriState.closing; + obj_type_status["code"] = TriState.closing; + obj_type_status["curly_code"] = TriState.off; } else { debug(code) { // code (curly) line writeln(line); } an_object[an_object_key] ~= line ~= "\n"; // code (curly) line } - } else if (type["tic_code"] == TriState.on) { + } else if (obj_type_status["tic_code"] == TriState.on) { if (line.matchFirst(rgx.block_tic_close)) { debug(code) { // code (tic) close writeln(line); @@ -2343,9 +2340,9 @@ template SiSUdocAbstraction() { an_object[an_object_key] = an_object[an_object_key] .replaceFirst(rgx.newline_eol_delimiter_only, "") .stripRight; - type["blocks"] = TriState.closing; - type["code"] = TriState.closing; - type["tic_code"] = TriState.off; + obj_type_status["blocks"] = TriState.closing; + obj_type_status["code"] = TriState.closing; + obj_type_status["tic_code"] = TriState.off; } else { debug(code) { // code (tic) line writeln(line); @@ -2357,34 +2354,34 @@ template SiSUdocAbstraction() { void _table_block_(L,O,T,Ma)( L line, return ref O an_object, - return ref T type, + return ref T obj_type_status, return ref Ma dochead_make_aa ) { debug(asserts) { - static assert(is(typeof(line) == char[])); - static assert(is(typeof(an_object) == string[string])); - static assert(is(typeof(type) == int[string])); + static assert(is(typeof(line) == char[])); + static assert(is(typeof(an_object) == string[string])); + static assert(is(typeof(obj_type_status) == int[string])); } static auto rgx = Rgx(); - if (type["curly_table"] == TriState.on) { + if (obj_type_status["curly_table"] == TriState.on) { if (line.matchFirst(rgx.block_curly_table_close)) { debug(table) { // table (curly) close writeln(line); } - type["blocks"] = TriState.closing; - type["table"] = TriState.closing; - type["curly_table"] = TriState.off; + obj_type_status["blocks"] = TriState.closing; + obj_type_status["table"] = TriState.closing; + obj_type_status["curly_table"] = TriState.off; } else { debug(table) { // table writeln(line); } an_object[an_object_key] ~= line ~= "\n"; // build table array (or string) } - } else if (type["curly_table_special_markup"] == TriState.on) { + } else if (obj_type_status["curly_table_special_markup"] == TriState.on) { if (line.empty) { - type["blocks"] = TriState.off; - type["table"] = TriState.off; - type["curly_table_special_markup"] = TriState.off; + obj_type_status["blocks"] = TriState.off; + obj_type_status["table"] = TriState.off; + obj_type_status["curly_table_special_markup"] = TriState.off; _table_closed_make_special_notation_table_( line, an_object, @@ -2392,7 +2389,7 @@ template SiSUdocAbstraction() { obj_cite_number, comp_obj_heading, cntr, - type, + obj_type_status, dochead_make_aa ); } else { @@ -2401,14 +2398,14 @@ template SiSUdocAbstraction() { } an_object[an_object_key] ~= line ~= "\n"; } - } else if (type["tic_table"] == TriState.on) { + } else if (obj_type_status["tic_table"] == TriState.on) { if (line.matchFirst(rgx.block_tic_close)) { debug(table) { // table (tic) close writeln(line); } - type["blocks"] = TriState.closing; - type["table"] = TriState.closing; - type["tic_table"] = TriState.off; + obj_type_status["blocks"] = TriState.closing; + obj_type_status["table"] = TriState.closing; + obj_type_status["tic_table"] = TriState.off; } else { debug(table) { // table writeln(line); @@ -2441,7 +2438,7 @@ template SiSUdocAbstraction() { } void _biblio_block_( char[] line, - return ref int[string] type, + return ref int[string] obj_type_status, return ref int bib_entry, return ref string biblio_entry_str_json, return ref string[] biblio_arr_json @@ -2450,9 +2447,9 @@ template SiSUdocAbstraction() { auto jsn = BibJsnStr(); static auto rgx = Rgx(); if (line.matchFirst(rgx.heading_biblio)) { - type["biblio_section"] = TriState.on; - type["blurb_section"] = State.off; - type["glossary_section"] = State.off; + obj_type_status["biblio_section"] = TriState.on; + obj_type_status["blurb_section"] = State.off; + obj_type_status["glossary_section"] = State.off; } if (line.empty) { debug { @@ -2568,12 +2565,12 @@ template SiSUdocAbstraction() { return ref int obj_cite_number, return ref ObjGenericComposite _comp_obj_heading, return ref int cntr, - return ref int[string] type, + return ref int[string] obj_type_status, string[string][string] dochead_make_aa, ) { comp_obj_block = comp_obj_block.init; obj_cite_number = - ocn_emit(type["ocn_status"]); + ocn_emit(obj_type_status["ocn_status"]); auto comp_obj_location = node_construct.node_location_emitter( content_non_header, @@ -2605,7 +2602,7 @@ template SiSUdocAbstraction() { return ref int obj_cite_number, return ref ObjGenericComposite _comp_obj_heading, return ref int cntr, - return ref int[string] type, + return ref int[string] obj_type_status, string[string] obj_cite_number_poem, string[string][string] dochead_make_aa, ) { @@ -2615,13 +2612,13 @@ template SiSUdocAbstraction() { ~ line ~ "\"" ); assert( - (type["blocks"] == TriState.closing), + (obj_type_status["blocks"] == TriState.closing), "code block status: closed" ); - assertions_flag_types_block_status_none_or_closed(type); - if (type["quote"] == TriState.closing) { + assertions_flag_types_block_status_none_or_closed(obj_type_status); + if (obj_type_status["quote"] == TriState.closing) { obj_cite_number = - ocn_emit(type["ocn_status"]); + ocn_emit(obj_type_status["ocn_status"]); an_object["bookindex_nugget"] = ("bookindex_nugget" in an_object) ? an_object["bookindex_nugget"] : ""; bookindex_unordered_hashes = @@ -2655,14 +2652,14 @@ template SiSUdocAbstraction() { comp_obj_block.inline_notes_star = substantive_obj_misc_tuple[sObj.notes_star]; comp_obj_block.inline_links = substantive_obj_misc_tuple[sObj.links]; the_document_body_section ~= comp_obj_block; - type["blocks"] = TriState.off; - type["quote"] = TriState.off; + obj_type_status["blocks"] = TriState.off; + obj_type_status["quote"] = TriState.off; object_reset(an_object); processing.remove("verse"); ++cntr; - } else if (type["group"] == TriState.closing) { + } else if (obj_type_status["group"] == TriState.closing) { obj_cite_number = - ocn_emit(type["ocn_status"]); + ocn_emit(obj_type_status["ocn_status"]); an_object["bookindex_nugget"] = ("bookindex_nugget" in an_object) ? an_object["bookindex_nugget"] : ""; bookindex_unordered_hashes = @@ -2696,13 +2693,13 @@ template SiSUdocAbstraction() { comp_obj_block.inline_notes_star = substantive_obj_misc_tuple[sObj.notes_star]; comp_obj_block.inline_links = substantive_obj_misc_tuple[sObj.links]; the_document_body_section ~= comp_obj_block; - type["blocks"] = TriState.off; - type["group"] = TriState.off; + obj_type_status["blocks"] = TriState.off; + obj_type_status["group"] = TriState.off; object_reset(an_object); processing.remove("verse"); ++cntr; - } else if (type["block"] == TriState.closing) { - obj_cite_number = ocn_emit(type["ocn_status"]); + } else if (obj_type_status["block"] == TriState.closing) { + obj_cite_number = ocn_emit(obj_type_status["ocn_status"]); an_object["bookindex_nugget"] = ("bookindex_nugget" in an_object) ? an_object["bookindex_nugget"] : ""; bookindex_unordered_hashes = @@ -2735,12 +2732,12 @@ template SiSUdocAbstraction() { comp_obj_block.inline_notes_star = substantive_obj_misc_tuple[sObj.notes_star]; comp_obj_block.inline_links = substantive_obj_misc_tuple[sObj.links]; the_document_body_section ~= comp_obj_block; - type["blocks"] = TriState.off; - type["block"] = TriState.off; + obj_type_status["blocks"] = TriState.off; + obj_type_status["block"] = TriState.off; object_reset(an_object); processing.remove("verse"); ++cntr; - } else if (type["poem"] == TriState.closing) { + } else if (obj_type_status["poem"] == TriState.closing) { an_object["bookindex_nugget"] = ("bookindex_nugget" in an_object) ? an_object["bookindex_nugget"] : ""; bookindex_unordered_hashes = @@ -2767,13 +2764,13 @@ template SiSUdocAbstraction() { comp_obj_poem_ocn.obj_cite_number = (obj_cite_number_poem["start"], obj_cite_number_poem["end"]); comp_obj_poem_ocn.text = ""; the_document_body_section ~= comp_obj_poem_ocn; - type["blocks"] = TriState.off; - type["poem"] = TriState.off; + obj_type_status["blocks"] = TriState.off; + obj_type_status["poem"] = TriState.off; object_reset(an_object); processing.remove("verse"); - } else if (type["code"] == TriState.closing) { + } else if (obj_type_status["code"] == TriState.closing) { obj_cite_number = - ocn_emit(type["ocn_status"]); + ocn_emit(obj_type_status["ocn_status"]); an_object["bookindex_nugget"] = ("bookindex_nugget" in an_object) ? an_object["bookindex_nugget"] : ""; bookindex_unordered_hashes = @@ -2807,15 +2804,15 @@ template SiSUdocAbstraction() { comp_obj_code.inline_notes_star = substantive_obj_misc_tuple[sObj.notes_star]; comp_obj_code.inline_links = substantive_obj_misc_tuple[sObj.links]; the_document_body_section ~= comp_obj_code; - type["blocks"] = TriState.off; - type["code"] = TriState.off; + obj_type_status["blocks"] = TriState.off; + obj_type_status["code"] = TriState.off; object_reset(an_object); processing.remove("verse"); ++cntr; - } else if (type["table"] == TriState.closing) { + } else if (obj_type_status["table"] == TriState.closing) { comp_obj_block = comp_obj_block.init; obj_cite_number = - ocn_emit(type["ocn_status"]); + ocn_emit(obj_type_status["ocn_status"]); an_object["bookindex_nugget"] = ("bookindex_nugget" in an_object) ? an_object["bookindex_nugget"] : ""; bookindex_unordered_hashes = @@ -2843,8 +2840,8 @@ template SiSUdocAbstraction() { comp_obj_block = table_instructions(comp_obj_block, an_object["table_head"]); comp_obj_block = table_substantive_munge(comp_obj_block, an_object["substantive"]); the_document_body_section ~= comp_obj_block; - type["blocks"] = TriState.off; - type["table"] = TriState.off; + obj_type_status["blocks"] = TriState.off; + obj_type_status["table"] = TriState.off; object_reset(an_object); processing.remove("verse"); ++cntr; @@ -2854,14 +2851,14 @@ template SiSUdocAbstraction() { L line, return ref I book_idx_tmp, return ref O an_object, - return ref T type, + return ref T obj_type_status, B opt_action, ) { debug(asserts) { static assert(is(typeof(line) == char[])); static assert(is(typeof(book_idx_tmp) == string)); static assert(is(typeof(an_object) == string[string])); - static assert(is(typeof(type) == int[string])); + static assert(is(typeof(obj_type_status) == int[string])); static assert(is(typeof(opt_action) == bool[string])); } static auto rgx = Rgx(); @@ -2876,7 +2873,7 @@ template SiSUdocAbstraction() { an_object["bookindex_nugget"] = m.captures[1].to!string; } else if (auto m = line.match(rgx.book_index_open)) { /+ match open book_index +/ - type["book_index"] = State.on; + obj_type_status["book_index"] = State.on; if (opt_action["backmatter"] && opt_action["section_bookindex"]) { book_idx_tmp = m.captures[1].to!string; debug(bookindexmatch) { // book index @@ -2886,10 +2883,10 @@ template SiSUdocAbstraction() { ); } } - } else if (type["book_index"] == State.on ) { + } else if (obj_type_status["book_index"] == State.on ) { /+ book_index flag set +/ if (auto m = line.match(rgx.book_index_close)) { - type["book_index"] = State.off; + obj_type_status["book_index"] = State.off; if (opt_action["backmatter"] && opt_action["section_bookindex"]) { an_object["bookindex_nugget"] = book_idx_tmp ~ m.captures[1].to!string; @@ -2914,18 +2911,18 @@ template SiSUdocAbstraction() { X dochead_make_identify_unmarked_headings, return ref H heading_match_str, return ref R heading_match_rgx, - return ref T type + return ref T obj_type_status ) { debug(asserts) { static assert(is(typeof(line) == char[])); static assert(is(typeof(dochead_make_identify_unmarked_headings) == string)); static assert(is(typeof(heading_match_str) == string[string])); static assert(is(typeof(heading_match_rgx) == Regex!(char)[string])); - static assert(is(typeof(type) == int[string])); + static assert(is(typeof(obj_type_status) == int[string])); } static auto rgx = Rgx(); if ((dochead_make_identify_unmarked_headings.length > 2) - && (type["make_headings"] == State.off)) { + && (obj_type_status["make_headings"] == State.off)) { /+ headings found +/ debug(headingsfound) { writeln(dochead_make_identify_unmarked_headings); @@ -2997,26 +2994,26 @@ template SiSUdocAbstraction() { default: break; } - type["make_headings"] = State.on; + obj_type_status["make_headings"] = State.on; } } auto _heading_make_set_(L,C,R,T)( L line, C line_occur, return ref R heading_match_rgx, - return ref T type + return ref T obj_type_status ) { debug(asserts) { static assert(is(typeof(line) == char[])); static assert(is(typeof(line_occur) == int[string])); static assert(is(typeof(heading_match_rgx) == Regex!(char)[string])); - static assert(is(typeof(type) == int[string])); + static assert(is(typeof(obj_type_status) == int[string])); } - if ((type["make_headings"] == State.on) + if ((obj_type_status["make_headings"] == State.on) && ((line_occur["para"] == State.off) && (line_occur["heading"] == State.off)) - && ((type["para"] == State.off) - && (type["heading"] == State.off))) { + && ((obj_type_status["para"] == State.off) + && (obj_type_status["heading"] == State.off))) { /+ heading make set +/ if (line.matchFirst(heading_match_rgx["h_B"])) { line = "B~ " ~ line; @@ -3070,7 +3067,7 @@ template SiSUdocAbstraction() { return ref K an_object_key, return ref Lv lv, return ref Lc collapsed_lev, - return ref T type, + return ref T obj_type_status, return ref Me dochead_meta_aa, ) { debug(asserts) { @@ -3080,19 +3077,19 @@ template SiSUdocAbstraction() { static assert(is(typeof(an_object_key) == string)); static assert(is(typeof(lv) == int[string])); static assert(is(typeof(collapsed_lev) == int[string])); - static assert(is(typeof(type) == int[string])); + static assert(is(typeof(obj_type_status) == int[string])); static assert(is(typeof(dochead_meta_aa) == string[string][string])); } static auto rgx = Rgx(); if (auto m = line.match(rgx.heading)) { /+ heading match +/ - type["heading"] = State.on; + obj_type_status["heading"] = State.on; if (line.match(rgx.heading_seg_and_above)) { - type["biblio_section"] = State.off; - type["glossary_section"] = State.off; - type["blurb_section"] = State.off; + obj_type_status["biblio_section"] = State.off; + obj_type_status["glossary_section"] = State.off; + obj_type_status["blurb_section"] = State.off; } - type["para"] = State.off; + obj_type_status["para"] = State.off; ++line_occur["heading"]; an_object[an_object_key] ~= line ~= "\n"; an_object["lev"] ~= m.captures[1]; @@ -3224,23 +3221,23 @@ template SiSUdocAbstraction() { return ref K an_object_key, return ref I indent, return ref B bullet, - return ref T type, + return ref T obj_type_status, return ref C line_occur, ) { debug(asserts) { - static assert(is(typeof(line) == char[])); - static assert(is(typeof(an_object) == string[string])); - static assert(is(typeof(an_object_key) == string)); - static assert(is(typeof(indent) == int[string])); - static assert(is(typeof(bullet) == bool)); - static assert(is(typeof(type) == int[string])); - static assert(is(typeof(line_occur) == int[string])); + static assert(is(typeof(line) == char[])); + static assert(is(typeof(an_object) == string[string])); + static assert(is(typeof(an_object_key) == string)); + static assert(is(typeof(indent) == int[string])); + static assert(is(typeof(bullet) == bool)); + static assert(is(typeof(obj_type_status) == int[string])); + static assert(is(typeof(line_occur) == int[string])); } static auto rgx = Rgx(); if (line_occur["para"] == State.off) { line = font_faces_line(line); /+ para matches +/ - type["para"] = State.on; + obj_type_status["para"] = State.on; an_object[an_object_key] ~= line; // body_nugget indent=[ "hang_position" : 0, @@ -5547,29 +5544,29 @@ template SiSUdocAbstraction() { break; } } - pure void assertions_flag_types_block_status_none_or_closed(T)(T type) { + pure void assertions_flag_types_block_status_none_or_closed(T)(T obj_type_status) { debug(asserts) { - static assert(is(typeof(type) == int[string])); + static assert(is(typeof(obj_type_status) == int[string])); } assert( - (type["code"] == TriState.off) - || (type["code"] == TriState.closing), + (obj_type_status["code"] == TriState.off) + || (obj_type_status["code"] == TriState.closing), "code block status: off or closing"); assert( - (type["poem"] == TriState.off) - || (type["poem"] == TriState.closing), + (obj_type_status["poem"] == TriState.off) + || (obj_type_status["poem"] == TriState.closing), "poem status: off or closing"); assert( - (type["table"] == TriState.off) - || (type["table"] == TriState.closing), + (obj_type_status["table"] == TriState.off) + || (obj_type_status["table"] == TriState.closing), "table status: off or closing"); assert( - (type["group"] == TriState.off) - || (type["group"] == TriState.closing), + (obj_type_status["group"] == TriState.off) + || (obj_type_status["group"] == TriState.closing), "group block status: off or closing"); assert( - (type["block"] == TriState.off) - || (type["block"] == TriState.closing), + (obj_type_status["block"] == TriState.off) + || (obj_type_status["block"] == TriState.closing), "block status: off or closing"); } /+ abstraction functions assertions ↑ +/ |