diff options
| -rw-r--r-- | org/metaverse.org | 222 | ||||
| -rw-r--r-- | src/doc_reform/meta/metadoc_from_src.d | 222 | 
2 files changed, 232 insertions, 212 deletions
| diff --git a/org/metaverse.org b/org/metaverse.org index 0192f1a..53e4014 100644 --- a/org/metaverse.org +++ b/org/metaverse.org @@ -174,6 +174,13 @@ mixin spineRgxIn;        on,        closing,      } +    enum ocn { +      off, +      on, +      closing, +      bkidx, +      reset, +    }      enum sect {        unset,        head, @@ -220,8 +227,7 @@ enum DocStructMarkupHeading {    h_text_5, // extra level, drop    content_non_header  } // header section A-D; header text 1-4 -enum OCNstatus { on, off, bkidx, closing, reset, } -enum OCN_off_block_status { off, on } +enum Status { off, on, }  enum OCNtype { ocn, non, bkidx, }  /+ biblio variables +/  string biblio_tag_name, biblio_tag_entry, st; @@ -580,11 +586,14 @@ uint[string] dochas = [    "images"            : 0,  ];  auto obj_type_status = flags_type_init; -int[string] track_state = [ -  "section" : 0, -  "block"   : 0, -  "obj"     : 0, -  "ocn"     : 0, +int[string] pith = [ +  "ocn"                       : 1, +  "section"                   : 0, +  "block"                     : 0, +  "obj"                       : 0, +  "dummy_heading_status"      : 0, +  "no_ocn_multiple_objects"   : 0, +  "heading_multiple_objects"  : 0,  ];  string[string] object_number_poem = [    "start" : "", @@ -738,7 +747,7 @@ debug(srclines) {  #+NAME: abs_in_loop_body_00  #+BEGIN_SRC d  if (!line.empty) { -  obj_type_status = line._check_ocn_status_(obj_type_status); +  pith = line._check_ocn_status_(pith);  }  #+END_SRC @@ -766,15 +775,15 @@ line = line.inline_markup_faces; // by text line (rather than by text object), l  #+NAME: abs_in_loop_body_non_code_obj  #+BEGIN_SRC d  if (line.matchFirst(rgx.heading_biblio) -|| (track_state["section"] == eN.sect.bibliography +|| (pith["section"] == eN.sect.bibliography    && ((!(line.matchFirst(rgx.heading_glossary)))    && (!(line.matchFirst(rgx.heading_blurb)))    && (!(line.matchFirst(rgx.heading)))    && (!(line.matchFirst(rgx.comment)))))  ) { -  track_state["section"] = eN.sect.bibliography; +  pith["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_state); +    line.flow_txt_block_biblio(obj_type_status, bib_entry, biblio_entry_str_json, biblio_arr_json, pith);      debug(bibliobuild) {        writeln("-  ", biblio_entry_str_json);        writeln("-> ", biblio_arr_json.length); @@ -795,7 +804,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) -|| (track_state["section"] == eN.sect.glossary +|| (pith["section"] == eN.sect.glossary    && ((!(line.matchFirst(rgx.heading_biblio)))    && (!(line.matchFirst(rgx.heading_blurb)))    && (!(line.matchFirst(rgx.heading))) @@ -806,7 +815,7 @@ if there is a glossary section you need to:      writeln(__LINE__);      writeln(line);    } -  track_state["section"] = eN.sect.glossary; +  pith["section"] = eN.sect.glossary;    if (opt_action.backmatter && opt_action.section_glossary) {      indent=[        "hang_position" : 0, @@ -886,7 +895,7 @@ if there is a glossary section you need to:        comp_obj_para.attrib.bullet                 = bullet;        the_glossary_section                        ~= comp_obj_para;      } -    obj_type_status["ocn_status"] = OCNstatus.on; +    pith["ocn"] = eN.ocn.on;    }    continue;  #+END_SRC @@ -903,13 +912,13 @@ 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) -|| (track_state["section"] == eN.sect.blurb +|| (pith["section"] == eN.sect.blurb    && ((!(line.matchFirst(rgx.heading_glossary)))    && (!(line.matchFirst(rgx.heading_biblio)))    && (!(line.matchFirst(rgx.heading)))    && (!(line.matchFirst(rgx.comment)))))  ) { -  track_state["section"] = eN.sect.blurb; +  pith["section"] = eN.sect.blurb;    debug(blurb) {      writeln(__LINE__);      writeln(line); @@ -1046,7 +1055,7 @@ if there is a blurb section you need to:        comp_obj_para.attrib.bullet                 = bullet;        the_blurb_section                           ~= comp_obj_para;      } -    obj_type_status["ocn_status"] = OCNstatus.on; +    pith["ocn"] = eN.ocn.on;    }    continue;  #+END_SRC @@ -1099,7 +1108,7 @@ if there is a blurb section you need to:  #+NAME: abs_in_loop_body_non_code_obj  #+BEGIN_SRC d  } 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); +  an_object = line.flow_txt_block_poem(an_object, obj_type_status, pith, cntr, object_number_poem, conf_make_meta, tag_in_seg);    continue;  #+END_SRC @@ -1108,7 +1117,7 @@ if there is a blurb section you need to:  #+NAME: abs_in_loop_body_non_code_obj  #+BEGIN_SRC d  } 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); +  an_object = line.flow_txt_block_table(an_object, obj_type_status, pith, conf_make_meta);    continue;  #+END_SRC @@ -1160,7 +1169,7 @@ if (obj_type_status["blocks"] == eN.tri.closing) {    assert(      line.matchFirst(rgx.book_index_item)      || line.matchFirst(rgx.book_index_item_open) -    || track_state["section"] == eN.sect.book_index, +    || pith["section"] == eN.sect.book_index,      "\nblocks closed, unless followed by book index, non-matching line:\n  \""      ~ line ~ "\""    ); @@ -1173,8 +1182,8 @@ if (obj_type_status["blocks"] == eN.tri.closing) {  #+BEGIN_SRC d  if (line.matchFirst(rgx.book_index_item)  || line.matchFirst(rgx.book_index_item_open) -|| 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); +|| pith["section"] == eN.sect.book_index)  {                            /+ book_index +/ +  an_object = line.flow_book_index_(an_object, book_idx_tmp, obj_type_status, pith, opt_action);  #+END_SRC  ******* not book index [+1] @@ -1241,7 +1250,7 @@ if (line.matchFirst(rgx.book_index_item)          collapsed_lev,          obj_type_status,          conf_make_meta, -        track_state, +        pith,        );      } else if (line_occur["para"] == eN.bi.off) {                              /+ para match +/        an_object_key="body_nugget"; @@ -1294,6 +1303,7 @@ an_object = line.flow_block_flag_line_empty_(    comp_obj_heading,    cntr,    obj_type_status, +  pith,    object_number_poem,    conf_make_meta,    tag_in_seg, @@ -1328,8 +1338,8 @@ if (_new_doc) {  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"]); +  ? ocn_emit(eN.ocn.reset) +  : ocn_emit(pith["ocn"]);    an_object["is"] = "heading";    an_object_key="body_nugget";    TxtAndAnchorTagPlusHasFootnotesUrlsImages substantive_object_and_anchor_tags_tuple @@ -1458,9 +1468,9 @@ if ((obj_type_status["heading"] == eN.bi.on)    /+ paragraph object (current line empty) +/    /+ repeated character paragraph separator +/    if ((an_object[an_object_key].to!string).matchFirst(rgx.repeated_character_line_separator)) { -    obj_type_status["ocn_status"]                          = OCNstatus.off; +    pith["ocn"] = eN.ocn.off;    } -  obj_cite_digits = ocn_emit(obj_type_status["ocn_status"]); +  obj_cite_digits = ocn_emit(pith["ocn"]);    an_object["bookindex_nugget"]      = ("bookindex_nugget" in an_object) ? an_object["bookindex_nugget"] : "";    bookindex_unordered_hashes @@ -1532,7 +1542,7 @@ if (the_document_body_section.length > 0) {    && (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_state["section"] = eN.sect.unset; +      pith["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) { @@ -2599,7 +2609,7 @@ if (the_endnotes_section.length > 1) {          writeln(obj.text);        }        if (obj.metainfo.heading_lev_markup == 1) { -        obj_cite_digits         = ocn_emit(OCNstatus.on); +        obj_cite_digits         = ocn_emit(eN.ocn.on);          obj.metainfo.ocn        = obj_cite_digits.object_number;          obj.metainfo.identifier = obj_cite_digits.identifier;        } @@ -2640,7 +2650,7 @@ if (the_glossary_section.length > 1) {          writeln(obj.text);        }        if (obj.metainfo.heading_lev_markup == 1) { -        obj_cite_digits         = ocn_emit(OCNstatus.on); +        obj_cite_digits         = ocn_emit(eN.ocn.on);          obj.metainfo.ocn        = obj_cite_digits.object_number;          obj.metainfo.identifier = obj_cite_digits.identifier;        } @@ -2662,7 +2672,7 @@ if (the_glossary_section.length > 1) {        }        obj = obj.obj_heading_ancestors(lv_ancestors_txt);      } else if (obj.metainfo.is_a == "glossary" && !(obj.text.empty)) { -      obj_cite_digits         = ocn_emit(OCNstatus.on); +      obj_cite_digits         = ocn_emit(eN.ocn.on);        obj.metainfo.ocn        = obj_cite_digits.object_number;        obj.metainfo.identifier = obj_cite_digits.identifier;      } @@ -2685,7 +2695,7 @@ if (the_bibliography_section.length > 1) {          writeln(obj.text);        }        if (obj.metainfo.heading_lev_markup == 1) { -        obj_cite_digits         = ocn_emit(OCNstatus.on); +        obj_cite_digits         = ocn_emit(eN.ocn.on);          obj.metainfo.ocn        = obj_cite_digits.object_number;          obj.metainfo.identifier = obj_cite_digits.identifier;        } @@ -2707,7 +2717,7 @@ if (the_bibliography_section.length > 1) {        }        obj = obj.obj_heading_ancestors(lv_ancestors_txt);      } else if (obj.metainfo.is_a == "bibliography") { -      obj_cite_digits         = ocn_emit(OCNstatus.on); +      obj_cite_digits         = ocn_emit(eN.ocn.on);        obj.metainfo.ocn        = obj_cite_digits.object_number;        obj.metainfo.identifier = obj_cite_digits.identifier;      } @@ -2737,7 +2747,7 @@ if (the_bookindex_section.length > 1) {                                        /          segnames_0_to_4 ~= obj.tags.segment_anchor_tag_epub;        }        if (obj.metainfo.heading_lev_markup == 1) { -        obj_cite_digits         = ocn_emit(OCNstatus.on); +        obj_cite_digits         = ocn_emit(eN.ocn.on);          obj.metainfo.ocn        = obj_cite_digits.object_number;          obj.metainfo.identifier = obj_cite_digits.identifier;        } @@ -2758,7 +2768,7 @@ if (the_bookindex_section.length > 1) {                                        /        }        obj = obj.obj_heading_ancestors(lv_ancestors_txt);      } else if (obj.metainfo.is_a == "bookindex") { -      obj_cite_digits                       = ocn_emit(OCNstatus.bkidx); +      obj_cite_digits                       = ocn_emit(eN.ocn.bkidx);        obj.metainfo.ocn                      = obj_cite_digits.object_number;        obj.metainfo.identifier               = obj_cite_digits.identifier;        obj.metainfo.o_n_book_index           = obj_cite_digits.bkidx; @@ -2785,7 +2795,7 @@ if (the_blurb_section.length > 1) {          writeln(obj.text);        }        if (obj.metainfo.heading_lev_markup == 1) { -        obj_cite_digits         = ocn_emit(OCNstatus.on); +        obj_cite_digits         = ocn_emit(eN.ocn.on);          obj.metainfo.ocn        = obj_cite_digits.object_number;          obj.metainfo.identifier = obj_cite_digits.identifier;        } @@ -2807,7 +2817,7 @@ if (the_blurb_section.length > 1) {        }        obj = obj.obj_heading_ancestors(lv_ancestors_txt);      } else if (obj.metainfo.is_a == "blurb") { -      obj_cite_digits = ocn_emit(OCNstatus.off); +      obj_cite_digits = ocn_emit(eN.ocn.off);        obj.metainfo.object_number_off  = obj_cite_digits.off;        obj.metainfo.object_number_type = OCNtype.non;      } @@ -3047,7 +3057,7 @@ destroy(the_blurb_section);  destroy(segnames);  destroy(bookindex_unordered_hashes);  destroy(an_object); -obj_cite_digits                              = ocn_emit(OCNstatus.reset); +obj_cite_digits                              = ocn_emit(eN.ocn.reset);  biblio_arr_json                              = [];  obj_cite_digit_                              = 0;  html_segnames_ptr                            = 0; @@ -3167,63 +3177,58 @@ functions used in document abstraction  #+NAME: abs_functions_ocn_status  #+BEGIN_SRC d  @safe static int[string] _check_ocn_status_()( -  char[]           line, -  int[string]      obj_type_status, +  char[]       line, +  int[string]  pith,  ) {    static auto rgx = RgxI(); -  if (!(line.empty) -    && (obj_type_status["ocn_status_off_for_multiple_objects"] == OCN_off_block_status.off) -  ) { -    /+ not multi-line object, check whether object_number is on or turned off +/ -    if (line.matchFirst(rgx.object_number_block_marks)) {                      /+ switch off object_number +/ -      if (line.matchFirst(rgx.object_number_off_block)) { -        obj_type_status["ocn_status_off_for_multiple_objects"] = OCN_off_block_status.on; -        obj_type_status["ocn_status"]                          = OCNstatus.off; -        debug(ocnoff) { -          writeln(line); -        } -      } -      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"]    = eN.bi.on; -        obj_type_status["ocn_status"]                          = OCNstatus.off; -        debug(ocnoff) { -          writeln(line); +  if (!(line.empty)) { +    if (pith["no_ocn_multiple_objects"] == eN.ocn.off) { +      /+ not multi-line object, check whether object_number is on or turned off +/ +      if (line.matchFirst(rgx.object_number_block_marks)) {                      /+ switch off object_number +/ +        if (line.matchFirst(rgx.object_number_off_block)) { +          pith["no_ocn_multiple_objects"] = eN.ocn.on; +          pith["ocn"] = eN.ocn.off; +          debug(ocnoff) { +            writeln(line); +          }          } -      } -    } else { -      if (obj_type_status["ocn_status_off_for_multiple_objects"] == OCN_off_block_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"] = eN.bi.on; +        if (line.matchFirst(rgx.object_number_off_block_dummy_heading)) { +          pith["no_ocn_multiple_objects"]  = eN.ocn.on; +          pith["heading_multiple_objects"] = eN.bi.on; +          pith["ocn"]                      = eN.ocn.off; +          debug(ocnoff) { +            writeln(line); +          }          } -        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"] = eN.bi.on; +      } else if (pith["no_ocn_multiple_objects"] == eN.ocn.off) { +          pith["dummy_heading_status"]     = eN.bi.off; +          if (pith["heading_multiple_objects"]) { +            pith["dummy_heading_status"] = eN.bi.on; +          } +          if (line.matchFirst(rgx.object_number_off)) { +            pith["ocn"]                    = eN.ocn.off; +          } else if (line.matchFirst(rgx.object_number_off_dummy_heading)) { +            pith["ocn"]                    = eN.ocn.off; +            pith["dummy_heading_status"]   = eN.bi.on; +          } else { +            pith["ocn"]                    = eN.ocn.on; +            pith["dummy_heading_status"]   = eN.bi.off; +          }          } else { -          obj_type_status["ocn_status"]           = OCNstatus.on; -          obj_type_status["dummy_heading_status"] = eN.bi.off; +          pith["ocn"] = pith["no_ocn_multiple_objects"]; +        } +    } else if (pith["no_ocn_multiple_objects"] == eN.ocn.on) { +      if (line.matchFirst(rgx.object_number_off_block_close)) { +        pith["no_ocn_multiple_objects"]    = eN.ocn.off; +        pith["ocn"]                        = eN.ocn.on; +        pith["dummy_heading_status"]       = eN.bi.off; +        debug(ocnoff) { +          writeln(line);          } -      } else { -        obj_type_status["ocn_status"]             = obj_type_status["ocn_status_off_for_multiple_objects"]; -      } -    } -  } else if ( -    !(line.empty) -    && (obj_type_status["ocn_status_off_for_multiple_objects"] > OCN_off_block_status.off) -  ) { -    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"]                = eN.bi.off; -      debug(ocnoff) { -        writeln(line);        }      }    } -  return obj_type_status; +  return pith;  }  #+END_SRC @@ -3677,13 +3682,13 @@ final string biblio_tag_map_()(string abr) {    return ref int         bib_entry,    return ref string      biblio_entry_str_json,    return ref string[]    biblio_arr_json, -  return ref int[string] track_state, +  return ref int[string] pith,  ) {    mixin spineBiblio;    auto jsn = BibJsnStr();    static auto rgx = RgxI();    if (line.matchFirst(rgx.heading_biblio)) { -    track_state["section"] = eN.sect.bibliography; +    pith["section"] = eN.sect.bibliography;    }    if (line.empty) {      debug { @@ -3946,6 +3951,7 @@ why extra object stuff only in poem/verse?               char[]          line,               string[string]  an_object,    return ref int[string]     obj_type_status, +  return ref int[string]     pith,    return ref int             cntr,               string[string]  object_number_poem,               CMM             conf_make_meta, @@ -4016,7 +4022,7 @@ why extra object stuff only in poem/verse?      } else {        processing["verse"] ~= line ~= "\n";        if (obj_type_status["verse_new"] == eN.bi.on) { -        obj_cite_digits = ocn_emit(obj_type_status["ocn_status"]); +        obj_cite_digits = ocn_emit(pith["ocn"]);          obj_type_status["verse_new"] = eN.bi.off;        } else if (line.matchFirst(rgx.newline_eol_delimiter_only)) {          processing["verse"] = processing["verse"].stripRight; @@ -4124,7 +4130,7 @@ why extra object stuff only in poem/verse?      } else {        processing["verse"] ~= line ~= "\n";        if (obj_type_status["verse_new"] == eN.bi.on) { -        obj_cite_digits = ocn_emit(obj_type_status["ocn_status"]); +        obj_cite_digits = ocn_emit(pith["ocn"]);          obj_type_status["verse_new"] = eN.bi.off;        } else if (line.matchFirst(rgx.newline_eol_delimiter_only)) {          processing["verse"] = processing["verse"].stripRight; @@ -4210,6 +4216,7 @@ you need:               char[]          line,               string[string]  an_object,    return ref int[string]     obj_type_status, +  return ref int[string]     pith,    return ref CMM             conf_make_meta,  ) {    static auto rgx = RgxI(); @@ -4239,6 +4246,7 @@ you need:          comp_obj_heading,          cntr,          obj_type_status, +        pith,          conf_make_meta,        );      } else { @@ -4284,10 +4292,11 @@ process and use an_object["table_head"] (then empty it)    return ref ObjGenericComposite   _comp_obj_heading,    return ref int                   cntr,    return ref int[string]           obj_type_status, +  return ref int[string]           pith,    CMM                              conf_make_meta  ) {    comp_obj_block = comp_obj_block.init; -  obj_cite_digits = ocn_emit(obj_type_status["ocn_status"]); +  obj_cite_digits = ocn_emit(pith["ocn"]);    auto comp_obj_location      = node_construct.node_location_emitter(        content_non_header, @@ -4335,6 +4344,7 @@ process and use an_object["table_head"] (then empty it)    return ref ObjGenericComposite      _comp_obj_heading,    return ref int                      cntr,    return ref int[string]              obj_type_status, +  return ref int[string]              pith,    string[string]                      object_number_poem,    CMM                                 conf_make_meta,    Ts                                  tag_in_seg, @@ -4357,7 +4367,7 @@ process and use an_object["table_head"] (then empty it)  #+NAME: abs_functions_block_line_status_empty  #+BEGIN_SRC d    if (obj_type_status["quote"] == eN.tri.closing) { -    obj_cite_digits = ocn_emit(obj_type_status["ocn_status"]); +    obj_cite_digits = ocn_emit(pith["ocn"]);      an_object["bookindex_nugget"]        = ("bookindex_nugget" in an_object) ? an_object["bookindex_nugget"] : "";      bookindex_unordered_hashes @@ -4414,7 +4424,7 @@ process and use an_object["table_head"] (then empty it)  #+NAME: abs_functions_block_line_status_empty  #+BEGIN_SRC d    } else if (obj_type_status["group"] == eN.tri.closing) { -    obj_cite_digits = ocn_emit(obj_type_status["ocn_status"]); +    obj_cite_digits = ocn_emit(pith["ocn"]);      an_object["bookindex_nugget"]        = ("bookindex_nugget" in an_object) ? an_object["bookindex_nugget"] : "";      bookindex_unordered_hashes @@ -4471,7 +4481,7 @@ process and use an_object["table_head"] (then empty it)  #+NAME: abs_functions_block_line_status_empty  #+BEGIN_SRC d    } else if (obj_type_status["block"] == eN.tri.closing) { -    obj_cite_digits = ocn_emit(obj_type_status["ocn_status"]); +    obj_cite_digits = ocn_emit(pith["ocn"]);      an_object["bookindex_nugget"]        = ("bookindex_nugget" in an_object) ? an_object["bookindex_nugget"] : "";      bookindex_unordered_hashes @@ -4570,7 +4580,7 @@ process and use an_object["table_head"] (then empty it)  #+NAME: abs_functions_block_line_status_empty  #+BEGIN_SRC d    } else if (obj_type_status["code"] == eN.tri.closing) { -    obj_cite_digits = ocn_emit(obj_type_status["ocn_status"]); +    obj_cite_digits = ocn_emit(pith["ocn"]);      an_object["bookindex_nugget"]        = ("bookindex_nugget" in an_object) ? an_object["bookindex_nugget"] : "";      bookindex_unordered_hashes @@ -4628,7 +4638,7 @@ process and use an_object["table_head"] (then empty it)  #+BEGIN_SRC d    } 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"]); +    obj_cite_digits = ocn_emit(pith["ocn"]);      an_object["bookindex_nugget"]        = ("bookindex_nugget" in an_object) ? an_object["bookindex_nugget"] : "";      bookindex_unordered_hashes @@ -4688,7 +4698,7 @@ process and use an_object["table_head"] (then empty it)               string[string]  an_object,    return ref string          book_idx_tmp,    return ref int[string]     obj_type_status, -  return ref int[string]     track_state, +  return ref int[string]     pith,               B               opt_action,  ) {    static auto rgx = RgxI(); @@ -4701,7 +4711,7 @@ process and use an_object["table_head"] (then empty it)      }      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_state["section"] = eN.sect.book_index; +    pith["section"] = eN.sect.book_index;      if (opt_action.backmatter && opt_action.section_bookindex) {        book_idx_tmp = m.captures[1].to!string;        debug(bookindexmatch) { @@ -4711,9 +4721,9 @@ process and use an_object["table_head"] (then empty it)          );        }      } -  } else if (track_state["section"] == eN.sect.book_index)  {                    /+ book_index flag set +/ +  } else if (pith["section"] == eN.sect.book_index)  {                    /+ book_index flag set +/      if (auto m = line.match(rgx.book_index_item_close))  { -      track_state["section"] = eN.sect.unset; +      pith["section"] = eN.sect.unset;        if (opt_action.backmatter        && opt_action.section_bookindex) {          an_object["bookindex_nugget"] = book_idx_tmp ~ m.captures[1].to!string; @@ -4899,7 +4909,7 @@ process and use an_object["table_head"] (then empty it)    return ref int[string]     collapsed_lev,    return ref int[string]     obj_type_status,    return ref CMM             conf_make_meta, -  return ref int[string]     track_state, +  return ref int[string]     pith,  ) {    static auto rgx = RgxI();    if (auto m = line.match(rgx.headings)) {                                      /+ heading match +/ @@ -4907,7 +4917,7 @@ process and use an_object["table_head"] (then empty it)      obj_type_status["heading"]            = eN.bi.on;      obj_type_status["para"]               = eN.bi.off;      if (line.match(rgx.heading_seg_and_above)) { -      track_state["section"]                    = eN.sect.unset; +      pith["section"]                    = eN.sect.unset;      }      an_object[an_object_key] ~= line ~= "\n";      an_object["lev"] ~= m.captures[1]; @@ -5035,7 +5045,7 @@ process and use an_object["table_head"] (then empty it)      default:        an_object["lev_markup_number"] = lv["lv"].to!string;      } -    an_object["dummy_heading_status"] = (obj_type_status["dummy_heading_status"] == eN.bi.off) ? "f" : "t"; +    an_object["dummy_heading_status"] = (pith["dummy_heading_status"] == eN.bi.off) ? "f" : "t";      debug(heading) {        writeln(line.strip);      } @@ -5357,11 +5367,11 @@ process and use an_object["table_head"] (then empty it)    bool ocn_is_off;    @safe auto ocn_emitter(int ocn_status_flag) {      OCNset ocn; -    assert(ocn_status_flag <= OCNstatus.reset); +    assert(ocn_status_flag <= eN.ocn.reset);      ocn_object_number = ocn_bkidx = 0;      object_identifier = "";      ocn_is_off = false; -    switch(ocn_status_flag) with (OCNstatus) { +    switch(ocn_status_flag) with (eN.ocn) {      case reset:        ocn_digit = ocn_on_ = 1;        object_identifier = "1"; @@ -5382,7 +5392,7 @@ process and use an_object["table_head"] (then empty it)      case bkidx:        ocn_bkidx = ++ocn_bkidx_;        break; -    case closing: +    case closing: // unused?        break;      default:        ocn_digit = 0; diff --git a/src/doc_reform/meta/metadoc_from_src.d b/src/doc_reform/meta/metadoc_from_src.d index 1ae2e01..8d07d48 100644 --- a/src/doc_reform/meta/metadoc_from_src.d +++ b/src/doc_reform/meta/metadoc_from_src.d @@ -32,6 +32,13 @@ template docAbstraction() {          on,          closing,        } +      enum ocn { +        off, +        on, +        closing, +        bkidx, +        reset, +      }        enum sect {          unset,          head, @@ -72,8 +79,7 @@ template docAbstraction() {      h_text_5, // extra level, drop      content_non_header    } // header section A-D; header text 1-4 -  enum OCNstatus { on, off, bkidx, closing, reset, } -  enum OCN_off_block_status { off, on } +  enum Status { off, on, }    enum OCNtype { ocn, non, bkidx, }    /+ biblio variables +/    string biblio_tag_name, biblio_tag_entry, st; @@ -400,11 +406,14 @@ template docAbstraction() {        "images"            : 0,      ];      auto obj_type_status = flags_type_init; -    int[string] track_state = [ -      "section" : 0, -      "block"   : 0, -      "obj"     : 0, -      "ocn"     : 0, +    int[string] pith = [ +      "ocn"                       : 1, +      "section"                   : 0, +      "block"                     : 0, +      "obj"                       : 0, +      "dummy_heading_status"      : 0, +      "no_ocn_multiple_objects"   : 0, +      "heading_multiple_objects"  : 0,      ];      string[string] object_number_poem = [        "start" : "", @@ -544,7 +553,7 @@ template docAbstraction() {          }        }        if (!line.empty) { -        obj_type_status = line._check_ocn_status_(obj_type_status); +        pith = line._check_ocn_status_(pith);        }        if (obj_type_status["code"] == eN.tri.on) {          /+ block object: code +/ @@ -555,15 +564,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_state["section"] == eN.sect.bibliography +        || (pith["section"] == eN.sect.bibliography            && ((!(line.matchFirst(rgx.heading_glossary)))            && (!(line.matchFirst(rgx.heading_blurb)))            && (!(line.matchFirst(rgx.heading)))            && (!(line.matchFirst(rgx.comment)))))          ) { -          track_state["section"] = eN.sect.bibliography; +          pith["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_state); +            line.flow_txt_block_biblio(obj_type_status, bib_entry, biblio_entry_str_json, biblio_arr_json, pith);              debug(bibliobuild) {                writeln("-  ", biblio_entry_str_json);                writeln("-> ", biblio_arr_json.length); @@ -571,7 +580,7 @@ template docAbstraction() {            }            continue;          } else if (line.matchFirst(rgx.heading_glossary) -        || (track_state["section"] == eN.sect.glossary +        || (pith["section"] == eN.sect.glossary            && ((!(line.matchFirst(rgx.heading_biblio)))            && (!(line.matchFirst(rgx.heading_blurb)))            && (!(line.matchFirst(rgx.heading))) @@ -582,7 +591,7 @@ template docAbstraction() {              writeln(__LINE__);              writeln(line);            } -          track_state["section"] = eN.sect.glossary; +          pith["section"] = eN.sect.glossary;            if (opt_action.backmatter && opt_action.section_glossary) {              indent=[                "hang_position" : 0, @@ -662,17 +671,17 @@ template docAbstraction() {                comp_obj_para.attrib.bullet                 = bullet;                the_glossary_section                        ~= comp_obj_para;              } -            obj_type_status["ocn_status"] = OCNstatus.on; +            pith["ocn"] = eN.ocn.on;            }            continue;          } else if (line.matchFirst(rgx.heading_blurb) -        || (track_state["section"] == eN.sect.blurb +        || (pith["section"] == eN.sect.blurb            && ((!(line.matchFirst(rgx.heading_glossary)))            && (!(line.matchFirst(rgx.heading_biblio)))            && (!(line.matchFirst(rgx.heading)))            && (!(line.matchFirst(rgx.comment)))))          ) { -          track_state["section"] = eN.sect.blurb; +          pith["section"] = eN.sect.blurb;            debug(blurb) {              writeln(__LINE__);              writeln(line); @@ -809,7 +818,7 @@ template docAbstraction() {                comp_obj_para.attrib.bullet                 = bullet;                the_blurb_section                           ~= comp_obj_para;              } -            obj_type_status["ocn_status"] = OCNstatus.on; +            pith["ocn"] = eN.ocn.on;            }            continue;          } else if (obj_type_status["quote"] == eN.tri.on) {                          /+ within block object: quote +/ @@ -837,10 +846,10 @@ template docAbstraction() {            an_object = line.flow_txt_block_block(an_object, obj_type_status);            continue;          } 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); +          an_object = line.flow_txt_block_poem(an_object, obj_type_status, pith, cntr, object_number_poem, conf_make_meta, tag_in_seg);            continue;          } 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); +          an_object = line.flow_txt_block_table(an_object, obj_type_status, pith, conf_make_meta);            continue;          } else {                                                                /+ not within a block group +/            assert( @@ -876,15 +885,15 @@ template docAbstraction() {                assert(                  line.matchFirst(rgx.book_index_item)                  || line.matchFirst(rgx.book_index_item_open) -                || track_state["section"] == eN.sect.book_index, +                || pith["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_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); +            || pith["section"] == eN.sect.book_index)  {                            /+ book_index +/ +              an_object = line.flow_book_index_(an_object, book_idx_tmp, obj_type_status, pith, opt_action);              } else {                                                                       /+ not book_index +/                an_object_key="body_nugget";                if (auto m = line.matchFirst(rgx.comment)) {                                 /+ matched comment +/ @@ -933,7 +942,7 @@ template docAbstraction() {                      collapsed_lev,                      obj_type_status,                      conf_make_meta, -                    track_state, +                    pith,                    );                  } else if (line_occur["para"] == eN.bi.off) {                              /+ para match +/                    an_object_key="body_nugget"; @@ -969,6 +978,7 @@ template docAbstraction() {                comp_obj_heading,                cntr,                obj_type_status, +              pith,                object_number_poem,                conf_make_meta,                tag_in_seg, @@ -991,8 +1001,8 @@ template docAbstraction() {              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"]); +              ? ocn_emit(eN.ocn.reset) +              : ocn_emit(pith["ocn"]);                an_object["is"] = "heading";                an_object_key="body_nugget";                TxtAndAnchorTagPlusHasFootnotesUrlsImages substantive_object_and_anchor_tags_tuple @@ -1115,9 +1125,9 @@ template docAbstraction() {                /+ paragraph object (current line empty) +/                /+ repeated character paragraph separator +/                if ((an_object[an_object_key].to!string).matchFirst(rgx.repeated_character_line_separator)) { -                obj_type_status["ocn_status"]                          = OCNstatus.off; +                pith["ocn"] = eN.ocn.off;                } -              obj_cite_digits = ocn_emit(obj_type_status["ocn_status"]); +              obj_cite_digits = ocn_emit(pith["ocn"]);                an_object["bookindex_nugget"]                  = ("bookindex_nugget" in an_object) ? an_object["bookindex_nugget"] : "";                bookindex_unordered_hashes @@ -1186,7 +1196,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_state["section"] = eN.sect.unset; +            pith["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) { @@ -1996,7 +2006,7 @@ template docAbstraction() {              writeln(obj.text);            }            if (obj.metainfo.heading_lev_markup == 1) { -            obj_cite_digits         = ocn_emit(OCNstatus.on); +            obj_cite_digits         = ocn_emit(eN.ocn.on);              obj.metainfo.ocn        = obj_cite_digits.object_number;              obj.metainfo.identifier = obj_cite_digits.identifier;            } @@ -2029,7 +2039,7 @@ template docAbstraction() {              writeln(obj.text);            }            if (obj.metainfo.heading_lev_markup == 1) { -            obj_cite_digits         = ocn_emit(OCNstatus.on); +            obj_cite_digits         = ocn_emit(eN.ocn.on);              obj.metainfo.ocn        = obj_cite_digits.object_number;              obj.metainfo.identifier = obj_cite_digits.identifier;            } @@ -2051,7 +2061,7 @@ template docAbstraction() {            }            obj = obj.obj_heading_ancestors(lv_ancestors_txt);          } else if (obj.metainfo.is_a == "glossary" && !(obj.text.empty)) { -          obj_cite_digits         = ocn_emit(OCNstatus.on); +          obj_cite_digits         = ocn_emit(eN.ocn.on);            obj.metainfo.ocn        = obj_cite_digits.object_number;            obj.metainfo.identifier = obj_cite_digits.identifier;          } @@ -2066,7 +2076,7 @@ template docAbstraction() {              writeln(obj.text);            }            if (obj.metainfo.heading_lev_markup == 1) { -            obj_cite_digits         = ocn_emit(OCNstatus.on); +            obj_cite_digits         = ocn_emit(eN.ocn.on);              obj.metainfo.ocn        = obj_cite_digits.object_number;              obj.metainfo.identifier = obj_cite_digits.identifier;            } @@ -2088,7 +2098,7 @@ template docAbstraction() {            }            obj = obj.obj_heading_ancestors(lv_ancestors_txt);          } else if (obj.metainfo.is_a == "bibliography") { -          obj_cite_digits         = ocn_emit(OCNstatus.on); +          obj_cite_digits         = ocn_emit(eN.ocn.on);            obj.metainfo.ocn        = obj_cite_digits.object_number;            obj.metainfo.identifier = obj_cite_digits.identifier;          } @@ -2110,7 +2120,7 @@ template docAbstraction() {              segnames_0_to_4 ~= obj.tags.segment_anchor_tag_epub;            }            if (obj.metainfo.heading_lev_markup == 1) { -            obj_cite_digits         = ocn_emit(OCNstatus.on); +            obj_cite_digits         = ocn_emit(eN.ocn.on);              obj.metainfo.ocn        = obj_cite_digits.object_number;              obj.metainfo.identifier = obj_cite_digits.identifier;            } @@ -2131,7 +2141,7 @@ template docAbstraction() {            }            obj = obj.obj_heading_ancestors(lv_ancestors_txt);          } else if (obj.metainfo.is_a == "bookindex") { -          obj_cite_digits                       = ocn_emit(OCNstatus.bkidx); +          obj_cite_digits                       = ocn_emit(eN.ocn.bkidx);            obj.metainfo.ocn                      = obj_cite_digits.object_number;            obj.metainfo.identifier               = obj_cite_digits.identifier;            obj.metainfo.o_n_book_index           = obj_cite_digits.bkidx; @@ -2152,7 +2162,7 @@ template docAbstraction() {              writeln(obj.text);            }            if (obj.metainfo.heading_lev_markup == 1) { -            obj_cite_digits         = ocn_emit(OCNstatus.on); +            obj_cite_digits         = ocn_emit(eN.ocn.on);              obj.metainfo.ocn        = obj_cite_digits.object_number;              obj.metainfo.identifier = obj_cite_digits.identifier;            } @@ -2174,7 +2184,7 @@ template docAbstraction() {            }            obj = obj.obj_heading_ancestors(lv_ancestors_txt);          } else if (obj.metainfo.is_a == "blurb") { -          obj_cite_digits = ocn_emit(OCNstatus.off); +          obj_cite_digits = ocn_emit(eN.ocn.off);            obj.metainfo.object_number_off  = obj_cite_digits.off;            obj.metainfo.object_number_type = OCNtype.non;          } @@ -2377,7 +2387,7 @@ template docAbstraction() {      destroy(segnames);      destroy(bookindex_unordered_hashes);      destroy(an_object); -    obj_cite_digits                              = ocn_emit(OCNstatus.reset); +    obj_cite_digits                              = ocn_emit(eN.ocn.reset);      biblio_arr_json                              = [];      obj_cite_digit_                              = 0;      html_segnames_ptr                            = 0; @@ -2466,63 +2476,58 @@ template docAbstraction() {      an_object                  = an_object.object_reset;    }    @safe static int[string] _check_ocn_status_()( -    char[]           line, -    int[string]      obj_type_status, +    char[]       line, +    int[string]  pith,    ) {      static auto rgx = RgxI(); -    if (!(line.empty) -      && (obj_type_status["ocn_status_off_for_multiple_objects"] == OCN_off_block_status.off) -    ) { -      /+ not multi-line object, check whether object_number is on or turned off +/ -      if (line.matchFirst(rgx.object_number_block_marks)) {                      /+ switch off object_number +/ -        if (line.matchFirst(rgx.object_number_off_block)) { -          obj_type_status["ocn_status_off_for_multiple_objects"] = OCN_off_block_status.on; -          obj_type_status["ocn_status"]                          = OCNstatus.off; -          debug(ocnoff) { -            writeln(line); -          } -        } -        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"]    = eN.bi.on; -          obj_type_status["ocn_status"]                          = OCNstatus.off; -          debug(ocnoff) { -            writeln(line); +    if (!(line.empty)) { +      if (pith["no_ocn_multiple_objects"] == eN.ocn.off) { +        /+ not multi-line object, check whether object_number is on or turned off +/ +        if (line.matchFirst(rgx.object_number_block_marks)) {                      /+ switch off object_number +/ +          if (line.matchFirst(rgx.object_number_off_block)) { +            pith["no_ocn_multiple_objects"] = eN.ocn.on; +            pith["ocn"] = eN.ocn.off; +            debug(ocnoff) { +              writeln(line); +            }            } -        } -      } else { -        if (obj_type_status["ocn_status_off_for_multiple_objects"] == OCN_off_block_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"] = eN.bi.on; +          if (line.matchFirst(rgx.object_number_off_block_dummy_heading)) { +            pith["no_ocn_multiple_objects"]  = eN.ocn.on; +            pith["heading_multiple_objects"] = eN.bi.on; +            pith["ocn"]                      = eN.ocn.off; +            debug(ocnoff) { +              writeln(line); +            }            } -          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"] = eN.bi.on; +        } else if (pith["no_ocn_multiple_objects"] == eN.ocn.off) { +            pith["dummy_heading_status"]     = eN.bi.off; +            if (pith["heading_multiple_objects"]) { +              pith["dummy_heading_status"] = eN.bi.on; +            } +            if (line.matchFirst(rgx.object_number_off)) { +              pith["ocn"]                    = eN.ocn.off; +            } else if (line.matchFirst(rgx.object_number_off_dummy_heading)) { +              pith["ocn"]                    = eN.ocn.off; +              pith["dummy_heading_status"]   = eN.bi.on; +            } else { +              pith["ocn"]                    = eN.ocn.on; +              pith["dummy_heading_status"]   = eN.bi.off; +            }            } else { -            obj_type_status["ocn_status"]           = OCNstatus.on; -            obj_type_status["dummy_heading_status"] = eN.bi.off; +            pith["ocn"] = pith["no_ocn_multiple_objects"]; +          } +      } else if (pith["no_ocn_multiple_objects"] == eN.ocn.on) { +        if (line.matchFirst(rgx.object_number_off_block_close)) { +          pith["no_ocn_multiple_objects"]    = eN.ocn.off; +          pith["ocn"]                        = eN.ocn.on; +          pith["dummy_heading_status"]       = eN.bi.off; +          debug(ocnoff) { +            writeln(line);            } -        } else { -          obj_type_status["ocn_status"]             = obj_type_status["ocn_status_off_for_multiple_objects"]; -        } -      } -    } else if ( -      !(line.empty) -      && (obj_type_status["ocn_status_off_for_multiple_objects"] > OCN_off_block_status.off) -    ) { -      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"]                = eN.bi.off; -        debug(ocnoff) { -          writeln(line);          }        }      } -    return obj_type_status; +    return pith;    }    @safe char[] _doc_header_and_make_substitutions_(CMM)(      char[]  line, @@ -2871,6 +2876,7 @@ template docAbstraction() {                 char[]          line,                 string[string]  an_object,      return ref int[string]     obj_type_status, +    return ref int[string]     pith,      return ref int             cntr,                 string[string]  object_number_poem,                 CMM             conf_make_meta, @@ -2941,7 +2947,7 @@ template docAbstraction() {        } else {          processing["verse"] ~= line ~= "\n";          if (obj_type_status["verse_new"] == eN.bi.on) { -          obj_cite_digits = ocn_emit(obj_type_status["ocn_status"]); +          obj_cite_digits = ocn_emit(pith["ocn"]);            obj_type_status["verse_new"] = eN.bi.off;          } else if (line.matchFirst(rgx.newline_eol_delimiter_only)) {            processing["verse"] = processing["verse"].stripRight; @@ -3049,7 +3055,7 @@ template docAbstraction() {        } else {          processing["verse"] ~= line ~= "\n";          if (obj_type_status["verse_new"] == eN.bi.on) { -          obj_cite_digits = ocn_emit(obj_type_status["ocn_status"]); +          obj_cite_digits = ocn_emit(pith["ocn"]);            obj_type_status["verse_new"] = eN.bi.off;          } else if (line.matchFirst(rgx.newline_eol_delimiter_only)) {            processing["verse"] = processing["verse"].stripRight; @@ -3155,6 +3161,7 @@ template docAbstraction() {                 char[]          line,                 string[string]  an_object,      return ref int[string]     obj_type_status, +    return ref int[string]     pith,      return ref CMM             conf_make_meta,    ) {      static auto rgx = RgxI(); @@ -3184,6 +3191,7 @@ template docAbstraction() {            comp_obj_heading,            cntr,            obj_type_status, +          pith,            conf_make_meta,          );        } else { @@ -3234,13 +3242,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_state, +    return ref int[string] pith,    ) {      mixin spineBiblio;      auto jsn = BibJsnStr();      static auto rgx = RgxI();      if (line.matchFirst(rgx.heading_biblio)) { -      track_state["section"] = eN.sect.bibliography; +      pith["section"] = eN.sect.bibliography;      }      if (line.empty) {        debug { @@ -3357,10 +3365,11 @@ template docAbstraction() {      return ref ObjGenericComposite   _comp_obj_heading,      return ref int                   cntr,      return ref int[string]           obj_type_status, +    return ref int[string]           pith,      CMM                              conf_make_meta    ) {      comp_obj_block = comp_obj_block.init; -    obj_cite_digits = ocn_emit(obj_type_status["ocn_status"]); +    obj_cite_digits = ocn_emit(pith["ocn"]);      auto comp_obj_location        = node_construct.node_location_emitter(          content_non_header, @@ -3400,6 +3409,7 @@ template docAbstraction() {      return ref ObjGenericComposite      _comp_obj_heading,      return ref int                      cntr,      return ref int[string]              obj_type_status, +    return ref int[string]              pith,      string[string]                      object_number_poem,      CMM                                 conf_make_meta,      Ts                                  tag_in_seg, @@ -3416,7 +3426,7 @@ template docAbstraction() {      assertions_flag_types_block_status_none_or_closed(obj_type_status);      static auto rgx = RgxI();      if (obj_type_status["quote"] == eN.tri.closing) { -      obj_cite_digits = ocn_emit(obj_type_status["ocn_status"]); +      obj_cite_digits = ocn_emit(pith["ocn"]);        an_object["bookindex_nugget"]          = ("bookindex_nugget" in an_object) ? an_object["bookindex_nugget"] : "";        bookindex_unordered_hashes @@ -3467,7 +3477,7 @@ template docAbstraction() {        processing.remove("verse");        ++cntr;      } else if (obj_type_status["group"] == eN.tri.closing) { -      obj_cite_digits = ocn_emit(obj_type_status["ocn_status"]); +      obj_cite_digits = ocn_emit(pith["ocn"]);        an_object["bookindex_nugget"]          = ("bookindex_nugget" in an_object) ? an_object["bookindex_nugget"] : "";        bookindex_unordered_hashes @@ -3518,7 +3528,7 @@ template docAbstraction() {        processing.remove("verse");        ++cntr;      } else if (obj_type_status["block"] == eN.tri.closing) { -      obj_cite_digits = ocn_emit(obj_type_status["ocn_status"]); +      obj_cite_digits = ocn_emit(pith["ocn"]);        an_object["bookindex_nugget"]          = ("bookindex_nugget" in an_object) ? an_object["bookindex_nugget"] : "";        bookindex_unordered_hashes @@ -3605,7 +3615,7 @@ template docAbstraction() {        object_reset(an_object);        processing.remove("verse");      } else if (obj_type_status["code"] == eN.tri.closing) { -      obj_cite_digits = ocn_emit(obj_type_status["ocn_status"]); +      obj_cite_digits = ocn_emit(pith["ocn"]);        an_object["bookindex_nugget"]          = ("bookindex_nugget" in an_object) ? an_object["bookindex_nugget"] : "";        bookindex_unordered_hashes @@ -3657,7 +3667,7 @@ template docAbstraction() {        ++cntr;      } 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"]); +      obj_cite_digits = ocn_emit(pith["ocn"]);        an_object["bookindex_nugget"]          = ("bookindex_nugget" in an_object) ? an_object["bookindex_nugget"] : "";        bookindex_unordered_hashes @@ -3705,7 +3715,7 @@ template docAbstraction() {                 string[string]  an_object,      return ref string          book_idx_tmp,      return ref int[string]     obj_type_status, -    return ref int[string]     track_state, +    return ref int[string]     pith,                 B               opt_action,    ) {      static auto rgx = RgxI(); @@ -3718,7 +3728,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_state["section"] = eN.sect.book_index; +      pith["section"] = eN.sect.book_index;        if (opt_action.backmatter && opt_action.section_bookindex) {          book_idx_tmp = m.captures[1].to!string;          debug(bookindexmatch) { @@ -3728,9 +3738,9 @@ template docAbstraction() {            );          }        } -    } else if (track_state["section"] == eN.sect.book_index)  {                    /+ book_index flag set +/ +    } else if (pith["section"] == eN.sect.book_index)  {                    /+ book_index flag set +/        if (auto m = line.match(rgx.book_index_item_close))  { -        track_state["section"] = eN.sect.unset; +        pith["section"] = eN.sect.unset;          if (opt_action.backmatter          && opt_action.section_bookindex) {            an_object["bookindex_nugget"] = book_idx_tmp ~ m.captures[1].to!string; @@ -3897,7 +3907,7 @@ 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_state, +    return ref int[string]     pith,    ) {      static auto rgx = RgxI();      if (auto m = line.match(rgx.headings)) {                                      /+ heading match +/ @@ -3905,7 +3915,7 @@ template docAbstraction() {        obj_type_status["heading"]            = eN.bi.on;        obj_type_status["para"]               = eN.bi.off;        if (line.match(rgx.heading_seg_and_above)) { -        track_state["section"]                    = eN.sect.unset; +        pith["section"]                    = eN.sect.unset;        }        an_object[an_object_key] ~= line ~= "\n";        an_object["lev"] ~= m.captures[1]; @@ -4033,7 +4043,7 @@ template docAbstraction() {        default:          an_object["lev_markup_number"] = lv["lv"].to!string;        } -      an_object["dummy_heading_status"] = (obj_type_status["dummy_heading_status"] == eN.bi.off) ? "f" : "t"; +      an_object["dummy_heading_status"] = (pith["dummy_heading_status"] == eN.bi.off) ? "f" : "t";        debug(heading) {          writeln(line.strip);        } @@ -4304,11 +4314,11 @@ template docAbstraction() {      bool ocn_is_off;      @safe auto ocn_emitter(int ocn_status_flag) {        OCNset ocn; -      assert(ocn_status_flag <= OCNstatus.reset); +      assert(ocn_status_flag <= eN.ocn.reset);        ocn_object_number = ocn_bkidx = 0;        object_identifier = "";        ocn_is_off = false; -      switch(ocn_status_flag) with (OCNstatus) { +      switch(ocn_status_flag) with (eN.ocn) {        case reset:          ocn_digit = ocn_on_ = 1;          object_identifier = "1"; @@ -4329,7 +4339,7 @@ template docAbstraction() {        case bkidx:          ocn_bkidx = ++ocn_bkidx_;          break; -      case closing: +      case closing: // unused?          break;        default:          ocn_digit = 0; | 
