diff options
Diffstat (limited to 'src/doc_reform')
-rw-r--r-- | src/doc_reform/meta/defaults.d | 32 | ||||
-rw-r--r-- | src/doc_reform/meta/metadoc_from_src.d | 841 |
2 files changed, 429 insertions, 444 deletions
diff --git a/src/doc_reform/meta/defaults.d b/src/doc_reform/meta/defaults.d index 8b6edad..e592be7 100644 --- a/src/doc_reform/meta/defaults.d +++ b/src/doc_reform/meta/defaults.d @@ -2,38 +2,6 @@ default settings +/ module doc_reform.meta.defaults; -template spineDocStatus() { - @safe static auto status() { - struct _e { - enum sect { - unset, - head, - toc, - substantive, - bibliography, - glossary, - book_index, - blurb, - } - enum block { - off, - closing, - code, - poem, - block, - group, - table, - quote, - } - enum ocn { - on, // 0 object_number; - off, // 1 no object_number; - dummy, // 2 no object_number & dummy headings - } - } - return _e(); - } -} template spineRgxDocStructFlags() { /+ regex flags +/ @safe static int[string] flags_type_init() { diff --git a/src/doc_reform/meta/metadoc_from_src.d b/src/doc_reform/meta/metadoc_from_src.d index 6aa1eb6..1ae2e01 100644 --- a/src/doc_reform/meta/metadoc_from_src.d +++ b/src/doc_reform/meta/metadoc_from_src.d @@ -21,6 +21,30 @@ template docAbstraction() { mixin ObjectSetter; mixin InternalMarkup; mixin spineRgxIn; + @safe static auto eN() { + struct _e { + enum bi { + off, + on, + } + enum tri { + off, + on, + closing, + } + enum sect { + unset, + head, + toc, + substantive, + bibliography, + glossary, + book_index, + blurb, + } + } + return _e(); + } /+ ↓ abstraction struct init +/ /+ initialize +/ ObjGenericComposite[] the_table_of_contents_section; @@ -36,8 +60,6 @@ template docAbstraction() { string[string][string] tag_assoc; string[] lv0_to_3_tags; /+ enum +/ - enum State { off, on } - enum TriState { off, on, closing } enum DocStructMarkupHeading { h_sect_A, h_sect_B, @@ -50,7 +72,6 @@ template docAbstraction() { h_text_5, // extra level, drop content_non_header } // header section A-D; header text 1-4 - enum Status { off, on, } enum OCNstatus { on, off, bkidx, closing, reset, } enum OCN_off_block_status { off, on } enum OCNtype { ocn, non, bkidx, } @@ -356,7 +377,6 @@ template docAbstraction() { reset_note_numbers=true; } mixin spineRgxDocStructFlags; - mixin spineDocStatus; mixin spineNode; auto node_para_int_ = node_metadata_para_int; auto node_para_str_ = node_metadata_para_str; @@ -380,7 +400,7 @@ template docAbstraction() { "images" : 0, ]; auto obj_type_status = flags_type_init; - int[string] track = [ + int[string] track_state = [ "section" : 0, "block" : 0, "obj" : 0, @@ -392,26 +412,26 @@ template docAbstraction() { ]; string[] lv_ancestors_txt = [ "", "", "", "", "", "", "", "", ]; int[string] lv = [ - "lv" : State.off, - "h0" : State.off, - "h1" : State.off, - "h2" : State.off, - "h3" : State.off, - "h4" : State.off, - "h5" : State.off, - "h6" : State.off, - "h7" : State.off, + "lv" : eN.bi.off, + "h0" : eN.bi.off, + "h1" : eN.bi.off, + "h2" : eN.bi.off, + "h3" : eN.bi.off, + "h4" : eN.bi.off, + "h5" : eN.bi.off, + "h6" : eN.bi.off, + "h7" : eN.bi.off, "lev_int_collapsed" : 0, ]; int[string] collapsed_lev = [ - "h0" : State.off, - "h1" : State.off, - "h2" : State.off, - "h3" : State.off, - "h4" : State.off, - "h5" : State.off, - "h6" : State.off, - "h7" : State.off + "h0" : eN.bi.off, + "h1" : eN.bi.off, + "h2" : eN.bi.off, + "h3" : eN.bi.off, + "h4" : eN.bi.off, + "h5" : eN.bi.off, + "h6" : eN.bi.off, + "h7" : eN.bi.off ]; string[string] heading_match_str = [ "h_A": "^(none)", @@ -526,7 +546,7 @@ template docAbstraction() { if (!line.empty) { obj_type_status = line._check_ocn_status_(obj_type_status); } - if (obj_type_status["code"] == TriState.on) { + if (obj_type_status["code"] == eN.tri.on) { /+ block object: code +/ line.flow_txt_block_code(an_object, obj_type_status); continue; @@ -535,15 +555,15 @@ template docAbstraction() { /+ heading, glossary, blurb, poem, group, block, quote, table +/ line = line.inline_markup_faces; // by text line (rather than by text object), linebreaks in para problematic if (line.matchFirst(rgx.heading_biblio) - || (track["section"] == status.sect.bibliography + || (track_state["section"] == eN.sect.bibliography && ((!(line.matchFirst(rgx.heading_glossary))) && (!(line.matchFirst(rgx.heading_blurb))) && (!(line.matchFirst(rgx.heading))) && (!(line.matchFirst(rgx.comment))))) ) { - track["section"] = status.sect.bibliography; + track_state["section"] = eN.sect.bibliography; if (opt_action.backmatter && opt_action.section_biblio) { - line.flow_txt_block_biblio(obj_type_status, bib_entry, biblio_entry_str_json, biblio_arr_json, track); + line.flow_txt_block_biblio(obj_type_status, bib_entry, biblio_entry_str_json, biblio_arr_json, track_state); debug(bibliobuild) { writeln("- ", biblio_entry_str_json); writeln("-> ", biblio_arr_json.length); @@ -551,7 +571,7 @@ template docAbstraction() { } continue; } else if (line.matchFirst(rgx.heading_glossary) - || (track["section"] == status.sect.glossary + || (track_state["section"] == eN.sect.glossary && ((!(line.matchFirst(rgx.heading_biblio))) && (!(line.matchFirst(rgx.heading_blurb))) && (!(line.matchFirst(rgx.heading))) @@ -562,15 +582,15 @@ template docAbstraction() { writeln(__LINE__); writeln(line); } - track["section"] = status.sect.glossary; + track_state["section"] = eN.sect.glossary; if (opt_action.backmatter && opt_action.section_glossary) { indent=[ "hang_position" : 0, "base_position" : 0, ]; bullet = false; - obj_type_status["para"] = State.on; - line_occur["para"] = State.off; + obj_type_status["para"] = eN.bi.on; + line_occur["para"] = eN.bi.off; an_object_key="glossary_nugget"; // if (line.matchFirst(rgx.heading_glossary)) { { @@ -646,13 +666,13 @@ template docAbstraction() { } continue; } else if (line.matchFirst(rgx.heading_blurb) - || (track["section"] == status.sect.blurb + || (track_state["section"] == eN.sect.blurb && ((!(line.matchFirst(rgx.heading_glossary))) && (!(line.matchFirst(rgx.heading_biblio))) && (!(line.matchFirst(rgx.heading))) && (!(line.matchFirst(rgx.comment))))) ) { - track["section"] = status.sect.blurb; + track_state["section"] = eN.sect.blurb; debug(blurb) { writeln(__LINE__); writeln(line); @@ -692,8 +712,8 @@ template docAbstraction() { ]; bullet = true; } - obj_type_status["para"] = State.on; - line_occur["para"] = State.off; + obj_type_status["para"] = eN.bi.on; + line_occur["para"] = eN.bi.off; an_object_key="blurb_nugget"; if (line.matchFirst(rgx.heading_blurb)) { { @@ -792,21 +812,21 @@ template docAbstraction() { obj_type_status["ocn_status"] = OCNstatus.on; } continue; - } else if (obj_type_status["quote"] == TriState.on) { /+ within block object: quote +/ + } else if (obj_type_status["quote"] == eN.tri.on) { /+ within block object: quote +/ line = line ._doc_header_and_make_substitutions_(conf_make_meta) ._doc_header_and_make_substitutions_fontface_(conf_make_meta); an_object = line.flow_txt_block_quote(an_object, obj_type_status); continue; /+ within block object: group +/ - } else if (obj_type_status["group"] == TriState.on) { /+ within block object: group +/ + } else if (obj_type_status["group"] == eN.tri.on) { /+ within block object: group +/ line = line ._doc_header_and_make_substitutions_(conf_make_meta) ._doc_header_and_make_substitutions_fontface_(conf_make_meta) .replaceAll(rgx.para_delimiter, mkup.br_paragraph ~ "$1"); an_object = line.flow_txt_block_group(an_object, obj_type_status); continue; - } else if (obj_type_status["block"] == TriState.on) { /+ within block object: block +/ + } else if (obj_type_status["block"] == eN.tri.on) { /+ within block object: block +/ line = line ._doc_header_and_make_substitutions_(conf_make_meta) ._doc_header_and_make_substitutions_fontface_(conf_make_meta); @@ -816,16 +836,16 @@ template docAbstraction() { } an_object = line.flow_txt_block_block(an_object, obj_type_status); continue; - } else if (obj_type_status["poem"] == TriState.on) { /+ within block object: poem +/ + } else if (obj_type_status["poem"] == eN.tri.on) { /+ within block object: poem +/ an_object = line.flow_txt_block_poem(an_object, obj_type_status, cntr, object_number_poem, conf_make_meta, tag_in_seg); continue; - } else if (obj_type_status["table"] == TriState.on) { /+ within block object: table +/ + } else if (obj_type_status["table"] == eN.tri.on) { /+ within block object: table +/ an_object = line.flow_txt_block_table(an_object, obj_type_status, conf_make_meta); continue; } else { /+ not within a block group +/ assert( - (obj_type_status["blocks"] == TriState.off) - || (obj_type_status["blocks"] == TriState.closing), + (obj_type_status["blocks"] == eN.tri.off) + || (obj_type_status["blocks"] == eN.tri.closing), "block status: none or closed" ); assertions_flag_types_block_status_none_or_closed(obj_type_status); @@ -844,11 +864,11 @@ template docAbstraction() { "line tested, line not empty surely:\n \"" ~ line ~ "\"" ); assert( - (obj_type_status["blocks"] == TriState.off) - || (obj_type_status["blocks"] == TriState.closing), + (obj_type_status["blocks"] == eN.tri.off) + || (obj_type_status["blocks"] == eN.tri.closing), "code block status: none or closed" ); - if (obj_type_status["blocks"] == TriState.closing) { + if (obj_type_status["blocks"] == eN.tri.closing) { debug(check) { writeln(__LINE__); writeln(line); @@ -856,15 +876,15 @@ template docAbstraction() { assert( line.matchFirst(rgx.book_index_item) || line.matchFirst(rgx.book_index_item_open) - || track["section"] == status.sect.book_index, + || track_state["section"] == eN.sect.book_index, "\nblocks closed, unless followed by book index, non-matching line:\n \"" ~ line ~ "\"" ); } if (line.matchFirst(rgx.book_index_item) || line.matchFirst(rgx.book_index_item_open) - || track["section"] == status.sect.book_index) { /+ book_index +/ - an_object = line.flow_book_index_(an_object, book_idx_tmp, obj_type_status, track, opt_action); + || track_state["section"] == eN.sect.book_index) { /+ book_index +/ + an_object = line.flow_book_index_(an_object, book_idx_tmp, obj_type_status, track_state, opt_action); } else { /+ not book_index +/ an_object_key="body_nugget"; if (auto m = line.matchFirst(rgx.comment)) { /+ matched comment +/ @@ -882,19 +902,19 @@ template docAbstraction() { flow_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)) - && ((obj_type_status["para"] == State.off) - && (obj_type_status["heading"] == State.off))) { /+ heading or para but neither flag nor line exists +/ + } else if (((line_occur["para"] == eN.bi.off) + && (line_occur["heading"] == eN.bi.off)) + && ((obj_type_status["para"] == eN.bi.off) + && (obj_type_status["heading"] == eN.bi.off))) { /+ heading or para but neither flag nor line exists +/ if ((conf_make_meta.make.headings.length > 2) - && (obj_type_status["make_headings"] == State.off)) { /+ heading found +/ + && (obj_type_status["make_headings"] == eN.bi.off)) { /+ heading found +/ heading_match_str = line.flow_heading_found_(heading_match_str, conf_make_meta.make.headings, heading_match_rgx, obj_type_status); } - if ((obj_type_status["make_headings"] == State.on) - && ((line_occur["para"] == State.off) - && (line_occur["heading"] == State.off)) - && ((obj_type_status["para"] == State.off) - && (obj_type_status["heading"] == State.off))) { /+ heading make set +/ + if ((obj_type_status["make_headings"] == eN.bi.on) + && ((line_occur["para"] == eN.bi.off) + && (line_occur["heading"] == eN.bi.off)) + && ((obj_type_status["para"] == eN.bi.off) + && (obj_type_status["heading"] == eN.bi.off))) { /+ heading make set +/ line = line.flow_heading_make_set_(line_occur, heading_match_rgx, obj_type_status); } /+ TODO node info: all headings identified at this point, @@ -913,22 +933,22 @@ template docAbstraction() { collapsed_lev, obj_type_status, conf_make_meta, - track, + track_state, ); - } else if (line_occur["para"] == State.off) { /+ para match +/ + } else if (line_occur["para"] == eN.bi.off) { /+ para match +/ an_object_key="body_nugget"; line = line ._doc_header_and_make_substitutions_(conf_make_meta) ._doc_header_and_make_substitutions_fontface_(conf_make_meta); an_object = line.flow_para_match_(an_object, an_object_key, indent, bullet, obj_type_status, line_occur); } - } else if (line_occur["heading"] > State.off) { /+ heading +/ + } else if (line_occur["heading"] > eN.bi.off) { /+ heading +/ debug(heading) { writeln(line); } an_object[an_object_key] ~= line ~= "\n"; ++line_occur["heading"]; - } else if (line_occur["para"] > State.off) { /+ paragraph +/ + } else if (line_occur["para"] > eN.bi.off) { /+ paragraph +/ debug(para) { writeln(an_object_key, "-> ", line); } @@ -939,7 +959,7 @@ template docAbstraction() { ++line_occur["para"]; } } - } else if (obj_type_status["blocks"] == TriState.closing) { /+ line empty, with blocks flag +/ + } else if (obj_type_status["blocks"] == eN.tri.closing) { /+ line empty, with blocks flag +/ an_object = line.flow_block_flag_line_empty_( an_object, bookindex_extract_hash, @@ -960,7 +980,7 @@ template docAbstraction() { ~ line ~ "\"" ); assert( - (obj_type_status["blocks"] == State.off), + (obj_type_status["blocks"] == eN.bi.off), "code block status: none" ); if (_new_doc) { @@ -968,8 +988,8 @@ template docAbstraction() { lv0_to_3_tags = lv0_to_3_tags.init; tag_in_seg = tag_in_seg.init; } - if ((obj_type_status["heading"] == State.on) - && (line_occur["heading"] > State.off)) { /+ heading object (current line empty) +/ + if ((obj_type_status["heading"] == eN.bi.on) + && (line_occur["heading"] > eN.bi.off)) { /+ heading object (current line empty) +/ obj_cite_digits = (an_object["lev_markup_number"].to!int == 0) ? ocn_emit(OCNstatus.reset) : ocn_emit(obj_type_status["ocn_status"]); @@ -1090,8 +1110,8 @@ template docAbstraction() { an_object.remove("lev_markup_number"); processing.remove("verse"); ++cntr; - } else if ((obj_type_status["para"] == State.on) - && (line_occur["para"] > State.off)) { + } else if ((obj_type_status["para"] == eN.bi.on) + && (line_occur["para"] > eN.bi.off)) { /+ paragraph object (current line empty) +/ /+ repeated character paragraph separator +/ if ((an_object[an_object_key].to!string).matchFirst(rgx.repeated_character_line_separator)) { @@ -1166,7 +1186,7 @@ template docAbstraction() { && (the_document_body_section.length > previous_length)) { if ((the_document_body_section[$-1].metainfo.is_a == "heading") && (the_document_body_section[$-1].metainfo.heading_lev_markup < 5)) { - track["section"] = status.sect.unset; + track_state["section"] = eN.sect.unset; } if (the_document_body_section[$-1].metainfo.is_a == "verse") { /+ scan for endnotes for whole poem (each verse in poem) +/ foreach (i; previous_length .. the_document_body_section.length) { @@ -2439,10 +2459,10 @@ template docAbstraction() { return ref string[string] an_object, return ref int[string] obj_type_status, ) { - line_occur["heading"] = State.off; - line_occur["para"] = State.off; - obj_type_status["heading"] = State.off; - obj_type_status["para"] = State.off; + line_occur["heading"] = eN.bi.off; + line_occur["para"] = eN.bi.off; + obj_type_status["heading"] = eN.bi.off; + obj_type_status["para"] = eN.bi.off; an_object = an_object.object_reset; } @safe static int[string] _check_ocn_status_()( @@ -2464,7 +2484,7 @@ template docAbstraction() { } if (line.matchFirst(rgx.object_number_off_block_dummy_heading)) { obj_type_status["ocn_status_off_for_multiple_objects"] = OCN_off_block_status.on; - obj_type_status["heading_off_for_multiple_objects"] = Status.on; + obj_type_status["heading_off_for_multiple_objects"] = eN.bi.on; obj_type_status["ocn_status"] = OCNstatus.off; debug(ocnoff) { writeln(line); @@ -2472,18 +2492,18 @@ template docAbstraction() { } } else { if (obj_type_status["ocn_status_off_for_multiple_objects"] == OCN_off_block_status.off) { - obj_type_status["dummy_heading_status"] = Status.off; + obj_type_status["dummy_heading_status"] = eN.bi.off; if (obj_type_status["heading_off_for_multiple_objects"]) { - obj_type_status["dummy_heading_status"] = Status.on; + obj_type_status["dummy_heading_status"] = eN.bi.on; } if (line.matchFirst(rgx.object_number_off)) { obj_type_status["ocn_status"] = OCNstatus.off; } else if (line.matchFirst(rgx.object_number_off_dummy_heading)) { obj_type_status["ocn_status"] = OCNstatus.off; - obj_type_status["dummy_heading_status"] = Status.on; + obj_type_status["dummy_heading_status"] = eN.bi.on; } else { obj_type_status["ocn_status"] = OCNstatus.on; - obj_type_status["dummy_heading_status"] = Status.off; + obj_type_status["dummy_heading_status"] = eN.bi.off; } } else { obj_type_status["ocn_status"] = obj_type_status["ocn_status_off_for_multiple_objects"]; @@ -2496,7 +2516,7 @@ template docAbstraction() { if (line.matchFirst(rgx.object_number_off_block_close)) { obj_type_status["ocn_status_off_for_multiple_objects"] = OCN_off_block_status.off; obj_type_status["ocn_status"] = OCNstatus.on; - obj_type_status["dummy_heading_status"] = Status.off; + obj_type_status["dummy_heading_status"] = eN.bi.off; debug(ocnoff) { writeln(line); } @@ -2562,9 +2582,9 @@ template docAbstraction() { line ); } - obj_type_status["blocks"] = TriState.on; - obj_type_status["code"] = TriState.on; - obj_type_status["curly_code"] = TriState.on; + obj_type_status["blocks"] = eN.tri.on; + obj_type_status["code"] = eN.tri.on; + obj_type_status["curly_code"] = eN.tri.on; } else if (auto m = line.matchFirst(rgx.block_curly_poem_open)) { dochas["poem"]++; an_object["syntax"] = ""; @@ -2577,10 +2597,10 @@ template docAbstraction() { ); } object_number_poem["start"] = obj_cite_digits.object_number.to!string; - 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; + obj_type_status["blocks"] = eN.tri.on; + obj_type_status["verse_new"] = eN.bi.on; + obj_type_status["poem"] = eN.tri.on; + obj_type_status["curly_poem"] = eN.tri.on; } else if (auto m = line.matchFirst(rgx.block_curly_group_open)) { dochas["group"]++; an_object["syntax"] = ""; @@ -2592,9 +2612,9 @@ template docAbstraction() { line ); } - obj_type_status["blocks"] = TriState.on; - obj_type_status["group"] = TriState.on; - obj_type_status["curly_group"] = TriState.on; + obj_type_status["blocks"] = eN.tri.on; + obj_type_status["group"] = eN.tri.on; + obj_type_status["curly_group"] = eN.tri.on; } else if (auto m = line.matchFirst(rgx.block_curly_block_open)) { dochas["block"]++; an_object["syntax"] = ""; @@ -2606,9 +2626,9 @@ template docAbstraction() { line ); } - obj_type_status["blocks"] = TriState.on; - obj_type_status["block"] = TriState.on; - obj_type_status["curly_block"] = TriState.on; + obj_type_status["blocks"] = eN.tri.on; + obj_type_status["block"] = eN.tri.on; + obj_type_status["curly_block"] = eN.tri.on; } else if (auto m = line.matchFirst(rgx.block_curly_quote_open)) { dochas["quote"]++; an_object["syntax"] = ""; @@ -2620,9 +2640,9 @@ template docAbstraction() { line ); } - obj_type_status["blocks"] = TriState.on; - obj_type_status["quote"] = TriState.on; - obj_type_status["curly_quote"] = TriState.on; + obj_type_status["blocks"] = eN.tri.on; + obj_type_status["quote"] = eN.tri.on; + obj_type_status["curly_quote"] = eN.tri.on; } else if (auto m = line.matchFirst(rgx.block_curly_table_open)) { /+ curly table open +/ debug(table) { // table (curly) open writefln( @@ -2633,16 +2653,16 @@ template docAbstraction() { dochas["table"] ++; an_object["table_head"] = m["attrib"].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; + obj_type_status["blocks"] = eN.tri.on; + obj_type_status["table"] = eN.tri.on; + obj_type_status["curly_table"] = eN.tri.on; } else if (auto m = line.matchFirst(rgx.block_curly_table_special_markup)) { /+ table: special table block markup syntax! +/ dochas["table"]++; an_object["table_head"] = m["attrib"].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; + obj_type_status["blocks"] = eN.tri.on; + obj_type_status["table"] = eN.tri.on; + obj_type_status["curly_table_special_markup"] = eN.tri.on; } else if (auto m = line.matchFirst(rgx.block_tic_code_open)) { dochas["codeblock"]++; an_object["lang"] = ""; @@ -2654,9 +2674,9 @@ template docAbstraction() { line ); } - obj_type_status["blocks"] = TriState.on; - obj_type_status["code"] = TriState.on; - obj_type_status["tic_code"] = TriState.on; + obj_type_status["blocks"] = eN.tri.on; + obj_type_status["code"] = eN.tri.on; + obj_type_status["tic_code"] = eN.tri.on; } else if (auto m = line.matchFirst(rgx.block_tic_poem_open)) { dochas["poem"]++; an_object["syntax"] = ""; @@ -2669,10 +2689,10 @@ template docAbstraction() { ); } object_number_poem["start"] = obj_cite_digits.object_number.to!string; - 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; + obj_type_status["blocks"] = eN.tri.on; + obj_type_status["verse_new"] = eN.bi.on; + obj_type_status["poem"] = eN.tri.on; + obj_type_status["tic_poem"] = eN.tri.on; } else if (auto m = line.matchFirst(rgx.block_tic_group_open)) { dochas["group"]++; an_object["syntax"] = ""; @@ -2684,9 +2704,9 @@ template docAbstraction() { line ); } - obj_type_status["blocks"] = TriState.on; - obj_type_status["group"] = TriState.on; - obj_type_status["tic_group"] = TriState.on; + obj_type_status["blocks"] = eN.tri.on; + obj_type_status["group"] = eN.tri.on; + obj_type_status["tic_group"] = eN.tri.on; } else if (auto m = line.matchFirst(rgx.block_tic_block_open)) { dochas["block"]++; an_object["syntax"] = ""; @@ -2698,9 +2718,9 @@ template docAbstraction() { line ); } - obj_type_status["blocks"] = TriState.on; - obj_type_status["block"] = TriState.on; - obj_type_status["tic_block"] = TriState.on; + obj_type_status["blocks"] = eN.tri.on; + obj_type_status["block"] = eN.tri.on; + obj_type_status["tic_block"] = eN.tri.on; } else if (auto m = line.matchFirst(rgx.block_tic_quote_open)) { dochas["quote"]++; an_object["syntax"] = ""; @@ -2712,9 +2732,9 @@ template docAbstraction() { line ); } - obj_type_status["blocks"] = TriState.on; - obj_type_status["quote"] = TriState.on; - obj_type_status["tic_quote"] = TriState.on; + obj_type_status["blocks"] = eN.tri.on; + obj_type_status["quote"] = eN.tri.on; + obj_type_status["tic_quote"] = eN.tri.on; } else if (auto m = line.matchFirst(rgx.block_tic_table_open)) { /+ tic table open +/ debug(table) { // table (tic) open writefln( @@ -2725,9 +2745,9 @@ template docAbstraction() { dochas["table"] ++; an_object["table_head"] = m["attrib"].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; + obj_type_status["blocks"] = eN.tri.on; + obj_type_status["table"] = eN.tri.on; + obj_type_status["tic_table"] = eN.tri.on; } } @safe string[string] flow_txt_block_quote()( @@ -2736,30 +2756,30 @@ template docAbstraction() { return ref int[string] obj_type_status ) { static auto rgx = RgxI(); - if (obj_type_status["curly_quote"] == TriState.on) { + if (obj_type_status["curly_quote"] == eN.tri.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; - obj_type_status["blocks"] = TriState.closing; - obj_type_status["quote"] = TriState.closing; - obj_type_status["curly_quote"] = TriState.off; + obj_type_status["blocks"] = eN.tri.closing; + obj_type_status["quote"] = eN.tri.closing; + obj_type_status["curly_quote"] = eN.tri.off; } else { debug(quote) { writeln(line); } an_object[an_object_key] ~= line ~= "\n"; // build quote array (or string) } - } else if (obj_type_status["tic_quote"] == TriState.on) { + } else if (obj_type_status["tic_quote"] == eN.tri.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; - obj_type_status["blocks"] = TriState.closing; - obj_type_status["quote"] = TriState.closing; - obj_type_status["tic_quote"] = TriState.off; + obj_type_status["blocks"] = eN.tri.closing; + obj_type_status["quote"] = eN.tri.closing; + obj_type_status["tic_quote"] = eN.tri.off; } else { debug(quote) { writeln(line); @@ -2775,30 +2795,30 @@ template docAbstraction() { return ref int[string] obj_type_status ) { static auto rgx = RgxI(); - if (obj_type_status["curly_group"] == State.on) { + if (obj_type_status["curly_group"] == eN.bi.on) { if (line.matchFirst(rgx.block_curly_group_close)) { debug(group) { writeln(line); } an_object[an_object_key] = an_object[an_object_key].stripRight; - obj_type_status["blocks"] = TriState.closing; - obj_type_status["group"] = TriState.closing; - obj_type_status["curly_group"] = TriState.off; + obj_type_status["blocks"] = eN.tri.closing; + obj_type_status["group"] = eN.tri.closing; + obj_type_status["curly_group"] = eN.tri.off; } else { debug(group) { writeln(line); } an_object[an_object_key] ~= line ~= "\n"; // build group array (or string) } - } else if (obj_type_status["tic_group"] == TriState.on) { + } else if (obj_type_status["tic_group"] == eN.tri.on) { if (line.matchFirst(rgx.block_tic_close)) { debug(group) { writeln(line); } an_object[an_object_key] = an_object[an_object_key].stripRight; - obj_type_status["blocks"] = TriState.closing; - obj_type_status["group"] = TriState.closing; - obj_type_status["tic_group"] = TriState.off; + obj_type_status["blocks"] = eN.tri.closing; + obj_type_status["group"] = eN.tri.closing; + obj_type_status["tic_group"] = eN.tri.off; } else { debug(group) { writeln(line); @@ -2814,30 +2834,30 @@ template docAbstraction() { return ref int[string] obj_type_status ) { static auto rgx = RgxI(); - if (obj_type_status["curly_block"] == TriState.on) { + if (obj_type_status["curly_block"] == eN.tri.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; - obj_type_status["blocks"] = TriState.closing; - obj_type_status["block"] = TriState.closing; - obj_type_status["curly_block"] = TriState.off; + obj_type_status["blocks"] = eN.tri.closing; + obj_type_status["block"] = eN.tri.closing; + obj_type_status["curly_block"] = eN.tri.off; } else { debug(block) { writeln(line); } an_object[an_object_key] ~= line ~= "\n"; // build block array (or string) } - } else if (obj_type_status["tic_block"] == TriState.on) { + } else if (obj_type_status["tic_block"] == eN.tri.on) { if (line.matchFirst(rgx.block_tic_close)) { debug(block) { writeln(line); } an_object[an_object_key] = an_object[an_object_key].stripRight; - obj_type_status["blocks"] = TriState.closing; - obj_type_status["block"] = TriState.closing; - obj_type_status["tic_block"] = TriState.off; + obj_type_status["blocks"] = eN.tri.closing; + obj_type_status["block"] = eN.tri.closing; + obj_type_status["tic_block"] = eN.tri.off; } else { debug(block) { writeln(line); @@ -2857,7 +2877,7 @@ template docAbstraction() { string[string] tag_in_seg, ) { static auto rgx = RgxI(); - if (obj_type_status["curly_poem"] == TriState.on) { + if (obj_type_status["curly_poem"] == eN.tri.on) { if (line.matchFirst(rgx.block_curly_poem_close)) { if (an_object_key in an_object || processing.length > 0) { @@ -2915,20 +2935,20 @@ template docAbstraction() { ++cntr; } object_number_poem["end"] = obj_cite_digits.object_number.to!string; - obj_type_status["blocks"] = TriState.closing; - obj_type_status["poem"] = TriState.closing; - obj_type_status["curly_poem"] = TriState.off; + obj_type_status["blocks"] = eN.tri.closing; + obj_type_status["poem"] = eN.tri.closing; + obj_type_status["curly_poem"] = eN.tri.off; } else { processing["verse"] ~= line ~= "\n"; - if (obj_type_status["verse_new"] == State.on) { + if (obj_type_status["verse_new"] == eN.bi.on) { obj_cite_digits = ocn_emit(obj_type_status["ocn_status"]); - obj_type_status["verse_new"] = State.off; + obj_type_status["verse_new"] = eN.bi.off; } else if (line.matchFirst(rgx.newline_eol_delimiter_only)) { processing["verse"] = processing["verse"].stripRight; - verse_line = TriState.off; - obj_type_status["verse_new"] = State.on; + verse_line = eN.tri.off; + obj_type_status["verse_new"] = eN.bi.on; } - if (obj_type_status["verse_new"] == State.on) { + if (obj_type_status["verse_new"] == eN.bi.on) { verse_line=1; an_object[an_object_key] = processing["verse"]; debug(poem) { // poem verse @@ -2977,7 +2997,7 @@ template docAbstraction() { ++cntr; } } - } else if (obj_type_status["tic_poem"] == TriState.on) { + } else if (obj_type_status["tic_poem"] == eN.tri.on) { if (auto m = line.matchFirst(rgx.block_tic_close)) { // tic_poem_close an_object[an_object_key]="verse"; debug(poem) { @@ -3023,20 +3043,20 @@ template docAbstraction() { processing.remove("verse"); ++cntr; } - obj_type_status["blocks"] = TriState.closing; - obj_type_status["poem"] = TriState.closing; - obj_type_status["tic_poem"] = TriState.off; + obj_type_status["blocks"] = eN.tri.closing; + obj_type_status["poem"] = eN.tri.closing; + obj_type_status["tic_poem"] = eN.tri.off; } else { processing["verse"] ~= line ~= "\n"; - if (obj_type_status["verse_new"] == State.on) { + if (obj_type_status["verse_new"] == eN.bi.on) { obj_cite_digits = ocn_emit(obj_type_status["ocn_status"]); - obj_type_status["verse_new"] = State.off; + obj_type_status["verse_new"] = eN.bi.off; } else if (line.matchFirst(rgx.newline_eol_delimiter_only)) { processing["verse"] = processing["verse"].stripRight; - obj_type_status["verse_new"] = State.on; - verse_line = TriState.off; + obj_type_status["verse_new"] = eN.bi.on; + verse_line = eN.tri.off; } - if (obj_type_status["verse_new"] == State.on) { + if (obj_type_status["verse_new"] == eN.bi.on) { verse_line=1; an_object[an_object_key] = processing["verse"]; debug(poem) { // poem (tic) close @@ -3095,7 +3115,7 @@ template docAbstraction() { return ref int[string] obj_type_status ) { static auto rgx = RgxI(); - if (obj_type_status["curly_code"] == TriState.on) { + if (obj_type_status["curly_code"] == eN.tri.on) { if (line.matchFirst(rgx.block_curly_code_close)) { debug(codecurly) { // code (curly) close writeln(line); @@ -3103,16 +3123,16 @@ template docAbstraction() { an_object[an_object_key] = an_object[an_object_key] .replaceFirst(rgx.newline_eol_delimiter_only, "") .stripRight; - obj_type_status["blocks"] = TriState.closing; - obj_type_status["code"] = TriState.closing; - obj_type_status["curly_code"] = TriState.off; + obj_type_status["blocks"] = eN.tri.closing; + obj_type_status["code"] = eN.tri.closing; + obj_type_status["curly_code"] = eN.tri.off; } else { debug(codecurly) { // code (curly) line writeln(line); } an_object[an_object_key] ~= line ~= "\n"; // code (curly) line } - } else if (obj_type_status["tic_code"] == TriState.on) { + } else if (obj_type_status["tic_code"] == eN.tri.on) { if (line.matchFirst(rgx.block_tic_close)) { debug(codetic) { // code (tic) close writeln(line); @@ -3120,9 +3140,9 @@ template docAbstraction() { an_object[an_object_key] = an_object[an_object_key] .replaceFirst(rgx.newline_eol_delimiter_only, "") .stripRight; - obj_type_status["blocks"] = TriState.closing; - obj_type_status["code"] = TriState.closing; - obj_type_status["tic_code"] = TriState.off; + obj_type_status["blocks"] = eN.tri.closing; + obj_type_status["code"] = eN.tri.closing; + obj_type_status["tic_code"] = eN.tri.off; } else { debug(codetic) { // code (tic) line writeln(line); @@ -3138,25 +3158,25 @@ template docAbstraction() { return ref CMM conf_make_meta, ) { static auto rgx = RgxI(); - if (obj_type_status["curly_table"] == TriState.on) { + if (obj_type_status["curly_table"] == eN.tri.on) { if (line.matchFirst(rgx.block_curly_table_close)) { debug(table) { // table (curly) close writeln(line); } - obj_type_status["blocks"] = TriState.closing; - obj_type_status["table"] = TriState.closing; - obj_type_status["curly_table"] = TriState.off; + obj_type_status["blocks"] = eN.tri.closing; + obj_type_status["table"] = eN.tri.closing; + obj_type_status["curly_table"] = eN.tri.off; } else { debug(table) { // table writeln(line); } an_object[an_object_key] ~= line ~= "\n"; // build table array (or string) } - } else if (obj_type_status["curly_table_special_markup"] == TriState.on) { + } else if (obj_type_status["curly_table_special_markup"] == eN.tri.on) { if (line.empty) { - obj_type_status["blocks"] = TriState.off; - obj_type_status["table"] = TriState.off; - obj_type_status["curly_table_special_markup"] = TriState.off; + obj_type_status["blocks"] = eN.tri.off; + obj_type_status["table"] = eN.tri.off; + obj_type_status["curly_table_special_markup"] = eN.tri.off; line.flow_table_closed_make_special_notation_table_( an_object, the_document_body_section, @@ -3172,14 +3192,14 @@ template docAbstraction() { } an_object[an_object_key] ~= line ~= "\n"; } - } else if (obj_type_status["tic_table"] == TriState.on) { + } else if (obj_type_status["tic_table"] == eN.tri.on) { if (line.matchFirst(rgx.block_tic_close)) { debug(table) { // table (tic) close writeln(line); } - obj_type_status["blocks"] = TriState.closing; - obj_type_status["table"] = TriState.closing; - obj_type_status["tic_table"] = TriState.off; + obj_type_status["blocks"] = eN.tri.closing; + obj_type_status["table"] = eN.tri.closing; + obj_type_status["tic_table"] = eN.tri.off; } else { debug(table) { // table writeln(line); @@ -3214,14 +3234,13 @@ template docAbstraction() { return ref int bib_entry, return ref string biblio_entry_str_json, return ref string[] biblio_arr_json, - return ref int[string] track, + return ref int[string] track_state, ) { mixin spineBiblio; - mixin spineDocStatus; auto jsn = BibJsnStr(); static auto rgx = RgxI(); if (line.matchFirst(rgx.heading_biblio)) { - track["section"] = status.sect.bibliography; + track_state["section"] = eN.sect.bibliography; } if (line.empty) { debug { @@ -3232,12 +3251,12 @@ template docAbstraction() { writeln(biblio_entry_str_json.length); } } - if ((bib_entry == State.off) + if ((bib_entry == eN.bi.off) && (biblio_entry_str_json.empty)) { - bib_entry = State.on; + bib_entry = eN.bi.on; biblio_entry_str_json = jsn.biblio_entry_tags_jsonstr; } else if (!(biblio_entry_str_json.empty)) { - bib_entry = State.off; + bib_entry = eN.bi.off; if (!(biblio_entry_str_json == jsn.biblio_entry_tags_jsonstr)) { auto biblio_entry = parseJSON(biblio_entry_str_json); if (biblio_entry["fulltitle"].str.empty) { @@ -3258,7 +3277,7 @@ template docAbstraction() { writeln(line); } auto bt = line.match(rgx.biblio_tags); - bib_entry = State.off; + bib_entry = eN.bi.off; st = bt.captures[1].to!string; auto header_tag_value=(bt.captures[2]).to!string; JSONValue j = parseJSON(biblio_entry_str_json); @@ -3391,12 +3410,12 @@ template docAbstraction() { ~ line ~ "\"" ); assert( - (obj_type_status["blocks"] == TriState.closing), + (obj_type_status["blocks"] == eN.tri.closing), "code block status: closed" ); assertions_flag_types_block_status_none_or_closed(obj_type_status); static auto rgx = RgxI(); - if (obj_type_status["quote"] == TriState.closing) { + if (obj_type_status["quote"] == eN.tri.closing) { obj_cite_digits = ocn_emit(obj_type_status["ocn_status"]); an_object["bookindex_nugget"] = ("bookindex_nugget" in an_object) ? an_object["bookindex_nugget"] : ""; @@ -3442,12 +3461,12 @@ template docAbstraction() { comp_obj_block.has.inline_links = substantive_obj_misc_tuple[sObj.links]; the_document_body_section ~= comp_obj_block; tag_assoc = an_object.inline_para_link_anchor(tag_in_seg, tag_assoc); - obj_type_status["blocks"] = TriState.off; - obj_type_status["quote"] = TriState.off; + obj_type_status["blocks"] = eN.tri.off; + obj_type_status["quote"] = eN.tri.off; object_reset(an_object); processing.remove("verse"); ++cntr; - } else if (obj_type_status["group"] == TriState.closing) { + } else if (obj_type_status["group"] == eN.tri.closing) { obj_cite_digits = ocn_emit(obj_type_status["ocn_status"]); an_object["bookindex_nugget"] = ("bookindex_nugget" in an_object) ? an_object["bookindex_nugget"] : ""; @@ -3493,12 +3512,12 @@ template docAbstraction() { comp_obj_block.has.inline_links = substantive_obj_misc_tuple[sObj.links]; the_document_body_section ~= comp_obj_block; tag_assoc = an_object.inline_para_link_anchor(tag_in_seg, tag_assoc); - obj_type_status["blocks"] = TriState.off; - obj_type_status["group"] = TriState.off; + obj_type_status["blocks"] = eN.tri.off; + obj_type_status["group"] = eN.tri.off; object_reset(an_object); processing.remove("verse"); ++cntr; - } else if (obj_type_status["block"] == TriState.closing) { + } else if (obj_type_status["block"] == eN.tri.closing) { obj_cite_digits = ocn_emit(obj_type_status["ocn_status"]); an_object["bookindex_nugget"] = ("bookindex_nugget" in an_object) ? an_object["bookindex_nugget"] : ""; @@ -3543,12 +3562,12 @@ template docAbstraction() { comp_obj_block.has.inline_notes_star = substantive_obj_misc_tuple[sObj.notes_star]; comp_obj_block.has.inline_links = substantive_obj_misc_tuple[sObj.links]; the_document_body_section ~= comp_obj_block; - obj_type_status["blocks"] = TriState.off; - obj_type_status["block"] = TriState.off; + obj_type_status["blocks"] = eN.tri.off; + obj_type_status["block"] = eN.tri.off; object_reset(an_object); processing.remove("verse"); ++cntr; - } else if (obj_type_status["poem"] == TriState.closing) { + } else if (obj_type_status["poem"] == eN.tri.closing) { an_object["bookindex_nugget"] = ("bookindex_nugget" in an_object) ? an_object["bookindex_nugget"] : ""; bookindex_unordered_hashes @@ -3581,11 +3600,11 @@ template docAbstraction() { comp_obj_poem_ocn.metainfo.object_number_type = obj_cite_digits.type; comp_obj_poem_ocn.text = ""; the_document_body_section ~= comp_obj_poem_ocn; - obj_type_status["blocks"] = TriState.off; - obj_type_status["poem"] = TriState.off; + obj_type_status["blocks"] = eN.tri.off; + obj_type_status["poem"] = eN.tri.off; object_reset(an_object); processing.remove("verse"); - } else if (obj_type_status["code"] == TriState.closing) { + } else if (obj_type_status["code"] == eN.tri.closing) { obj_cite_digits = ocn_emit(obj_type_status["ocn_status"]); an_object["bookindex_nugget"] = ("bookindex_nugget" in an_object) ? an_object["bookindex_nugget"] : ""; @@ -3631,12 +3650,12 @@ template docAbstraction() { comp_obj_code.has.inline_notes_star = substantive_obj_misc_tuple[sObj.notes_star]; comp_obj_code.has.inline_links = substantive_obj_misc_tuple[sObj.links]; the_document_body_section ~= comp_obj_code; - obj_type_status["blocks"] = TriState.off; - obj_type_status["code"] = TriState.off; + obj_type_status["blocks"] = eN.tri.off; + obj_type_status["code"] = eN.tri.off; object_reset(an_object); processing.remove("verse"); ++cntr; - } else if (obj_type_status["table"] == TriState.closing) { + } else if (obj_type_status["table"] == eN.tri.closing) { comp_obj_block = comp_obj_block.init; obj_cite_digits = ocn_emit(obj_type_status["ocn_status"]); an_object["bookindex_nugget"] @@ -3673,8 +3692,8 @@ template docAbstraction() { comp_obj_block = comp_obj_block.flow_table_instructions(an_object["table_head"]); comp_obj_block = comp_obj_block.flow_table_substantive_munge(an_object["substantive"]); the_document_body_section ~= comp_obj_block; - obj_type_status["blocks"] = TriState.off; - obj_type_status["table"] = TriState.off; + obj_type_status["blocks"] = eN.tri.off; + obj_type_status["table"] = eN.tri.off; object_reset(an_object); processing.remove("verse"); ++cntr; @@ -3686,10 +3705,9 @@ template docAbstraction() { string[string] an_object, return ref string book_idx_tmp, return ref int[string] obj_type_status, - return ref int[string] track, + return ref int[string] track_state, B opt_action, ) { - mixin spineDocStatus; static auto rgx = RgxI(); if (auto m = line.match(rgx.book_index_item)) { /+ match book_index +/ debug(bookindexmatch) { @@ -3700,7 +3718,7 @@ template docAbstraction() { } an_object["bookindex_nugget"] = m.captures[1].to!string; } else if (auto m = line.match(rgx.book_index_item_open)) { /+ match open book_index +/ - track["section"] = status.sect.book_index; + track_state["section"] = eN.sect.book_index; if (opt_action.backmatter && opt_action.section_bookindex) { book_idx_tmp = m.captures[1].to!string; debug(bookindexmatch) { @@ -3710,9 +3728,9 @@ template docAbstraction() { ); } } - } else if (track["section"] == status.sect.book_index) { /+ book_index flag set +/ + } else if (track_state["section"] == eN.sect.book_index) { /+ book_index flag set +/ if (auto m = line.match(rgx.book_index_item_close)) { - track["section"] = status.sect.unset; + track_state["section"] = eN.sect.unset; if (opt_action.backmatter && opt_action.section_bookindex) { an_object["bookindex_nugget"] = book_idx_tmp ~ m.captures[1].to!string; @@ -3742,7 +3760,7 @@ template docAbstraction() { ) { static auto rgx = RgxI(); if ((_make_unmarked_headings.length > 2) - && (obj_type_status["make_headings"] == State.off)) { /+ headings found +/ + && (obj_type_status["make_headings"] == eN.bi.off)) { /+ headings found +/ debug(headingsfound) { writeln(_make_unmarked_headings); } @@ -3810,7 +3828,7 @@ template docAbstraction() { default: break; } - obj_type_status["make_headings"] = State.on; + obj_type_status["make_headings"] = eN.bi.on; } return heading_match_str; } @@ -3820,11 +3838,11 @@ template docAbstraction() { return ref Regex!(char)[string] heading_match_rgx, return ref int[string] obj_type_status ) { - if ((obj_type_status["make_headings"] == State.on) - && ((line_occur["para"] == State.off) - && (line_occur["heading"] == State.off)) - && ((obj_type_status["para"] == State.off) - && (obj_type_status["heading"] == State.off))) { /+ heading make set +/ + if ((obj_type_status["make_headings"] == eN.bi.on) + && ((line_occur["para"] == eN.bi.off) + && (line_occur["heading"] == eN.bi.off)) + && ((obj_type_status["para"] == eN.bi.off) + && (obj_type_status["heading"] == eN.bi.off))) { /+ heading make set +/ if (line.matchFirst(heading_match_rgx["h_B"])) { line = "B~ " ~ line; debug(headingsfound) { @@ -3879,16 +3897,15 @@ template docAbstraction() { return ref int[string] collapsed_lev, return ref int[string] obj_type_status, return ref CMM conf_make_meta, - return ref int[string] track, + return ref int[string] track_state, ) { - mixin spineDocStatus; static auto rgx = RgxI(); if (auto m = line.match(rgx.headings)) { /+ heading match +/ ++line_occur["heading"]; - obj_type_status["heading"] = State.on; - obj_type_status["para"] = State.off; + obj_type_status["heading"] = eN.bi.on; + obj_type_status["para"] = eN.bi.off; if (line.match(rgx.heading_seg_and_above)) { - track["section"] = status.sect.unset; + track_state["section"] = eN.sect.unset; } an_object[an_object_key] ~= line ~= "\n"; an_object["lev"] ~= m.captures[1]; @@ -3912,13 +3929,13 @@ template docAbstraction() { = collapsed_lev["h0"].to!string; lv["lv"] = DocStructMarkupHeading.h_sect_A; ++lv["h0"]; - lv["h1"] = State.off; - lv["h2"] = State.off; - lv["h3"] = State.off; - lv["h4"] = State.off; - lv["h5"] = State.off; - lv["h6"] = State.off; - lv["h7"] = State.off; + lv["h1"] = eN.bi.off; + lv["h2"] = eN.bi.off; + lv["h3"] = eN.bi.off; + lv["h4"] = eN.bi.off; + lv["h5"] = eN.bi.off; + lv["h6"] = eN.bi.off; + lv["h7"] = eN.bi.off; goto default; case "B": collapsed_lev["h1"] = collapsed_lev["h0"] + 1; @@ -3926,12 +3943,12 @@ template docAbstraction() { = collapsed_lev["h1"].to!string; lv["lv"] = DocStructMarkupHeading.h_sect_B; ++lv["h1"]; - lv["h2"] = State.off; - lv["h3"] = State.off; - lv["h4"] = State.off; - lv["h5"] = State.off; - lv["h6"] = State.off; - lv["h7"] = State.off; + lv["h2"] = eN.bi.off; + lv["h3"] = eN.bi.off; + lv["h4"] = eN.bi.off; + lv["h5"] = eN.bi.off; + lv["h6"] = eN.bi.off; + lv["h7"] = eN.bi.off; goto default; case "C": collapsed_lev["h2"] = collapsed_lev["h1"] + 1; @@ -3939,11 +3956,11 @@ template docAbstraction() { = collapsed_lev["h2"].to!string; lv["lv"] = DocStructMarkupHeading.h_sect_C; ++lv["h2"]; - lv["h3"] = State.off; - lv["h4"] = State.off; - lv["h5"] = State.off; - lv["h6"] = State.off; - lv["h7"] = State.off; + lv["h3"] = eN.bi.off; + lv["h4"] = eN.bi.off; + lv["h5"] = eN.bi.off; + lv["h6"] = eN.bi.off; + lv["h7"] = eN.bi.off; goto default; case "D": collapsed_lev["h3"] = collapsed_lev["h2"] + 1; @@ -3951,61 +3968,61 @@ template docAbstraction() { = collapsed_lev["h3"].to!string; lv["lv"] = DocStructMarkupHeading.h_sect_D; ++lv["h3"]; - lv["h4"] = State.off; - lv["h5"] = State.off; - lv["h6"] = State.off; - lv["h7"] = State.off; + lv["h4"] = eN.bi.off; + lv["h5"] = eN.bi.off; + lv["h6"] = eN.bi.off; + lv["h7"] = eN.bi.off; goto default; case "1": - if (lv["h3"] > State.off) { + if (lv["h3"] > eN.bi.off) { collapsed_lev["h4"] = collapsed_lev["h3"] + 1; - } else if (lv["h2"] > State.off) { + } else if (lv["h2"] > eN.bi.off) { collapsed_lev["h4"] = collapsed_lev["h2"] + 1; - } else if (lv["h1"] > State.off) { + } else if (lv["h1"] > eN.bi.off) { collapsed_lev["h4"] = collapsed_lev["h1"] + 1; - } else if (lv["h0"] > State.off) { + } else if (lv["h0"] > eN.bi.off) { collapsed_lev["h4"] = collapsed_lev["h0"] + 1; } an_object["lev_collapsed_number"] = collapsed_lev["h4"].to!string; lv["lv"] = DocStructMarkupHeading.h_text_1; ++lv["h4"]; - lv["h5"] = State.off; - lv["h6"] = State.off; - lv["h7"] = State.off; + lv["h5"] = eN.bi.off; + lv["h6"] = eN.bi.off; + lv["h7"] = eN.bi.off; goto default; case "2": - if (lv["h5"] > State.off) { + if (lv["h5"] > eN.bi.off) { an_object["lev_collapsed_number"] = collapsed_lev["h5"].to!string; - } else if (lv["h4"] > State.off) { + } else if (lv["h4"] > eN.bi.off) { collapsed_lev["h5"] = collapsed_lev["h4"] + 1; an_object["lev_collapsed_number"] = collapsed_lev["h5"].to!string; } lv["lv"] = DocStructMarkupHeading.h_text_2; ++lv["h5"]; - lv["h6"] = State.off; - lv["h7"] = State.off; + lv["h6"] = eN.bi.off; + lv["h7"] = eN.bi.off; goto default; case "3": - if (lv["h6"] > State.off) { + if (lv["h6"] > eN.bi.off) { an_object["lev_collapsed_number"] = collapsed_lev["h6"].to!string; - } else if (lv["h5"] > State.off) { + } else if (lv["h5"] > eN.bi.off) { collapsed_lev["h6"] = collapsed_lev["h5"] + 1; an_object["lev_collapsed_number"] = collapsed_lev["h6"].to!string; } lv["lv"] = DocStructMarkupHeading.h_text_3; ++lv["h6"]; - lv["h7"] = State.off; + lv["h7"] = eN.bi.off; goto default; case "4": - if (lv["h7"] > State.off) { + if (lv["h7"] > eN.bi.off) { an_object["lev_collapsed_number"] = collapsed_lev["h7"].to!string; - } else if (lv["h6"] > State.off) { + } else if (lv["h6"] > eN.bi.off) { collapsed_lev["h7"] = collapsed_lev["h6"] + 1; an_object["lev_collapsed_number"] = collapsed_lev["h7"].to!string; @@ -4016,7 +4033,7 @@ template docAbstraction() { default: an_object["lev_markup_number"] = lv["lv"].to!string; } - an_object["dummy_heading_status"] = (obj_type_status["dummy_heading_status"] == State.off) ? "f" : "t"; + an_object["dummy_heading_status"] = (obj_type_status["dummy_heading_status"] == eN.bi.off) ? "f" : "t"; debug(heading) { writeln(line.strip); } @@ -4033,10 +4050,10 @@ template docAbstraction() { return ref int[string] line_occur, ) { static auto rgx = RgxI(); - if (line_occur["para"] == State.off) { + if (line_occur["para"] == eN.bi.off) { line = font_faces_line(line); /+ para matches +/ - obj_type_status["para"] = State.on; + obj_type_status["para"] = eN.bi.on; an_object[an_object_key] ~= line; indent=[ "hang_position" : 0, @@ -5748,13 +5765,13 @@ template docAbstraction() { assert(obj_cite_digits.object_number.to!int >= 0); assert(is_ != "heading"); // should not be necessary assert(obj_cite_digits.object_number.to!int >= 0); // should not be necessary - if (lv7 > State.off) { + if (lv7 > eN.bi.off) { p_["lev_markup_number"] = DocStructMarkupHeading.h_text_4; p_["object_number"] = lv7; - } else if (lv6 > State.off) { + } else if (lv6 > eN.bi.off) { p_["lev_markup_number"] = DocStructMarkupHeading.h_text_3; p_["object_number"] = lv6; - } else if (lv5 > State.off) { + } else if (lv5 > eN.bi.off) { p_["lev_markup_number"] = DocStructMarkupHeading.h_text_2; p_["object_number"] = lv5; } else { @@ -5861,15 +5878,15 @@ template docAbstraction() { lv = DocStructMarkupHeading.h_text_1; lv4 = obj_cite_digit; lv5=0; lv6=0; lv7=0; - if (lv3 > State.off) { + if (lv3 > eN.bi.off) { p_["lev_markup_number"] = DocStructMarkupHeading.h_sect_D; p_["object_number"] = lv3; - } else if (lv2 > State.off) { + } else if (lv2 > eN.bi.off) { p_["lev_markup_number"] = DocStructMarkupHeading.h_sect_C; p_["object_number"] = lv2; - } else if (lv1 > State.off) { + } else if (lv1 > eN.bi.off) { p_["lev_markup_number"] = DocStructMarkupHeading.h_sect_B; p_["object_number"] = lv1; @@ -5988,171 +6005,171 @@ template docAbstraction() { string[string] an_object, int[string] lv ) { - if (lv["h3"] > State.off) { - assert(lv["h0"] > State.off); - assert(lv["h1"] > State.off); - assert(lv["h2"] > State.off); - } else if (lv["h2"] > State.off) { - assert(lv["h0"] > State.off); - assert(lv["h1"] > State.off); - assert(lv["h3"] == State.off); - } else if (lv["h1"] > State.off) { - assert(lv["h0"] > State.off); - assert(lv["h2"] == State.off); - assert(lv["h3"] == State.off); - } else if (lv["h0"] > State.off) { - assert(lv["h1"] == State.off); - assert(lv["h2"] == State.off); - assert(lv["h3"] == State.off); + if (lv["h3"] > eN.bi.off) { + assert(lv["h0"] > eN.bi.off); + assert(lv["h1"] > eN.bi.off); + assert(lv["h2"] > eN.bi.off); + } else if (lv["h2"] > eN.bi.off) { + assert(lv["h0"] > eN.bi.off); + assert(lv["h1"] > eN.bi.off); + assert(lv["h3"] == eN.bi.off); + } else if (lv["h1"] > eN.bi.off) { + assert(lv["h0"] > eN.bi.off); + assert(lv["h2"] == eN.bi.off); + assert(lv["h3"] == eN.bi.off); + } else if (lv["h0"] > eN.bi.off) { + assert(lv["h1"] == eN.bi.off); + assert(lv["h2"] == eN.bi.off); + assert(lv["h3"] == eN.bi.off); } else { - assert(lv["h0"] == State.off); - assert(lv["h1"] == State.off); - assert(lv["h2"] == State.off); - assert(lv["h3"] == State.off); - } - if (lv["h7"] > State.off) { - assert(lv["h4"] > State.off); - assert(lv["h5"] > State.off); - assert(lv["h6"] > State.off); - } else if (lv["h6"] > State.off) { - assert(lv["h4"] > State.off); - assert(lv["h5"] > State.off); - assert(lv["h7"] == State.off); - } else if (lv["h5"] > State.off) { - assert(lv["h4"] > State.off); - assert(lv["h6"] == State.off); - assert(lv["h7"] == State.off); - } else if (lv["h4"] > State.off) { - assert(lv["h5"] == State.off); - assert(lv["h6"] == State.off); - assert(lv["h7"] == State.off); + assert(lv["h0"] == eN.bi.off); + assert(lv["h1"] == eN.bi.off); + assert(lv["h2"] == eN.bi.off); + assert(lv["h3"] == eN.bi.off); + } + if (lv["h7"] > eN.bi.off) { + assert(lv["h4"] > eN.bi.off); + assert(lv["h5"] > eN.bi.off); + assert(lv["h6"] > eN.bi.off); + } else if (lv["h6"] > eN.bi.off) { + assert(lv["h4"] > eN.bi.off); + assert(lv["h5"] > eN.bi.off); + assert(lv["h7"] == eN.bi.off); + } else if (lv["h5"] > eN.bi.off) { + assert(lv["h4"] > eN.bi.off); + assert(lv["h6"] == eN.bi.off); + assert(lv["h7"] == eN.bi.off); + } else if (lv["h4"] > eN.bi.off) { + assert(lv["h5"] == eN.bi.off); + assert(lv["h6"] == eN.bi.off); + assert(lv["h7"] == eN.bi.off); } else { - assert(lv["h4"] == State.off); - assert(lv["h5"] == State.off); - assert(lv["h6"] == State.off); - assert(lv["h7"] == State.off); + assert(lv["h4"] == eN.bi.off); + assert(lv["h5"] == eN.bi.off); + assert(lv["h6"] == eN.bi.off); + assert(lv["h7"] == eN.bi.off); } - if (lv["h0"] == State.off) { - assert(lv["h1"] == State.off); - assert(lv["h2"] == State.off); - assert(lv["h3"] == State.off); - assert(lv["h4"] == State.off); - assert(lv["h5"] == State.off); - assert(lv["h6"] == State.off); - assert(lv["h7"] == State.off); + if (lv["h0"] == eN.bi.off) { + assert(lv["h1"] == eN.bi.off); + assert(lv["h2"] == eN.bi.off); + assert(lv["h3"] == eN.bi.off); + assert(lv["h4"] == eN.bi.off); + assert(lv["h5"] == eN.bi.off); + assert(lv["h6"] == eN.bi.off); + assert(lv["h7"] == eN.bi.off); } - if (lv["h1"] == State.off) { - assert(lv["h2"] == State.off); - assert(lv["h3"] == State.off); + if (lv["h1"] == eN.bi.off) { + assert(lv["h2"] == eN.bi.off); + assert(lv["h3"] == eN.bi.off); } - if (lv["h2"] == State.off) { - assert(lv["h3"] == State.off); + if (lv["h2"] == eN.bi.off) { + assert(lv["h3"] == eN.bi.off); } - if (lv["h3"] == State.off) { + if (lv["h3"] == eN.bi.off) { } - if (lv["h4"] == State.off) { - assert(lv["h5"] == State.off); - assert(lv["h6"] == State.off); - assert(lv["h7"] == State.off); + if (lv["h4"] == eN.bi.off) { + assert(lv["h5"] == eN.bi.off); + assert(lv["h6"] == eN.bi.off); + assert(lv["h7"] == eN.bi.off); } - if (lv["h5"] == State.off) { - assert(lv["h6"] == State.off); - assert(lv["h7"] == State.off); + if (lv["h5"] == eN.bi.off) { + assert(lv["h6"] == eN.bi.off); + assert(lv["h7"] == eN.bi.off); } - if (lv["h6"] == State.off) { - assert(lv["h7"] == State.off); + if (lv["h6"] == eN.bi.off) { + assert(lv["h7"] == eN.bi.off); } - if (lv["h7"] == State.off) { + if (lv["h7"] == eN.bi.off) { } switch ((an_object["lev"]).to!string) { case "A": - if (lv["h0"] == State.off) { - assert(lv["h1"] == State.off); - assert(lv["h2"] == State.off); - assert(lv["h3"] == State.off); - assert(lv["h4"] == State.off); - assert(lv["h5"] == State.off); - assert(lv["h6"] == State.off); - assert(lv["h7"] == State.off); - } else { // (lv["h0"] > State.off) - assert(lv["h0"] == State.off,"error should not enter level A a second time"); + if (lv["h0"] == eN.bi.off) { + assert(lv["h1"] == eN.bi.off); + assert(lv["h2"] == eN.bi.off); + assert(lv["h3"] == eN.bi.off); + assert(lv["h4"] == eN.bi.off); + assert(lv["h5"] == eN.bi.off); + assert(lv["h6"] == eN.bi.off); + assert(lv["h7"] == eN.bi.off); + } else { // (lv["h0"] > eN.bi.off) + assert(lv["h0"] == eN.bi.off,"error should not enter level A a second time"); } break; case "B": - if (lv["h1"] == State.off) { - assert(lv["h0"] > State.off); - assert(lv["h2"] == State.off); - assert(lv["h3"] == State.off); - } else { // (lv["h1"] > State.off) - assert(lv["h0"] > State.off); - assert(lv["h1"] > State.off); + if (lv["h1"] == eN.bi.off) { + assert(lv["h0"] > eN.bi.off); + assert(lv["h2"] == eN.bi.off); + assert(lv["h3"] == eN.bi.off); + } else { // (lv["h1"] > eN.bi.off) + assert(lv["h0"] > eN.bi.off); + assert(lv["h1"] > eN.bi.off); } break; case "C": - if (lv["h2"] == State.off) { - assert(lv["h0"] > State.off); - assert(lv["h1"] > State.off); - assert(lv["h3"] == State.off); - } else { // (lv["h2"] > State.off) - assert(lv["h0"] > State.off); - assert(lv["h1"] > State.off); - assert(lv["h2"] > State.off); + if (lv["h2"] == eN.bi.off) { + assert(lv["h0"] > eN.bi.off); + assert(lv["h1"] > eN.bi.off); + assert(lv["h3"] == eN.bi.off); + } else { // (lv["h2"] > eN.bi.off) + assert(lv["h0"] > eN.bi.off); + assert(lv["h1"] > eN.bi.off); + assert(lv["h2"] > eN.bi.off); } break; case "D": - if (lv["h3"] == State.off) { - assert(lv["h0"] > State.off); - assert(lv["h1"] > State.off); - assert(lv["h2"] > State.off); - } else { // (lv["h3"] > State.off) - assert(lv["h0"] > State.off); - assert(lv["h1"] > State.off); - assert(lv["h2"] > State.off); - assert(lv["h3"] > State.off); + if (lv["h3"] == eN.bi.off) { + assert(lv["h0"] > eN.bi.off); + assert(lv["h1"] > eN.bi.off); + assert(lv["h2"] > eN.bi.off); + } else { // (lv["h3"] > eN.bi.off) + assert(lv["h0"] > eN.bi.off); + assert(lv["h1"] > eN.bi.off); + assert(lv["h2"] > eN.bi.off); + assert(lv["h3"] > eN.bi.off); } break; case "1": - if (lv["h4"] == State.off) { - assert(lv["h0"] > State.off); - } else { // (lv["h4"] > State.off) - assert(lv["h0"] > State.off); - assert(lv["h4"] > State.off); + if (lv["h4"] == eN.bi.off) { + assert(lv["h0"] > eN.bi.off); + } else { // (lv["h4"] > eN.bi.off) + assert(lv["h0"] > eN.bi.off); + assert(lv["h4"] > eN.bi.off); } break; case "2": - if (lv["h5"] == State.off) { - assert(lv["h0"] > State.off); - assert(lv["h4"] > State.off); - } else { // (lv["h5"] > State.off) - assert(lv["h0"] > State.off); - assert(lv["h4"] > State.off); - assert(lv["h5"] > State.off); + if (lv["h5"] == eN.bi.off) { + assert(lv["h0"] > eN.bi.off); + assert(lv["h4"] > eN.bi.off); + } else { // (lv["h5"] > eN.bi.off) + assert(lv["h0"] > eN.bi.off); + assert(lv["h4"] > eN.bi.off); + assert(lv["h5"] > eN.bi.off); } break; case "3": - if (lv["h6"] == State.off) { - assert(lv["h0"] > State.off); - assert(lv["h4"] > State.off); - assert(lv["h5"] > State.off); - } else { // (lv["h6"] > State.off) - assert(lv["h0"] > State.off); - assert(lv["h4"] > State.off); - assert(lv["h5"] > State.off); - assert(lv["h6"] > State.off); + if (lv["h6"] == eN.bi.off) { + assert(lv["h0"] > eN.bi.off); + assert(lv["h4"] > eN.bi.off); + assert(lv["h5"] > eN.bi.off); + } else { // (lv["h6"] > eN.bi.off) + assert(lv["h0"] > eN.bi.off); + assert(lv["h4"] > eN.bi.off); + assert(lv["h5"] > eN.bi.off); + assert(lv["h6"] > eN.bi.off); } break; case "4": - if (lv["h7"] == State.off) { - assert(lv["h0"] > State.off); - assert(lv["h4"] > State.off); - assert(lv["h5"] > State.off); - assert(lv["h6"] > State.off); - } else { // (lv["h7"] > State.off) - assert(lv["h0"] > State.off); - assert(lv["h4"] > State.off); - assert(lv["h5"] > State.off); - assert(lv["h6"] > State.off); - assert(lv["h7"] > State.off); + if (lv["h7"] == eN.bi.off) { + assert(lv["h0"] > eN.bi.off); + assert(lv["h4"] > eN.bi.off); + assert(lv["h5"] > eN.bi.off); + assert(lv["h6"] > eN.bi.off); + } else { // (lv["h7"] > eN.bi.off) + assert(lv["h0"] > eN.bi.off); + assert(lv["h4"] > eN.bi.off); + assert(lv["h5"] > eN.bi.off); + assert(lv["h6"] > eN.bi.off); + assert(lv["h7"] > eN.bi.off); } break; default: @@ -6161,24 +6178,24 @@ template docAbstraction() { } @safe pure void assertions_flag_types_block_status_none_or_closed()(int[string] obj_type_status) { assert( - (obj_type_status["code"] == TriState.off) - || (obj_type_status["code"] == TriState.closing), + (obj_type_status["code"] == eN.tri.off) + || (obj_type_status["code"] == eN.tri.closing), "code block status: off or closing"); assert( - (obj_type_status["poem"] == TriState.off) - || (obj_type_status["poem"] == TriState.closing), + (obj_type_status["poem"] == eN.tri.off) + || (obj_type_status["poem"] == eN.tri.closing), "poem status: off or closing"); assert( - (obj_type_status["table"] == TriState.off) - || (obj_type_status["table"] == TriState.closing), + (obj_type_status["table"] == eN.tri.off) + || (obj_type_status["table"] == eN.tri.closing), "table status: off or closing"); assert( - (obj_type_status["group"] == TriState.off) - || (obj_type_status["group"] == TriState.closing), + (obj_type_status["group"] == eN.tri.off) + || (obj_type_status["group"] == eN.tri.closing), "group block status: off or closing"); assert( - (obj_type_status["block"] == TriState.off) - || (obj_type_status["block"] == TriState.closing), + (obj_type_status["block"] == eN.tri.off) + || (obj_type_status["block"] == eN.tri.closing), "block status: off or closing"); } /+ abstraction functions assertions ↑ +/ |