diff options
| -rw-r--r-- | org/meta_abstraction.org | 331 | ||||
| -rw-r--r-- | org/sdp.org | 66 | ||||
| -rw-r--r-- | src/sdp/meta/metadoc_from_src.d | 328 | ||||
| -rw-r--r-- | src/sdp/meta/object_setter.d | 3 | 
4 files changed, 417 insertions, 311 deletions
| diff --git a/org/meta_abstraction.org b/org/meta_abstraction.org index e3b7b5f..1ddec75 100644 --- a/org/meta_abstraction.org +++ b/org/meta_abstraction.org @@ -198,6 +198,8 @@ enum DocStructMarkupHeading {    h_text_5, // extra level, drop    content_non_header  } // header section A-D; header text 1-4 +enum OCNstatus { inc, exc, bkidx, closing, reset, } +enum OCNtype { ocn, non, bkidx, }  /+ biblio variables +/  string biblio_tag_name, biblio_tag_entry, st;  string[] biblio_arr_json; @@ -218,7 +220,7 @@ string content_non_header = "8";  static auto obj_im = ObjInlineMarkup();  static auto obj_att = ObjAttributes();  /+ ocn +/ -int obj_cite_number, obj_cite_number_; +int obj_cite_digit, obj_cite_digit_, obj_cite_digit_bkidx;  auto object_citation_number = OCNemitter();  int[] dom_markedup = [ 0, 0, 0, 0, 0, 0, 0, 0, 0,];  int[] dom_markedup_buffer = [ 0, 0, 0, 0, 0, 0, 0, 0, 0,]; @@ -684,7 +686,7 @@ if there is a glossary section you need to:        comp_obj_para.bullet                = bullet;        the_glossary_section                ~= comp_obj_para;      } -    obj_type_status["ocn_status"] = TriState.off; +    obj_type_status["ocn_status"] = OCNstatus.inc;    }    continue;  #+END_SRC @@ -790,7 +792,7 @@ if there is a blurb section you need to:        comp_obj_para.bullet                = bullet;        the_blurb_section                   ~= comp_obj_para;      } -    obj_type_status["ocn_status"] = TriState.off; +    obj_type_status["ocn_status"] = OCNstatus.inc;    }    continue;  #+END_SRC @@ -878,7 +880,7 @@ if (line.matchFirst(rgx.block_poem_open)) {    /+ poem to verse exceptions! +/    object_reset(an_object);    processing.remove("verse"); -  obj_cite_number_poem["start"] = obj_cite_number.to!string; +  obj_cite_number_poem["start"] = obj_cite_digit.to!string;  }  _start_block_(line, obj_type_status, obj_cite_number_poem);  continue; @@ -1031,7 +1033,7 @@ _block_flag_line_empty_(    an_object,    the_document_body_section,    bookindex_unordered_hashes, -  obj_cite_number, +  obj_cite_digit,    comp_obj_heading,    cntr,    obj_type_status, @@ -1063,9 +1065,9 @@ assert(  if ((obj_type_status["heading"] == State.on)  && (line_occur["heading"] > State.off)) {    /+ heading object (current line empty) +/ -  obj_cite_number = (an_object["lev_markup_number"].to!int == 0) -  ? (ocn_emit(3)) -  : (obj_cite_number = ocn_emit(obj_type_status["ocn_status"])); +  obj_cite_digit = (an_object["lev_markup_number"].to!int == 0) +  ? (ocn_emit(OCNstatus.reset)) +  : (obj_cite_digit = ocn_emit(obj_type_status["ocn_status"]));    an_object["is"] = "heading";    an_object_key="body_nugget";    auto substantive_object_and_anchor_tags_tuple = @@ -1078,7 +1080,7 @@ if ((obj_type_status["heading"] == State.on)      anchor_tag_ = anchor_tags[0];    } else if (an_object["lev_markup_number"].to!int > 4) {      segment_anchor_tag_that_object_belongs_to = anchor_tag_; -    segment_anchor_tag_that_object_belongs_to_uri = anchor_tag_ ~ ".fnSuffix#" ~ obj_cite_number.to!string; +    segment_anchor_tag_that_object_belongs_to_uri = anchor_tag_ ~ ".fnSuffix#" ~ obj_cite_digit.to!string;    } else if (an_object["lev_markup_number"].to!int < 4) {    string segn;      switch (an_object["lev_markup_number"].to!int) { @@ -1106,9 +1108,9 @@ if ((obj_type_status["heading"] == State.on)    an_object["bookindex_nugget"] =      ("bookindex_nugget" in an_object) ? an_object["bookindex_nugget"] : "";    bookindex_unordered_hashes = -    bookindex_extract_hash.bookindex_nugget_hash(an_object["bookindex_nugget"], obj_cite_number, segment_anchor_tag_that_object_belongs_to); +    bookindex_extract_hash.bookindex_nugget_hash(an_object["bookindex_nugget"], obj_cite_digit, segment_anchor_tag_that_object_belongs_to);    /+ (incrementally build toc) table of contents here! +/ -  _anchor_tag=to!string(obj_cite_number); +  _anchor_tag=to!string(obj_cite_digit);    the_table_of_contents_section = obj_im.table_of_contents_gather_headings(      an_object,      dochead_make_aa, @@ -1129,7 +1131,7 @@ if ((obj_type_status["heading"] == State.on)        an_object["lev_markup_number"],               // string        an_object["lev_collapsed_number"],            // string        segment_anchor_tag_that_object_belongs_to,    // string -      obj_cite_number,                              // int +      obj_cite_digit,                               // int        cntr,                                         // int        heading_ptr,                                  // int        lv_ancestors_txt,                             // string[] @@ -1162,17 +1164,17 @@ if ((obj_type_status["heading"] == State.on)  } else if ((obj_type_status["para"] == State.on)  && (line_occur["para"] > State.off)) {    /+ paragraph object (current line empty) +/ -  obj_cite_number = ocn_emit(obj_type_status["ocn_status"]); +  obj_cite_digit = ocn_emit(obj_type_status["ocn_status"]);    an_object["bookindex_nugget"] =      ("bookindex_nugget" in an_object) ? an_object["bookindex_nugget"] : "";    bookindex_unordered_hashes = -    bookindex_extract_hash.bookindex_nugget_hash(an_object["bookindex_nugget"], obj_cite_number, segment_anchor_tag_that_object_belongs_to); +    bookindex_extract_hash.bookindex_nugget_hash(an_object["bookindex_nugget"], obj_cite_digit, segment_anchor_tag_that_object_belongs_to);    an_object["is"] = "para";    auto comp_obj_heading =      node_construct.node_location_emitter(        content_non_header,        segment_anchor_tag_that_object_belongs_to, -      obj_cite_number, +      obj_cite_digit,        cntr,        heading_ptr-1,        an_object["is"], @@ -1187,8 +1189,8 @@ if ((obj_type_status["heading"] == State.on)    comp_obj_para.is_of                 = "para";    comp_obj_para.is_a                  = "para";    comp_obj_para.text                  = an_object["substantive"].to!string.strip; -  comp_obj_para.ocn                   = obj_cite_number; -  comp_obj_para.obj_cite_number       = (obj_cite_number==0) ? "" : obj_cite_number.to!string; +  comp_obj_para.ocn                   = obj_cite_digit; +  comp_obj_para.obj_cite_number       = (obj_cite_digit==0) ? "" : obj_cite_digit.to!string;    comp_obj_para.indent_hang           = indent["hang_position"];    comp_obj_para.indent_base           = indent["base_position"];    comp_obj_para.bullet                = bullet; @@ -1242,7 +1244,7 @@ if (the_document_body_section.length > 0) {              note_section.gather_notes_for_endnote_section(                the_document_body_section,                segment_anchor_tag_that_object_belongs_to, -              to!int(i), +              (i).to!int,              );            }          } @@ -1257,7 +1259,7 @@ if (the_document_body_section.length > 0) {          note_section.gather_notes_for_endnote_section(            the_document_body_section,            segment_anchor_tag_that_object_belongs_to, -          to!int(the_document_body_section.length-1), +          (the_document_body_section.length-1).to!int,          );        }      } @@ -1284,10 +1286,10 @@ if (the_document_body_section.length > 0) {  #+name: abs_post  #+BEGIN_SRC d  auto en_tuple = -  note_section.endnote_objects(obj_cite_number, opt_action); +  note_section.endnote_objects(obj_cite_digit, opt_action);  static assert(!isTypeTuple!(en_tuple));  auto the_endnotes_section = en_tuple[0]; -obj_cite_number = en_tuple[1]; +obj_cite_digit = en_tuple[1];  debug(endnotes) {    writefln(      "%s %s", @@ -1476,13 +1478,13 @@ auto bi = BookIndexReportSection();  auto bi_tuple =    bi.bookindex_build_abstraction_section(      bookindex_unordered_hashes, -    obj_cite_number, +    obj_cite_digit,      opt_action,    );  destroy(bookindex_unordered_hashes);  static assert(!isTypeTuple!(bi_tuple));  auto the_bookindex_section = bi_tuple[0]; -obj_cite_number = bi_tuple[1]; +obj_cite_digit = bi_tuple[1];  debug(bookindex) {    foreach (bi_entry; the_bookindex_section["seg"]) {      writeln(bi_entry); @@ -1997,6 +1999,9 @@ if (the_glossary_section.length > 1) {        debug(dom) {          writeln(obj.text);        } +      obj_cite_digit = ocn_emit(OCNstatus.inc); +      obj.ocn = obj_cite_digit; +      obj.obj_cite_number = obj_cite_digit.to!string;        if (obj.heading_lev_markup <= 4) {          segnames_0_4 ~= obj.segment_anchor_tag;          if (obj.heading_lev_markup == 4) { @@ -2018,6 +2023,10 @@ if (the_glossary_section.length > 1) {          obj = obj_dom_set_collapsed_tags(obj, dom_collapsed, obj.heading_lev_collapsed);        }        obj = obj_heading_ancestors(obj, lv_ancestors_txt); +    } else if (obj.is_a == "glossary") { +      obj_cite_digit = ocn_emit(OCNstatus.inc); +      obj.ocn = obj_cite_digit; +      obj.obj_cite_number = obj_cite_digit.to!string;      }    }  } @@ -2034,6 +2043,9 @@ if (the_bibliography_section.length > 1) {        debug(dom) {          writeln(obj.text);        } +      obj_cite_digit = ocn_emit(OCNstatus.inc); +      obj.ocn = obj_cite_digit; +      obj.obj_cite_number = obj_cite_digit.to!string;        if (obj.heading_lev_markup <= 4) {          segnames_0_4 ~= obj.segment_anchor_tag;          if (obj.heading_lev_markup == 4) { @@ -2055,6 +2067,10 @@ if (the_bibliography_section.length > 1) {          obj = obj_dom_set_collapsed_tags(obj, dom_collapsed, obj.heading_lev_collapsed);        }        obj = obj_heading_ancestors(obj, lv_ancestors_txt); +    } else if (obj.is_a == "bibliography") { +      obj_cite_digit = ocn_emit(OCNstatus.inc); +      obj.ocn = obj_cite_digit; +      obj.obj_cite_number = obj_cite_digit.to!string;      }    }  } @@ -2065,6 +2081,9 @@ if (the_bibliography_section.length > 1) {  #+name: abs_post  #+BEGIN_SRC d  /+ optional only one 1~ level +/ +int ocn_ = obj_cite_digit; +int ocn_bkidx_ = 0; +int ocn_bidx_;  if (the_bookindex_section["scroll"].length > 1) {    /+ scroll +/    dom_markedup_buffer = dom_markedup.dup; @@ -2073,6 +2092,9 @@ if (the_bookindex_section["scroll"].length > 1) {      if (obj.is_a == "heading") {        debug(dom) {        } +      obj_cite_digit = ocn_emit(OCNstatus.inc); +      obj.ocn = obj_cite_digit; +      obj.obj_cite_number = obj_cite_digit.to!string;        if (obj.heading_lev_markup <= 4) {          segnames_0_4 ~= obj.segment_anchor_tag;          if (obj.heading_lev_markup == 4) { @@ -2094,6 +2116,10 @@ if (the_bookindex_section["scroll"].length > 1) {          obj = obj_dom_set_collapsed_tags(obj, dom_collapsed, obj.heading_lev_collapsed);        }        obj = obj_heading_ancestors(obj, lv_ancestors_txt); +    } else if (obj.is_a == "bookindex") { +      obj_cite_digit_bkidx = ocn_emit(OCNstatus.bkidx); +      obj.obj_cite_number_bkidx = obj_cite_digit_bkidx.to!string; // FIX need to distinguish from regular ocn +      obj.obj_cite_number_type = OCNtype.bkidx;      }    }    /+ seg +/ @@ -2104,6 +2130,8 @@ if (the_bookindex_section["scroll"].length > 1) {        debug(dom) {          writeln(obj.text);        } +      obj.ocn = ++ocn_; +      obj.obj_cite_number = obj.ocn.to!string;        if (obj.heading_lev_markup <= 4) {          segnames_0_4 ~= obj.segment_anchor_tag;          if (obj.heading_lev_markup == 4) { @@ -2125,8 +2153,14 @@ if (the_bookindex_section["scroll"].length > 1) {          obj = obj_dom_set_collapsed_tags(obj, dom_collapsed, obj.heading_lev_collapsed);        }        obj = obj_heading_ancestors(obj, lv_ancestors_txt); +    } else if (obj.is_a == "bookindex") { +      ocn_bidx_ = ++ocn_bkidx_; +      obj.obj_cite_number_bkidx = ocn_bidx_.to!string; // FIX need to distinguish from regular ocn +      obj.obj_cite_number_type = OCNtype.bkidx;      }    } +  assert(obj_cite_digit == ocn_); +  assert(obj_cite_digit_bkidx == ocn_bidx_);  }  #+END_SRC @@ -2141,6 +2175,9 @@ if (the_blurb_section.length > 1) {        debug(dom) {          writeln(obj.text);        } +      obj_cite_digit = ocn_emit(OCNstatus.inc); +      obj.ocn = obj_cite_digit; +      obj.obj_cite_number = obj_cite_digit.to!string;        if (obj.heading_lev_markup <= 4) {          segnames_0_4 ~= obj.segment_anchor_tag;          if (obj.heading_lev_markup == 4) { @@ -2162,6 +2199,10 @@ if (the_blurb_section.length > 1) {          obj = obj_dom_set_collapsed_tags(obj, dom_collapsed, obj.heading_lev_collapsed);        }        obj = obj_heading_ancestors(obj, lv_ancestors_txt); +    } else if (obj.is_a == "blurb") { +      obj_cite_digit = ocn_emit(OCNstatus.exc); +      obj.obj_cite_number_non = obj_cite_digit.to!string; +      obj.obj_cite_number_type = OCNtype.non;      }    }  } @@ -2288,8 +2329,8 @@ destroy(html_segnames);  destroy(bookindex_unordered_hashes);  destroy(an_object);  biblio_arr_json = []; -obj_cite_number=0; -obj_cite_number_=0; +obj_cite_digit=0; +obj_cite_digit_=0;  html_segnames_ptr=0;  html_segnames_ptr_cntr=0;  content_non_header = "8"; @@ -2389,11 +2430,11 @@ static auto _check_ocn_status_(L,T)(      } else {        if (obj_type_status["ocn_status_off_for_multiple_objects"] == TriState.off) {          if (line.matchFirst(rgx.obj_cite_number_off)) { -          obj_type_status["ocn_status"] = TriState.on; +          obj_type_status["ocn_status"] = OCNstatus.exc;          } else if (line.matchFirst(rgx.obj_cite_number_off_dh)) { -          obj_type_status["ocn_status"] = TriState.closing; +          obj_type_status["ocn_status"] = OCNstatus.closing;          } else { -          obj_type_status["ocn_status"] = TriState.off; +          obj_type_status["ocn_status"] = OCNstatus.inc;          }        } else {          obj_type_status["ocn_status"] = @@ -2403,7 +2444,7 @@ static auto _check_ocn_status_(L,T)(    } else if ((!line.empty) && (obj_type_status["ocn_status_off_for_multiple_objects"] > TriState.off)) {      if (line.matchFirst(rgx.obj_cite_number_off_block_close)) {        obj_type_status["ocn_status_off_for_multiple_objects"] = TriState.off; -      obj_type_status["ocn_status"]                          = TriState.off; +      obj_type_status["ocn_status"]                          = OCNstatus.inc;        debug(ocnoff) {          writeln(line);        } @@ -2460,7 +2501,7 @@ void _start_block_(L,T,N)(        );      }      obj_cite_number_poem["start"] = -      obj_cite_number.to!string; +      obj_cite_digit.to!string;      obj_type_status["blocks"]     = TriState.on;      obj_type_status["verse_new"]  = State.on;      obj_type_status["poem"]       = TriState.on; @@ -2545,7 +2586,7 @@ void _start_block_(L,T,N)(          line        );      } -    obj_cite_number_poem["start"] = obj_cite_number.to!string; +    obj_cite_number_poem["start"] = obj_cite_digit.to!string;      obj_type_status["blocks"]    = TriState.on;      obj_type_status["verse_new"] = State.on;      obj_type_status["poem"]      = TriState.on; @@ -3072,14 +3113,14 @@ void _poem_block_(L,O,T,C,N,Ma)(            writeln(__LINE__);            writefln(              "* %s %s", -            obj_cite_number, +            obj_cite_digit,              line            );          }          if (an_object.length > 0) {            debug(poem) {                             // poem (curly) close              writeln( -              obj_cite_number, +              obj_cite_digit,                an_object[an_object_key]              );            } @@ -3093,8 +3134,8 @@ void _poem_block_(L,O,T,C,N,Ma)(            comp_obj_block.of_section                 = "body";            comp_obj_block.is_of                      = "block";            comp_obj_block.is_a                       = "verse"; -          comp_obj_block.ocn                        = obj_cite_number; -          comp_obj_block.obj_cite_number            = (obj_cite_number==0) ? "" : obj_cite_number.to!string; +          comp_obj_block.ocn                        = obj_cite_digit; +          comp_obj_block.obj_cite_number            = (obj_cite_digit==0) ? "" : obj_cite_digit.to!string;            comp_obj_block.text                       = an_object["substantive"];            comp_obj_block.inline_notes_reg           = substantive_obj_misc_tuple[sObj.notes_reg];            comp_obj_block.inline_notes_star          = substantive_obj_misc_tuple[sObj.notes_star]; @@ -3106,14 +3147,14 @@ void _poem_block_(L,O,T,C,N,Ma)(          ++cntr;        }        obj_cite_number_poem["end"] = -        obj_cite_number.to!string; +        obj_cite_digit.to!string;        obj_type_status["blocks"]     = TriState.closing;        obj_type_status["poem"]       = TriState.closing;        obj_type_status["curly_poem"] = TriState.off;      } else {        processing["verse"] ~= line ~= "\n";        if (obj_type_status["verse_new"] == State.on) { -        obj_cite_number = +        obj_cite_digit =            ocn_emit(obj_type_status["ocn_status"]);          obj_type_status["verse_new"] = State.off;        } else if (line.matchFirst(rgx.newline_eol_delimiter_only)) { @@ -3127,7 +3168,7 @@ void _poem_block_(L,O,T,C,N,Ma)(          debug(poem) {                          // poem verse            writefln(              "* %s curly\n%s", -            obj_cite_number, +            obj_cite_digit,              an_object[an_object_key]            );          } @@ -3136,7 +3177,7 @@ void _poem_block_(L,O,T,C,N,Ma)(          auto comp_obj_location = node_construct.node_location_emitter(            content_non_header,            segment_anchor_tag_that_object_belongs_to, -          obj_cite_number, +          obj_cite_digit,            cntr,            heading_ptr-1,            an_object["is"] @@ -3150,8 +3191,8 @@ void _poem_block_(L,O,T,C,N,Ma)(          comp_obj_block.of_section                 = "body";          comp_obj_block.is_of                      = "block";          comp_obj_block.is_a                       = "verse"; -        comp_obj_block.ocn                        = obj_cite_number; -        comp_obj_block.obj_cite_number            = (obj_cite_number==0) ? "" : obj_cite_number.to!string; +        comp_obj_block.ocn                        = obj_cite_digit; +        comp_obj_block.obj_cite_number            = (obj_cite_digit==0) ? "" : obj_cite_digit.to!string;          comp_obj_block.text                       = an_object["substantive"];          comp_obj_block.inline_notes_reg           = substantive_obj_misc_tuple[sObj.notes_reg];          comp_obj_block.inline_notes_star          = substantive_obj_misc_tuple[sObj.notes_star]; @@ -3177,7 +3218,7 @@ void _poem_block_(L,O,T,C,N,Ma)(        if (an_object.length > 0) {          debug(poem) {                                     // poem (tic) close            writeln(__LINE__); -          writeln(obj_cite_number, line); +          writeln(obj_cite_digit, line);          }          processing.remove("verse");          an_object["is"]                           = "verse"; @@ -3190,14 +3231,14 @@ void _poem_block_(L,O,T,C,N,Ma)(          comp_obj_block.of_section                 = "body";          comp_obj_block.is_of                      = "block";          comp_obj_block.is_a                       = "verse"; -        comp_obj_block.ocn                        = obj_cite_number; -        comp_obj_block.obj_cite_number            = (obj_cite_number==0) ? "" : obj_cite_number.to!string; +        comp_obj_block.ocn                        = obj_cite_digit; +        comp_obj_block.obj_cite_number            = (obj_cite_digit==0) ? "" : obj_cite_digit.to!string;          comp_obj_block.text                       = an_object["substantive"];          comp_obj_block.inline_notes_reg           = substantive_obj_misc_tuple[sObj.notes_reg];          comp_obj_block.inline_notes_star          = substantive_obj_misc_tuple[sObj.notes_star];          comp_obj_block.inline_links               = substantive_obj_misc_tuple[sObj.links];          the_document_body_section                 ~= comp_obj_block; -        obj_cite_number_poem["end"]               = obj_cite_number.to!string; +        obj_cite_number_poem["end"]               = obj_cite_digit.to!string;          object_reset(an_object);          processing.remove("verse");          ++cntr; @@ -3208,7 +3249,7 @@ void _poem_block_(L,O,T,C,N,Ma)(      } else {        processing["verse"] ~= line ~= "\n";        if (obj_type_status["verse_new"] == State.on) { -        obj_cite_number = +        obj_cite_digit =            ocn_emit(obj_type_status["ocn_status"]);          obj_type_status["verse_new"] = State.off;        } else if (line.matchFirst(rgx.newline_eol_delimiter_only)) { @@ -3222,7 +3263,7 @@ void _poem_block_(L,O,T,C,N,Ma)(          debug(poem) {                            // poem (tic) close            writefln(              "* %s tic\n%s", -            obj_cite_number, +            obj_cite_digit,              an_object[an_object_key]            );          } @@ -3232,7 +3273,7 @@ void _poem_block_(L,O,T,C,N,Ma)(            node_construct.node_location_emitter(              content_non_header,              segment_anchor_tag_that_object_belongs_to, -            obj_cite_number, +            obj_cite_digit,              cntr,              heading_ptr-1,              an_object["is"] @@ -3246,8 +3287,8 @@ void _poem_block_(L,O,T,C,N,Ma)(          comp_obj_block.of_section                 = "body";          comp_obj_block.is_of                      = "block";          comp_obj_block.is_a                       = "verse"; -        comp_obj_block.ocn                        = obj_cite_number; -        comp_obj_block.obj_cite_number            = (obj_cite_number==0) ? "" : obj_cite_number.to!string; +        comp_obj_block.ocn                        = obj_cite_digit; +        comp_obj_block.obj_cite_number            = (obj_cite_digit==0) ? "" : obj_cite_digit.to!string;          comp_obj_block.text                       = an_object["substantive"];          comp_obj_block.inline_notes_reg           = substantive_obj_misc_tuple[sObj.notes_reg];          comp_obj_block.inline_notes_star          = substantive_obj_misc_tuple[sObj.notes_star]; @@ -3317,7 +3358,7 @@ void _table_block_(L,O,T,Ma)(          line,          an_object,          the_document_body_section, -        obj_cite_number, +        obj_cite_digit,          comp_obj_heading,          cntr,          obj_type_status, @@ -3361,20 +3402,20 @@ void _table_closed_make_special_notation_table_(    char[]                           line,    return ref string[string]        an_object,    return ref ObjGenericComposite[] the_document_body_section, -  return ref int                   obj_cite_number, +  return ref int                   obj_cite_digit,    return ref ObjGenericComposite   _comp_obj_heading,    return ref int                   cntr,    return ref int[string]           obj_type_status,    string[string][string]           dochead_make_aa,  ) {      comp_obj_block = comp_obj_block.init; -    obj_cite_number = +    obj_cite_digit =        ocn_emit(obj_type_status["ocn_status"]);      auto comp_obj_location =        node_construct.node_location_emitter(          content_non_header,          segment_anchor_tag_that_object_belongs_to, -        obj_cite_number, +        obj_cite_digit,          cntr,          heading_ptr-1,          "table" @@ -3383,8 +3424,8 @@ void _table_closed_make_special_notation_table_(      auto substantive_obj_misc_tuple =        obj_im.obj_inline_markup_and_anchor_tags_and_misc(an_object, "body_nugget", dochead_make_aa);      an_object["substantive"]         = substantive_obj_misc_tuple[sObj.content]; -    comp_obj_block.ocn               = obj_cite_number; -    comp_obj_block.obj_cite_number   = (obj_cite_number==0) ? "" : obj_cite_number.to!string; +    comp_obj_block.ocn               = obj_cite_digit; +    comp_obj_block.obj_cite_number   = (obj_cite_digit==0) ? "" : obj_cite_digit.to!string;      comp_obj_block                   = table_instructions(comp_obj_block, an_object["table_head"]);      comp_obj_block                   = table_substantive_munge_special(comp_obj_block, an_object["substantive"]);      the_document_body_section        ~= comp_obj_block; @@ -3406,7 +3447,7 @@ void _block_flag_line_empty_(B)(    return ref string[string]           an_object,    return ref ObjGenericComposite[]    the_document_body_section,    return ref string[][string][string] bookindex_unordered_hashes, -  return ref int                      obj_cite_number, +  return ref int                      obj_cite_digit,    return ref ObjGenericComposite      _comp_obj_heading,    return ref int                      cntr,    return ref int[string]              obj_type_status, @@ -3430,14 +3471,14 @@ void _block_flag_line_empty_(B)(  #+name: abs_functions_block_line_status_empty  #+BEGIN_SRC d    if (obj_type_status["quote"] == TriState.closing) { -    obj_cite_number = +    obj_cite_digit =        ocn_emit(obj_type_status["ocn_status"]);      an_object["bookindex_nugget"] =        ("bookindex_nugget" in an_object) ? an_object["bookindex_nugget"] : "";      bookindex_unordered_hashes =        bookindex_extract_hash.bookindex_nugget_hash(          an_object["bookindex_nugget"], -        obj_cite_number, +        obj_cite_digit,          segment_anchor_tag_that_object_belongs_to        );      an_object["is"] = "quote"; @@ -3445,7 +3486,7 @@ void _block_flag_line_empty_(B)(        node_construct.node_location_emitter(          content_non_header,          segment_anchor_tag_that_object_belongs_to, -        obj_cite_number, +        obj_cite_digit,          cntr,          heading_ptr-1,          an_object["is"] @@ -3459,8 +3500,8 @@ void _block_flag_line_empty_(B)(      comp_obj_block.of_section                 = "body";      comp_obj_block.is_of                      = "block";      comp_obj_block.is_a                       = "quote"; -    comp_obj_block.ocn                        = obj_cite_number; -    comp_obj_block.obj_cite_number            = (obj_cite_number==0) ? "" : obj_cite_number.to!string; +    comp_obj_block.ocn                        = obj_cite_digit; +    comp_obj_block.obj_cite_number            = (obj_cite_digit==0) ? "" : obj_cite_digit.to!string;      comp_obj_block.text                       = an_object["substantive"];      comp_obj_block.inline_notes_reg           = substantive_obj_misc_tuple[sObj.notes_reg];      comp_obj_block.inline_notes_star          = substantive_obj_misc_tuple[sObj.notes_star]; @@ -3478,14 +3519,14 @@ void _block_flag_line_empty_(B)(  #+name: abs_functions_block_line_status_empty  #+BEGIN_SRC d    } else if (obj_type_status["group"] == TriState.closing) { -    obj_cite_number = +    obj_cite_digit =        ocn_emit(obj_type_status["ocn_status"]);      an_object["bookindex_nugget"] =        ("bookindex_nugget" in an_object) ? an_object["bookindex_nugget"] : "";      bookindex_unordered_hashes =        bookindex_extract_hash.bookindex_nugget_hash(          an_object["bookindex_nugget"], -        obj_cite_number, +        obj_cite_digit,          segment_anchor_tag_that_object_belongs_to        );      an_object["is"] = "group"; @@ -3493,7 +3534,7 @@ void _block_flag_line_empty_(B)(        node_construct.node_location_emitter(          content_non_header,          segment_anchor_tag_that_object_belongs_to, -        obj_cite_number, +        obj_cite_digit,          cntr,          heading_ptr-1,          an_object["is"] @@ -3507,8 +3548,8 @@ void _block_flag_line_empty_(B)(      comp_obj_block.of_section                 = "body";      comp_obj_block.is_of                      = "block";      comp_obj_block.is_a                       = "group"; -    comp_obj_block.ocn                        = obj_cite_number; -    comp_obj_block.obj_cite_number            = (obj_cite_number==0) ? "" : obj_cite_number.to!string; +    comp_obj_block.ocn                        = obj_cite_digit; +    comp_obj_block.obj_cite_number            = (obj_cite_digit==0) ? "" : obj_cite_digit.to!string;      comp_obj_block.text                       = an_object["substantive"];      comp_obj_block.inline_notes_reg           = substantive_obj_misc_tuple[sObj.notes_reg];      comp_obj_block.inline_notes_star          = substantive_obj_misc_tuple[sObj.notes_star]; @@ -3526,13 +3567,13 @@ void _block_flag_line_empty_(B)(  #+name: abs_functions_block_line_status_empty  #+BEGIN_SRC d    } else if (obj_type_status["block"] == TriState.closing) { -    obj_cite_number = ocn_emit(obj_type_status["ocn_status"]); +    obj_cite_digit = ocn_emit(obj_type_status["ocn_status"]);      an_object["bookindex_nugget"] =        ("bookindex_nugget" in an_object) ? an_object["bookindex_nugget"] : "";      bookindex_unordered_hashes =        bookindex_extract_hash.bookindex_nugget_hash(          an_object["bookindex_nugget"], -        obj_cite_number, +        obj_cite_digit,          segment_anchor_tag_that_object_belongs_to        );      an_object["is"] = "block"; @@ -3540,7 +3581,7 @@ void _block_flag_line_empty_(B)(        node_construct.node_location_emitter(          content_non_header,          segment_anchor_tag_that_object_belongs_to, -        obj_cite_number, +        obj_cite_digit,          cntr,          heading_ptr-1,          an_object["is"] @@ -3553,8 +3594,8 @@ void _block_flag_line_empty_(B)(      comp_obj_block.of_section                 = "body";      comp_obj_block.is_of                      = "block";      comp_obj_block.is_a                       = "block"; -    comp_obj_block.ocn                        = obj_cite_number; -    comp_obj_block.obj_cite_number            = (obj_cite_number==0) ? "" : obj_cite_number.to!string; +    comp_obj_block.ocn                        = obj_cite_digit; +    comp_obj_block.obj_cite_number            = (obj_cite_digit==0) ? "" : obj_cite_digit.to!string;      comp_obj_block.text                       = an_object["substantive"];      comp_obj_block.inline_notes_reg           = substantive_obj_misc_tuple[sObj.notes_reg];      comp_obj_block.inline_notes_star          = substantive_obj_misc_tuple[sObj.notes_star]; @@ -3577,7 +3618,7 @@ void _block_flag_line_empty_(B)(      bookindex_unordered_hashes =        bookindex_extract_hash.bookindex_nugget_hash(          an_object["bookindex_nugget"], -        obj_cite_number, +        obj_cite_digit,          segment_anchor_tag_that_object_belongs_to        );      an_object["is"]                           = "verse"; @@ -3585,7 +3626,7 @@ void _block_flag_line_empty_(B)(        node_construct.node_location_emitter(          content_non_header,          segment_anchor_tag_that_object_belongs_to, -        obj_cite_number, +        obj_cite_digit,          cntr,          heading_ptr-1,          an_object["is"] @@ -3595,7 +3636,7 @@ void _block_flag_line_empty_(B)(      comp_obj_poem_ocn.of_section              = "body";      comp_obj_poem_ocn.is_of                   = "block";      comp_obj_poem_ocn.is_a                    = "poem"; -    comp_obj_poem_ocn.ocn                     = obj_cite_number; +    comp_obj_poem_ocn.ocn                     = obj_cite_digit;      comp_obj_poem_ocn.obj_cite_number         = (obj_cite_number_poem["start"], obj_cite_number_poem["end"]);      comp_obj_poem_ocn.text                    = "";      the_document_body_section                 ~= comp_obj_poem_ocn; @@ -3610,14 +3651,14 @@ void _block_flag_line_empty_(B)(  #+name: abs_functions_block_line_status_empty  #+BEGIN_SRC d    } else if (obj_type_status["code"] == TriState.closing) { -    obj_cite_number = +    obj_cite_digit =        ocn_emit(obj_type_status["ocn_status"]);      an_object["bookindex_nugget"] =        ("bookindex_nugget" in an_object) ? an_object["bookindex_nugget"] : "";      bookindex_unordered_hashes =        bookindex_extract_hash.bookindex_nugget_hash(          an_object["bookindex_nugget"], -        obj_cite_number, +        obj_cite_digit,          segment_anchor_tag_that_object_belongs_to        );      an_object["is"] = "code"; @@ -3625,7 +3666,7 @@ void _block_flag_line_empty_(B)(        node_construct.node_location_emitter(          content_non_header,          segment_anchor_tag_that_object_belongs_to, -        obj_cite_number, +        obj_cite_digit,          cntr,          heading_ptr-1,          an_object["is"] @@ -3639,8 +3680,8 @@ void _block_flag_line_empty_(B)(      comp_obj_code.of_section                  = "body";      comp_obj_code.is_of                       = "block";      comp_obj_code.is_a                        = "code"; -    comp_obj_code.ocn                         = obj_cite_number; -    comp_obj_code.obj_cite_number             = (obj_cite_number==0) ? "" : obj_cite_number.to!string; +    comp_obj_code.ocn                         = obj_cite_digit; +    comp_obj_code.obj_cite_number             = (obj_cite_digit==0) ? "" : obj_cite_digit.to!string;      comp_obj_code.text                        = an_object["substantive"];      comp_obj_code.inline_notes_reg            = substantive_obj_misc_tuple[sObj.notes_reg];      comp_obj_code.inline_notes_star           = substantive_obj_misc_tuple[sObj.notes_star]; @@ -3659,14 +3700,14 @@ void _block_flag_line_empty_(B)(  #+BEGIN_SRC d    } else if (obj_type_status["table"] == TriState.closing) {      comp_obj_block = comp_obj_block.init; -    obj_cite_number = +    obj_cite_digit =        ocn_emit(obj_type_status["ocn_status"]);      an_object["bookindex_nugget"] =        ("bookindex_nugget" in an_object) ? an_object["bookindex_nugget"] : "";      bookindex_unordered_hashes =        bookindex_extract_hash.bookindex_nugget_hash(          an_object["bookindex_nugget"], -        obj_cite_number, +        obj_cite_digit,          segment_anchor_tag_that_object_belongs_to        );      an_object["is"] = "table"; @@ -3674,7 +3715,7 @@ void _block_flag_line_empty_(B)(        node_construct.node_location_emitter(          content_non_header,          segment_anchor_tag_that_object_belongs_to, -        obj_cite_number, +        obj_cite_digit,          cntr,          heading_ptr-1,          an_object["is"] @@ -3683,8 +3724,8 @@ void _block_flag_line_empty_(B)(        obj_im.obj_inline_markup_and_anchor_tags_and_misc(an_object, an_object_key, dochead_make_aa);      an_object["substantive"] = substantive_obj_misc_tuple[sObj.content];      comp_obj_block                            = comp_obj_block.init; -    comp_obj_block.ocn                        = obj_cite_number; -    comp_obj_block.obj_cite_number            = (obj_cite_number==0) ? "" : obj_cite_number.to!string; +    comp_obj_block.ocn                        = obj_cite_digit; +    comp_obj_block.obj_cite_number            = (obj_cite_digit==0) ? "" : obj_cite_digit.to!string;      comp_obj_block = table_instructions(comp_obj_block, an_object["table_head"]);      comp_obj_block = table_substantive_munge(comp_obj_block, an_object["substantive"]);      the_document_body_section                 ~= comp_obj_block; @@ -4426,19 +4467,31 @@ auto table_substantive_munge_special(O,T)(  #+name: meta_emitters_ocn  #+BEGIN_SRC d  pure struct OCNemitter { -  int obj_cite_number, obj_cite_number_; +  int ocn_, ocn_in, ocn_in_, ocn_out_, ocn_bkidx_;    int ocn_emitter(int ocn_status_flag) -  in { assert(ocn_status_flag <= 3); } +  in { assert(ocn_status_flag <= OCNstatus.reset); }    body { -    if (ocn_status_flag == 3) { -      obj_cite_number = obj_cite_number_ = 1; -    } else { -      obj_cite_number=(ocn_status_flag == 0) -      ? ++obj_cite_number_ -      : 0; +    switch(ocn_status_flag) { +    case OCNstatus.reset: +      ocn_ = ocn_in_ = ocn_out_ = 1; +      ocn_bkidx_ = 0; +      break; +    case OCNstatus.inc: +      ocn_ = ++ocn_in_; +      break; +    case OCNstatus.exc: +      ocn_ = ++ocn_out_; +      break; +    case OCNstatus.bkidx: +      ocn_ = ++ocn_bkidx_; +      break; +    case OCNstatus.closing: +      break; +    default: +      ocn_ = 0;      } -    assert(obj_cite_number >= 0); -    return obj_cite_number; +    assert(ocn_ >= 0); +    return ocn_;    }    invariant() {    } @@ -5760,19 +5813,19 @@ struct BookIndexNuggetHash {    string[] bi_main_terms_split_arr;    string[][string][string] bookindex_nugget_hash(BI,N,S)(      BI bookindex_section, -    N  obj_cite_number, +    N  obj_cite_digit,      S  segment_anchor_tag,    )    in {      debug(asserts) {        static assert(is(typeof(bookindex_section) == string)); -      static assert(is(typeof(obj_cite_number)   == int)); +      static assert(is(typeof(obj_cite_digit)   == int));      }      debug(bookindexraw) {        if (!bookindex_section.empty) {          writeln(            "* [bookindex] ", -          "[", obj_cite_number.to!string, ": ", segment_anchor_tag, "] ", bookindex_section +          "[", obj_cite_digit.to!string, ": ", segment_anchor_tag, "] ", bookindex_section          );        }      } @@ -5790,12 +5843,12 @@ struct BookIndexNuggetHash {          ) {            main_term = m.captures[1].strip;            obj_cite_number_offset = m.captures[2].to!int; -          obj_cite_number_endpoint=(obj_cite_number + obj_cite_number_offset); -          obj_cite_numbers ~= (obj_cite_number.to!string ~ "-" ~ to!string(obj_cite_number_endpoint) +          obj_cite_number_endpoint=(obj_cite_digit + obj_cite_number_offset); +          obj_cite_numbers ~= (obj_cite_digit.to!string ~ "-" ~ to!string(obj_cite_number_endpoint)            ~ ":" ~ segment_anchor_tag);          } else {            main_term = bi_main_term_and_rest[0].strip; -          obj_cite_numbers ~= obj_cite_number.to!string +          obj_cite_numbers ~= obj_cite_digit.to!string            ~ ":" ~ segment_anchor_tag;          }          bi[main_term]["_a"] ~= obj_cite_numbers; @@ -5809,12 +5862,12 @@ struct BookIndexNuggetHash {              if (auto m = sub_terms_bits.match(rgx.bi_term_and_obj_cite_numbers_match)) {                sub_term = m.captures[1].strip;                obj_cite_number_offset = m.captures[2].to!int; -              obj_cite_number_endpoint=(obj_cite_number + obj_cite_number_offset); -              obj_cite_numbers ~= (obj_cite_number.to!string ~ " - " ~ to!string(obj_cite_number_endpoint) +              obj_cite_number_endpoint=(obj_cite_digit + obj_cite_number_offset); +              obj_cite_numbers ~= (obj_cite_digit.to!string ~ " - " ~ to!string(obj_cite_number_endpoint)                ~ ":" ~ segment_anchor_tag);              } else {                sub_term = sub_terms_bits.strip; -              obj_cite_numbers ~= to!string(obj_cite_number) +              obj_cite_numbers ~= to!string(obj_cite_digit)                ~ ":" ~ segment_anchor_tag;              }              if (!empty(sub_term)) { @@ -5920,12 +5973,12 @@ struct BookIndexReportSection {  #+BEGIN_SRC d    auto bookindex_build_abstraction_section(BI,N,B)(      BI bookindex_unordered_hashes, -    N  obj_cite_number, +    N  obj_cite_digit,      B  opt_action,    ) {      debug(asserts) {        static assert(is(typeof(bookindex_unordered_hashes)                == string[][string][string])); -      static assert(is(typeof(obj_cite_number)                           == int)); +      static assert(is(typeof(obj_cite_digit)                           == int));        static assert(is(typeof(opt_action)                                == bool[string]));      }      mixin SiSUnode; @@ -5964,7 +6017,6 @@ struct BookIndexReportSection {        comp_obj_heading.inline_links           = true;        bookindex_section["scroll"]             ~= comp_obj_heading_;        bookindex_section["seg"]                ~= comp_obj_heading_; -      ++obj_cite_number;        ++mkn;        comp_obj_heading_                       = comp_obj_heading_.init;        comp_obj_heading_.of_part               = "backmatter"; @@ -5984,7 +6036,6 @@ struct BookIndexReportSection {        comp_obj_heading_.anchor_tags           = ["bookindex"];        bookindex_section["scroll"]             ~= comp_obj_heading_;        bookindex_section["seg"]                ~= comp_obj_heading_; -      ++obj_cite_number;        ++mkn;        import std.array : appender;        auto buffer = appender!(char[])(); @@ -6049,8 +6100,8 @@ struct BookIndexReportSection {          comp_obj_para.is_of                 = "para";          comp_obj_para.is_a                  = "bookindex";          comp_obj_para.text                  = bi_tmp_scroll.to!string.strip; -        comp_obj_para.ocn                   = obj_cite_number; -        comp_obj_para.obj_cite_number       = (obj_cite_number==0) ? "" : to!string(obj_cite_number); +        comp_obj_para.ocn                   = 0; +        comp_obj_para.obj_cite_number       = "";          comp_obj_para.anchor_tags           = bi_tmp_tags;          comp_obj_para.indent_hang           = 0;          comp_obj_para.indent_base           = 1; @@ -6059,7 +6110,6 @@ struct BookIndexReportSection {          bookindex_section["scroll"]         ~= comp_obj_para;          comp_obj_para.text                  = bi_tmp_seg.to!string.strip;          bookindex_section["seg"]            ~= comp_obj_para; -        ++obj_cite_number;          ++mkn;        }      } else {                              // no book index, (figure out what to do here) @@ -6075,7 +6125,7 @@ struct BookIndexReportSection {        bookindex_section["scroll"]             ~= comp_obj_heading_;        bookindex_section["seg"]                ~= comp_obj_heading_;      } -    auto t = tuple(bookindex_section, obj_cite_number); +    auto t = tuple(bookindex_section, obj_cite_digit);      return t;    }  #+END_SRC @@ -6185,7 +6235,7 @@ struct NotesSection {  #+name: meta_emitters_endnotes  #+BEGIN_SRC d    private auto endnote_objects( -    int            obj_cite_number, +    int            obj_cite_digit,      bool[string]   opt_action,    )    in { @@ -6216,7 +6266,7 @@ struct NotesSection {        comp_obj_heading_.parent_ocn            = 1;        comp_obj_heading_.parent_lev_markup     = 0;        the_endnotes_section                    ~= comp_obj_heading_; -      ++obj_cite_number; +      ++obj_cite_digit;        ++mkn;        comp_obj_heading_                       = comp_obj_heading_.init;        comp_obj_heading_.of_part               = "backmatter"; @@ -6234,7 +6284,7 @@ struct NotesSection {        comp_obj_heading_.parent_lev_markup     = 0;        comp_obj_heading_.anchor_tags           = ["endnotes"];        the_endnotes_section                    ~= comp_obj_heading_; -      ++obj_cite_number; +      ++obj_cite_digit;        ++mkn;      } else {        comp_obj_heading_                       = comp_obj_heading_.init; @@ -6274,7 +6324,7 @@ struct NotesSection {          the_endnotes_section                  ~= comp_obj_endnote_;        }      } -    auto t = tuple(the_endnotes_section, obj_cite_number); +    auto t = tuple(the_endnotes_section, obj_cite_digit);      return t;    }  #+END_SRC @@ -6429,7 +6479,7 @@ struct Bibliography {  #+BEGIN_SRC d  struct NodeStructureMetadata {    int lv, lv0, lv1, lv2, lv3, lv4, lv5, lv6, lv7; -  int obj_cite_number; +  int obj_cite_digit;    int[string] p_; // p_ parent_    static auto rgx = Rgx();  #+END_SRC @@ -6441,7 +6491,7 @@ struct NodeStructureMetadata {    ObjGenericComposite node_location_emitter(Lv,Ta,N,C,P,I)(      Lv lev_markup_number,      Ta segment_anchor_tag, -    N  obj_cite_number_, +    N  obj_cite_digit_,      C  cntr_,      P  ptr_,      I  is_ @@ -6450,18 +6500,18 @@ struct NodeStructureMetadata {      debug(asserts) {        static assert(is(typeof(lev_markup_number)  == string));        static assert(is(typeof(segment_anchor_tag) == string)); -      static assert(is(typeof(obj_cite_number_)   == int)); +      static assert(is(typeof(obj_cite_digit_)    == int));        static assert(is(typeof(cntr_)              == int));        static assert(is(typeof(ptr_)               == int));        static assert(is(typeof(is_)                == string));      }      assert(is_ != "heading"); -    assert(obj_cite_number_.to!int >= 0); +    assert(obj_cite_digit_.to!int >= 0);    }    body {      assert(is_ != "heading"); // should not be necessary -    assert(obj_cite_number_.to!int >= 0); // should not be necessary -    int obj_cite_number = obj_cite_number_.to!int; +    assert(obj_cite_digit_.to!int >= 0); // should not be necessary +    int obj_cite_digit = obj_cite_digit_.to!int;      if (lv7 > State.off) {        p_["lev_markup_number"] = DocStructMarkupHeading.h_text_4;        p_["obj_cite_number"] = lv7; @@ -6478,7 +6528,7 @@ struct NodeStructureMetadata {      ObjGenericComposite comp_obj_location;      comp_obj_location                       = comp_obj_location.init;      comp_obj_location.is_a                  = is_; -    comp_obj_location.ocn                   = obj_cite_number_; +    comp_obj_location.ocn                   = obj_cite_digit_;      comp_obj_location.segment_anchor_tag    = segment_anchor_tag.to!string;      comp_obj_location.parent_ocn            = p_["obj_cite_number"];      comp_obj_location.parent_lev_markup     = p_["lev_markup_number"]; @@ -6508,7 +6558,7 @@ struct NodeStructureMetadata {      Lm  lev_markup_number,      Lc  lev_collapsed_number,      Ta  segment_anchor_tag, -    N   obj_cite_number_, +    N   obj_cite_digit_,      C   cntr_,      P   ptr_,      LA  lv_ancestors_txt, @@ -6525,7 +6575,7 @@ struct NodeStructureMetadata {        static assert(is(typeof(lev_markup_number)    == string));        static assert(is(typeof(lev_collapsed_number) == string));        static assert(is(typeof(segment_anchor_tag)   == string)); -      static assert(is(typeof(obj_cite_number_)     == int)); +      static assert(is(typeof(obj_cite_digit_)      == int));        static assert(is(typeof(cntr_)                == int));        static assert(is(typeof(ptr_)                 == int));        static assert(is(typeof(lv_ancestors_txt)     == string[])); @@ -6533,30 +6583,30 @@ struct NodeStructureMetadata {        static assert(is(typeof(html_segnames_ptr)    == int));      }      assert(is_ == "heading"); -    assert(to!int(obj_cite_number_) >= 0); +    assert((obj_cite_digit_).to!int >= 0);      assert(        lev_markup_number.match(rgx.levels_numbered), -      ("not a valid heading level: " ~ lev_markup_number ~ " at " ~ obj_cite_number_.to!string) +      ("not a valid heading level: " ~ lev_markup_number ~ " at " ~ obj_cite_digit_.to!string)      );      if (lev_markup_number.match(rgx.levels_numbered)) {        if (lev_markup_number.to!int == 0) { -        assert(obj_cite_number_.to!int == 1); +        assert(obj_cite_digit_.to!int == 1);        }      }    }    body { -    int obj_cite_number = obj_cite_number_.to!int; +    int obj_cite_digit = obj_cite_digit_.to!int;      switch (lev_markup_number.to!int) {      case 0:        lv = DocStructMarkupHeading.h_sect_A; -      lv0 = obj_cite_number; +      lv0 = obj_cite_digit;        lv1=0; lv2=0; lv3=0; lv4=0; lv5=0; lv6=0; lv7=0;        p_["lev_markup_number"] = 0;        p_["obj_cite_number"] = 0;        break;      case 1:        lv = DocStructMarkupHeading.h_sect_B; -      lv1 = obj_cite_number; +      lv1 = obj_cite_digit;        lv2=0; lv3=0; lv4=0; lv5=0; lv6=0; lv7=0;        p_["lev_markup_number"] =          DocStructMarkupHeading.h_sect_A; @@ -6564,7 +6614,7 @@ struct NodeStructureMetadata {        break;      case 2:        lv = DocStructMarkupHeading.h_sect_C; -      lv2 = obj_cite_number; +      lv2 = obj_cite_digit;        lv3=0; lv4=0; lv5=0; lv6=0; lv7=0;        p_["lev_markup_number"] =          DocStructMarkupHeading.h_sect_B; @@ -6572,7 +6622,7 @@ struct NodeStructureMetadata {        break;      case 3:        lv = DocStructMarkupHeading.h_sect_D; -      lv3=obj_cite_number; +      lv3=obj_cite_digit;        lv4=0; lv5=0; lv6=0; lv7=0;        p_["lev_markup_number"] =          DocStructMarkupHeading.h_sect_C; @@ -6580,7 +6630,7 @@ struct NodeStructureMetadata {        break;      case 4:        lv = DocStructMarkupHeading.h_text_1; -      lv4 = obj_cite_number; +      lv4 = obj_cite_digit;        lv5=0; lv6=0; lv7=0;        if (lv3 > State.off) {          p_["lev_markup_number"] = @@ -6602,7 +6652,7 @@ struct NodeStructureMetadata {        break;      case 5:        lv = DocStructMarkupHeading.h_text_2; -      lv5 = obj_cite_number; +      lv5 = obj_cite_digit;        lv6=0; lv7=0;        p_["lev_markup_number"] =          DocStructMarkupHeading.h_text_1; @@ -6610,7 +6660,7 @@ struct NodeStructureMetadata {        break;      case 6:        lv = DocStructMarkupHeading.h_text_3; -      lv6 = obj_cite_number; +      lv6 = obj_cite_digit;        lv7=0;        p_["lev_markup_number"] =          DocStructMarkupHeading.h_text_2; @@ -6618,7 +6668,7 @@ struct NodeStructureMetadata {        break;      case 7:        lv = DocStructMarkupHeading.h_text_4; -      lv7 = obj_cite_number; +      lv7 = obj_cite_digit;        p_["lev_markup_number"] =          DocStructMarkupHeading.h_text_3;        p_["obj_cite_number"] = lv6; @@ -6633,8 +6683,8 @@ struct NodeStructureMetadata {      _comp_obj_heading_.is_of                     = "para";      _comp_obj_heading_.is_a                      = "heading";      _comp_obj_heading_.text                      = _text.to!string.strip; -    _comp_obj_heading_.ocn                       = obj_cite_number_; -    _comp_obj_heading_.obj_cite_number           = (obj_cite_number==0) ? "" : obj_cite_number.to!string; +    _comp_obj_heading_.ocn                       = obj_cite_digit_; +    _comp_obj_heading_.obj_cite_number           = (obj_cite_digit==0) ? "" : obj_cite_digit.to!string;      _comp_obj_heading_.segment_anchor_tag        = segment_anchor_tag.to!string;      _comp_obj_heading_.marked_up_level           = lev;      _comp_obj_heading_.heading_lev_markup        = (!(lev_markup_number.empty) ? lev_markup_number.to!int : 0); @@ -6987,6 +7037,9 @@ struct ObjGenericComposite {    string                 is_a                         = "";    string                 text                         = "";    string                 obj_cite_number              = ""; +  string                 obj_cite_number_non          = ""; +  string                 obj_cite_number_bkidx        = ""; +  int                    obj_cite_number_type         = 0;    string[]               anchor_tags                  = [];    int                    indent_base                  = 0;    int                    indent_hang                  = 0; diff --git a/org/sdp.org b/org/sdp.org index e06135f..cc9eee2 100644 --- a/org/sdp.org +++ b/org/sdp.org @@ -137,13 +137,13 @@ import  ├── src  │   ├── sdp.d  │   └── sdp -│       ├── meta_metadoc_from_src.d +│       ├── metadoc_from_src.d  │       ├── ...  │       └── compile_time_info.d  └── views      └── version.txt -[[./meta_metadoc_from_src.org][meta_metadoc_from_src]] +[[./meta_abstraction.org][meta_abstraction]]  [[./meta_conf_make_meta.org][meta_conf_make_meta]]  [[./meta_defaults.org][meta_defaults]]  [[./meta_output_debugs.org][meta_output_debugs]] @@ -925,37 +925,37 @@ consider  **** ocn -|-------------+----------------------+-----------------------+--------------+---| -| *objects     | section / part       | ocn described         | how used*     |   | -|-------------+----------------------+-----------------------+--------------+---| -| regular ocn |                      |                       |              |   | -|-------------+----------------------+-----------------------+--------------+---| -|             | body objects         | seq. digit            | anchor       |   | -|             |                      |                       | visible      |   | -|-------------+----------------------+-----------------------+--------------+---| -|             | glossary objects     | seq. digit            | anchor       |   | -|             |                      |                       | not-visible  |   | -|             |                      |                       | (for search) |   | -|-------------+----------------------+-----------------------+--------------+---| -|             | bibliography objects | seq. digit            | anchor       |   | -|             |                      |                       | not-visible  |   | -|             |                      |                       | (for search) |   | -|-------------+----------------------+-----------------------+--------------+---| -| special ocn |                      |                       |              |   | -|-------------+----------------------+-----------------------+--------------+---| -|             | non-substantive text | x char + seq. digit   | anchor       |   | -|             |                      |                       | not-visible  |   | -|             |                      |                       | (for search) |   | -|-------------+----------------------+-----------------------+--------------+---| -|             | book index           | i char + seq. digit   | anchor       |   | -|             |                      |                       | not-visible  |   | -|             |                      |                       | (for search) |   | -|-------------+----------------------+-----------------------+--------------+---| -| exceptions  |                      |                       |              |   | -|-------------+----------------------+-----------------------+--------------+---| -|             | endnotes             | ocn of parent object  | anchor       |   | -|             |                      | + footnote seq. digit | visible      |   | -|-------------+----------------------+-----------------------+--------------+---| +|-------------+-----------------------+-----------------------+----------------+------| +| *objects     | section / part        | ocn described         | how used*       | type | +|-------------+-----------------------+-----------------------+----------------+------| +| regular ocn |                       |                       |                |      | +|-------------+-----------------------+-----------------------+----------------+------| +|             | body objects          | seq. digit            | anchor         | ocn  | +|             |                       | [0-9]+                | visible        |      | +|-------------+-----------------------+-----------------------+----------------+------| +|             | glossary objects      | seq. digit            | anchor         | ocn  | +|             |                       | [0-9]+                | not-visible    |      | +|             |                       |                       | (for search)   |      | +|-------------+-----------------------+-----------------------+----------------+------| +|             | bibliography objects  | seq. digit            | anchor         | ocn  | +|             |                       | [0-9]+                | not-visible    |      | +|             |                       |                       | (for search)   |      | +|-------------+-----------------------+-----------------------+----------------+------| +| special ocn |                       |                       |                |      | +|-------------+-----------------------+-----------------------+----------------+------| +|             | non-substantive text  | x char + seq. digit   | anchor         | non  | +|             | (within body & blurb) | x[0-9]+               | not-visible    |      | +|             |                       |                       | (for search)   |      | +|-------------+-----------------------+-----------------------+----------------+------| +|             | book index            | i char + seq. digit   | anchor         | idx  | +|             |                       | i[0-9]+               | not-visible    |      | +|             |                       |                       | (for search)   |      | +|-------------+-----------------------+-----------------------+----------------+------| +| without ocn |                       |                       |                |      | +|-------------+-----------------------+-----------------------+----------------+------| +|             | endnotes              | ocn of parent object  | no ocn         | fn   | +|             |                       | + footnote seq. digit | anchor visible |      | +|-------------+-----------------------+-----------------------+----------------+------|  ** make config - _composite make_ diff --git a/src/sdp/meta/metadoc_from_src.d b/src/sdp/meta/metadoc_from_src.d index d5ff450..82c6249 100644 --- a/src/sdp/meta/metadoc_from_src.d +++ b/src/sdp/meta/metadoc_from_src.d @@ -47,6 +47,8 @@ template SiSUdocAbstraction() {      h_text_5, // extra level, drop      content_non_header    } // header section A-D; header text 1-4 +  enum OCNstatus { inc, exc, bkidx, closing, reset, } +  enum OCNtype { ocn, non, bkidx, }    /+ biblio variables +/    string biblio_tag_name, biblio_tag_entry, st;    string[] biblio_arr_json; @@ -67,7 +69,7 @@ template SiSUdocAbstraction() {    static auto obj_im = ObjInlineMarkup();    static auto obj_att = ObjAttributes();    /+ ocn +/ -  int obj_cite_number, obj_cite_number_; +  int obj_cite_digit, obj_cite_digit_, obj_cite_digit_bkidx;    auto object_citation_number = OCNemitter();    int[] dom_markedup = [ 0, 0, 0, 0, 0, 0, 0, 0, 0,];    int[] dom_markedup_buffer = [ 0, 0, 0, 0, 0, 0, 0, 0, 0,]; @@ -481,7 +483,7 @@ template SiSUdocAbstraction() {                comp_obj_para.bullet                = bullet;                the_glossary_section                ~= comp_obj_para;              } -            obj_type_status["ocn_status"] = TriState.off; +            obj_type_status["ocn_status"] = OCNstatus.inc;            }            continue;          } else if (line.matchFirst(rgx.heading_blurb) @@ -574,7 +576,7 @@ template SiSUdocAbstraction() {                comp_obj_para.bullet                = bullet;                the_blurb_section                   ~= comp_obj_para;              } -            obj_type_status["ocn_status"] = TriState.off; +            obj_type_status["ocn_status"] = OCNstatus.inc;            }            continue;          } else if (obj_type_status["quote"] == TriState.on) { @@ -621,7 +623,7 @@ template SiSUdocAbstraction() {                /+ poem to verse exceptions! +/                object_reset(an_object);                processing.remove("verse"); -              obj_cite_number_poem["start"] = obj_cite_number.to!string; +              obj_cite_number_poem["start"] = obj_cite_digit.to!string;              }              _start_block_(line, obj_type_status, obj_cite_number_poem);              continue; @@ -730,7 +732,7 @@ template SiSUdocAbstraction() {                an_object,                the_document_body_section,                bookindex_unordered_hashes, -              obj_cite_number, +              obj_cite_digit,                comp_obj_heading,                cntr,                obj_type_status, @@ -751,9 +753,9 @@ template SiSUdocAbstraction() {              if ((obj_type_status["heading"] == State.on)              && (line_occur["heading"] > State.off)) {                /+ heading object (current line empty) +/ -              obj_cite_number = (an_object["lev_markup_number"].to!int == 0) -              ? (ocn_emit(3)) -              : (obj_cite_number = ocn_emit(obj_type_status["ocn_status"])); +              obj_cite_digit = (an_object["lev_markup_number"].to!int == 0) +              ? (ocn_emit(OCNstatus.reset)) +              : (obj_cite_digit = ocn_emit(obj_type_status["ocn_status"]));                an_object["is"] = "heading";                an_object_key="body_nugget";                auto substantive_object_and_anchor_tags_tuple = @@ -766,7 +768,7 @@ template SiSUdocAbstraction() {                  anchor_tag_ = anchor_tags[0];                } else if (an_object["lev_markup_number"].to!int > 4) {                  segment_anchor_tag_that_object_belongs_to = anchor_tag_; -                segment_anchor_tag_that_object_belongs_to_uri = anchor_tag_ ~ ".fnSuffix#" ~ obj_cite_number.to!string; +                segment_anchor_tag_that_object_belongs_to_uri = anchor_tag_ ~ ".fnSuffix#" ~ obj_cite_digit.to!string;                } else if (an_object["lev_markup_number"].to!int < 4) {                string segn;                  switch (an_object["lev_markup_number"].to!int) { @@ -794,9 +796,9 @@ template SiSUdocAbstraction() {                an_object["bookindex_nugget"] =                  ("bookindex_nugget" in an_object) ? an_object["bookindex_nugget"] : "";                bookindex_unordered_hashes = -                bookindex_extract_hash.bookindex_nugget_hash(an_object["bookindex_nugget"], obj_cite_number, segment_anchor_tag_that_object_belongs_to); +                bookindex_extract_hash.bookindex_nugget_hash(an_object["bookindex_nugget"], obj_cite_digit, segment_anchor_tag_that_object_belongs_to);                /+ (incrementally build toc) table of contents here! +/ -              _anchor_tag=to!string(obj_cite_number); +              _anchor_tag=to!string(obj_cite_digit);                the_table_of_contents_section = obj_im.table_of_contents_gather_headings(                  an_object,                  dochead_make_aa, @@ -817,7 +819,7 @@ template SiSUdocAbstraction() {                    an_object["lev_markup_number"],               // string                    an_object["lev_collapsed_number"],            // string                    segment_anchor_tag_that_object_belongs_to,    // string -                  obj_cite_number,                              // int +                  obj_cite_digit,                               // int                    cntr,                                         // int                    heading_ptr,                                  // int                    lv_ancestors_txt,                             // string[] @@ -844,17 +846,17 @@ template SiSUdocAbstraction() {              } else if ((obj_type_status["para"] == State.on)              && (line_occur["para"] > State.off)) {                /+ paragraph object (current line empty) +/ -              obj_cite_number = ocn_emit(obj_type_status["ocn_status"]); +              obj_cite_digit = ocn_emit(obj_type_status["ocn_status"]);                an_object["bookindex_nugget"] =                  ("bookindex_nugget" in an_object) ? an_object["bookindex_nugget"] : "";                bookindex_unordered_hashes = -                bookindex_extract_hash.bookindex_nugget_hash(an_object["bookindex_nugget"], obj_cite_number, segment_anchor_tag_that_object_belongs_to); +                bookindex_extract_hash.bookindex_nugget_hash(an_object["bookindex_nugget"], obj_cite_digit, segment_anchor_tag_that_object_belongs_to);                an_object["is"] = "para";                auto comp_obj_heading =                  node_construct.node_location_emitter(                    content_non_header,                    segment_anchor_tag_that_object_belongs_to, -                  obj_cite_number, +                  obj_cite_digit,                    cntr,                    heading_ptr-1,                    an_object["is"], @@ -869,8 +871,8 @@ template SiSUdocAbstraction() {                comp_obj_para.is_of                 = "para";                comp_obj_para.is_a                  = "para";                comp_obj_para.text                  = an_object["substantive"].to!string.strip; -              comp_obj_para.ocn                   = obj_cite_number; -              comp_obj_para.obj_cite_number       = (obj_cite_number==0) ? "" : obj_cite_number.to!string; +              comp_obj_para.ocn                   = obj_cite_digit; +              comp_obj_para.obj_cite_number       = (obj_cite_digit==0) ? "" : obj_cite_digit.to!string;                comp_obj_para.indent_hang           = indent["hang_position"];                comp_obj_para.indent_base           = indent["base_position"];                comp_obj_para.bullet                = bullet; @@ -921,7 +923,7 @@ template SiSUdocAbstraction() {                    note_section.gather_notes_for_endnote_section(                      the_document_body_section,                      segment_anchor_tag_that_object_belongs_to, -                    to!int(i), +                    (i).to!int,                    );                  }                } @@ -936,7 +938,7 @@ template SiSUdocAbstraction() {                note_section.gather_notes_for_endnote_section(                  the_document_body_section,                  segment_anchor_tag_that_object_belongs_to, -                to!int(the_document_body_section.length-1), +                (the_document_body_section.length-1).to!int,                );              }            } @@ -946,10 +948,10 @@ template SiSUdocAbstraction() {      } /+ ← closed: loop markup document/text line by line +/      /+ ↓ post loop markup document/text +/      auto en_tuple = -      note_section.endnote_objects(obj_cite_number, opt_action); +      note_section.endnote_objects(obj_cite_digit, opt_action);      static assert(!isTypeTuple!(en_tuple));      auto the_endnotes_section = en_tuple[0]; -    obj_cite_number = en_tuple[1]; +    obj_cite_digit = en_tuple[1];      debug(endnotes) {        writefln(          "%s %s", @@ -1074,13 +1076,13 @@ template SiSUdocAbstraction() {      auto bi_tuple =        bi.bookindex_build_abstraction_section(          bookindex_unordered_hashes, -        obj_cite_number, +        obj_cite_digit,          opt_action,        );      destroy(bookindex_unordered_hashes);      static assert(!isTypeTuple!(bi_tuple));      auto the_bookindex_section = bi_tuple[0]; -    obj_cite_number = bi_tuple[1]; +    obj_cite_digit = bi_tuple[1];      debug(bookindex) {        foreach (bi_entry; the_bookindex_section["seg"]) {          writeln(bi_entry); @@ -1468,6 +1470,9 @@ template SiSUdocAbstraction() {            debug(dom) {              writeln(obj.text);            } +          obj_cite_digit = ocn_emit(OCNstatus.inc); +          obj.ocn = obj_cite_digit; +          obj.obj_cite_number = obj_cite_digit.to!string;            if (obj.heading_lev_markup <= 4) {              segnames_0_4 ~= obj.segment_anchor_tag;              if (obj.heading_lev_markup == 4) { @@ -1489,6 +1494,10 @@ template SiSUdocAbstraction() {              obj = obj_dom_set_collapsed_tags(obj, dom_collapsed, obj.heading_lev_collapsed);            }            obj = obj_heading_ancestors(obj, lv_ancestors_txt); +        } else if (obj.is_a == "glossary") { +          obj_cite_digit = ocn_emit(OCNstatus.inc); +          obj.ocn = obj_cite_digit; +          obj.obj_cite_number = obj_cite_digit.to!string;          }        }      } @@ -1499,6 +1508,9 @@ template SiSUdocAbstraction() {            debug(dom) {              writeln(obj.text);            } +          obj_cite_digit = ocn_emit(OCNstatus.inc); +          obj.ocn = obj_cite_digit; +          obj.obj_cite_number = obj_cite_digit.to!string;            if (obj.heading_lev_markup <= 4) {              segnames_0_4 ~= obj.segment_anchor_tag;              if (obj.heading_lev_markup == 4) { @@ -1520,10 +1532,17 @@ template SiSUdocAbstraction() {              obj = obj_dom_set_collapsed_tags(obj, dom_collapsed, obj.heading_lev_collapsed);            }            obj = obj_heading_ancestors(obj, lv_ancestors_txt); +        } else if (obj.is_a == "bibliography") { +          obj_cite_digit = ocn_emit(OCNstatus.inc); +          obj.ocn = obj_cite_digit; +          obj.obj_cite_number = obj_cite_digit.to!string;          }        }      }      /+ optional only one 1~ level +/ +    int ocn_ = obj_cite_digit; +    int ocn_bkidx_ = 0; +    int ocn_bidx_;      if (the_bookindex_section["scroll"].length > 1) {        /+ scroll +/        dom_markedup_buffer = dom_markedup.dup; @@ -1532,6 +1551,9 @@ template SiSUdocAbstraction() {          if (obj.is_a == "heading") {            debug(dom) {            } +          obj_cite_digit = ocn_emit(OCNstatus.inc); +          obj.ocn = obj_cite_digit; +          obj.obj_cite_number = obj_cite_digit.to!string;            if (obj.heading_lev_markup <= 4) {              segnames_0_4 ~= obj.segment_anchor_tag;              if (obj.heading_lev_markup == 4) { @@ -1553,6 +1575,10 @@ template SiSUdocAbstraction() {              obj = obj_dom_set_collapsed_tags(obj, dom_collapsed, obj.heading_lev_collapsed);            }            obj = obj_heading_ancestors(obj, lv_ancestors_txt); +        } else if (obj.is_a == "bookindex") { +          obj_cite_digit_bkidx = ocn_emit(OCNstatus.bkidx); +          obj.obj_cite_number_bkidx = obj_cite_digit_bkidx.to!string; // FIX need to distinguish from regular ocn +          obj.obj_cite_number_type = OCNtype.bkidx;          }        }        /+ seg +/ @@ -1563,6 +1589,8 @@ template SiSUdocAbstraction() {            debug(dom) {              writeln(obj.text);            } +          obj.ocn = ++ocn_; +          obj.obj_cite_number = obj.ocn.to!string;            if (obj.heading_lev_markup <= 4) {              segnames_0_4 ~= obj.segment_anchor_tag;              if (obj.heading_lev_markup == 4) { @@ -1584,8 +1612,14 @@ template SiSUdocAbstraction() {              obj = obj_dom_set_collapsed_tags(obj, dom_collapsed, obj.heading_lev_collapsed);            }            obj = obj_heading_ancestors(obj, lv_ancestors_txt); +        } else if (obj.is_a == "bookindex") { +          ocn_bidx_ = ++ocn_bkidx_; +          obj.obj_cite_number_bkidx = ocn_bidx_.to!string; // FIX need to distinguish from regular ocn +          obj.obj_cite_number_type = OCNtype.bkidx;          }        } +      assert(obj_cite_digit == ocn_); +      assert(obj_cite_digit_bkidx == ocn_bidx_);      }      /+ optional only one 1~ level +/      if (the_blurb_section.length > 1) { @@ -1594,6 +1628,9 @@ template SiSUdocAbstraction() {            debug(dom) {              writeln(obj.text);            } +          obj_cite_digit = ocn_emit(OCNstatus.inc); +          obj.ocn = obj_cite_digit; +          obj.obj_cite_number = obj_cite_digit.to!string;            if (obj.heading_lev_markup <= 4) {              segnames_0_4 ~= obj.segment_anchor_tag;              if (obj.heading_lev_markup == 4) { @@ -1615,6 +1652,10 @@ template SiSUdocAbstraction() {              obj = obj_dom_set_collapsed_tags(obj, dom_collapsed, obj.heading_lev_collapsed);            }            obj = obj_heading_ancestors(obj, lv_ancestors_txt); +        } else if (obj.is_a == "blurb") { +          obj_cite_digit = ocn_emit(OCNstatus.exc); +          obj.obj_cite_number_non = obj_cite_digit.to!string; +          obj.obj_cite_number_type = OCNtype.non;          }        }      } @@ -1710,8 +1751,8 @@ template SiSUdocAbstraction() {      destroy(bookindex_unordered_hashes);      destroy(an_object);      biblio_arr_json = []; -    obj_cite_number=0; -    obj_cite_number_=0; +    obj_cite_digit=0; +    obj_cite_digit_=0;      html_segnames_ptr=0;      html_segnames_ptr_cntr=0;      content_non_header = "8"; @@ -1785,11 +1826,11 @@ template SiSUdocAbstraction() {        } else {          if (obj_type_status["ocn_status_off_for_multiple_objects"] == TriState.off) {            if (line.matchFirst(rgx.obj_cite_number_off)) { -            obj_type_status["ocn_status"] = TriState.on; +            obj_type_status["ocn_status"] = OCNstatus.exc;            } else if (line.matchFirst(rgx.obj_cite_number_off_dh)) { -            obj_type_status["ocn_status"] = TriState.closing; +            obj_type_status["ocn_status"] = OCNstatus.closing;            } else { -            obj_type_status["ocn_status"] = TriState.off; +            obj_type_status["ocn_status"] = OCNstatus.inc;            }          } else {            obj_type_status["ocn_status"] = @@ -1799,7 +1840,7 @@ template SiSUdocAbstraction() {      } else if ((!line.empty) && (obj_type_status["ocn_status_off_for_multiple_objects"] > TriState.off)) {        if (line.matchFirst(rgx.obj_cite_number_off_block_close)) {          obj_type_status["ocn_status_off_for_multiple_objects"] = TriState.off; -        obj_type_status["ocn_status"]                          = TriState.off; +        obj_type_status["ocn_status"]                          = OCNstatus.inc;          debug(ocnoff) {            writeln(line);          } @@ -1842,7 +1883,7 @@ template SiSUdocAbstraction() {          );        }        obj_cite_number_poem["start"] = -        obj_cite_number.to!string; +        obj_cite_digit.to!string;        obj_type_status["blocks"]     = TriState.on;        obj_type_status["verse_new"]  = State.on;        obj_type_status["poem"]       = TriState.on; @@ -1921,7 +1962,7 @@ template SiSUdocAbstraction() {            line          );        } -      obj_cite_number_poem["start"] = obj_cite_number.to!string; +      obj_cite_number_poem["start"] = obj_cite_digit.to!string;        obj_type_status["blocks"]    = TriState.on;        obj_type_status["verse_new"] = State.on;        obj_type_status["poem"]      = TriState.on; @@ -2138,14 +2179,14 @@ template SiSUdocAbstraction() {              writeln(__LINE__);              writefln(                "* %s %s", -              obj_cite_number, +              obj_cite_digit,                line              );            }            if (an_object.length > 0) {              debug(poem) {                             // poem (curly) close                writeln( -                obj_cite_number, +                obj_cite_digit,                  an_object[an_object_key]                );              } @@ -2159,8 +2200,8 @@ template SiSUdocAbstraction() {              comp_obj_block.of_section                 = "body";              comp_obj_block.is_of                      = "block";              comp_obj_block.is_a                       = "verse"; -            comp_obj_block.ocn                        = obj_cite_number; -            comp_obj_block.obj_cite_number            = (obj_cite_number==0) ? "" : obj_cite_number.to!string; +            comp_obj_block.ocn                        = obj_cite_digit; +            comp_obj_block.obj_cite_number            = (obj_cite_digit==0) ? "" : obj_cite_digit.to!string;              comp_obj_block.text                       = an_object["substantive"];              comp_obj_block.inline_notes_reg           = substantive_obj_misc_tuple[sObj.notes_reg];              comp_obj_block.inline_notes_star          = substantive_obj_misc_tuple[sObj.notes_star]; @@ -2172,14 +2213,14 @@ template SiSUdocAbstraction() {            ++cntr;          }          obj_cite_number_poem["end"] = -          obj_cite_number.to!string; +          obj_cite_digit.to!string;          obj_type_status["blocks"]     = TriState.closing;          obj_type_status["poem"]       = TriState.closing;          obj_type_status["curly_poem"] = TriState.off;        } else {          processing["verse"] ~= line ~= "\n";          if (obj_type_status["verse_new"] == State.on) { -          obj_cite_number = +          obj_cite_digit =              ocn_emit(obj_type_status["ocn_status"]);            obj_type_status["verse_new"] = State.off;          } else if (line.matchFirst(rgx.newline_eol_delimiter_only)) { @@ -2193,7 +2234,7 @@ template SiSUdocAbstraction() {            debug(poem) {                          // poem verse              writefln(                "* %s curly\n%s", -              obj_cite_number, +              obj_cite_digit,                an_object[an_object_key]              );            } @@ -2202,7 +2243,7 @@ template SiSUdocAbstraction() {            auto comp_obj_location = node_construct.node_location_emitter(              content_non_header,              segment_anchor_tag_that_object_belongs_to, -            obj_cite_number, +            obj_cite_digit,              cntr,              heading_ptr-1,              an_object["is"] @@ -2216,8 +2257,8 @@ template SiSUdocAbstraction() {            comp_obj_block.of_section                 = "body";            comp_obj_block.is_of                      = "block";            comp_obj_block.is_a                       = "verse"; -          comp_obj_block.ocn                        = obj_cite_number; -          comp_obj_block.obj_cite_number            = (obj_cite_number==0) ? "" : obj_cite_number.to!string; +          comp_obj_block.ocn                        = obj_cite_digit; +          comp_obj_block.obj_cite_number            = (obj_cite_digit==0) ? "" : obj_cite_digit.to!string;            comp_obj_block.text                       = an_object["substantive"];            comp_obj_block.inline_notes_reg           = substantive_obj_misc_tuple[sObj.notes_reg];            comp_obj_block.inline_notes_star          = substantive_obj_misc_tuple[sObj.notes_star]; @@ -2243,7 +2284,7 @@ template SiSUdocAbstraction() {          if (an_object.length > 0) {            debug(poem) {                                     // poem (tic) close              writeln(__LINE__); -            writeln(obj_cite_number, line); +            writeln(obj_cite_digit, line);            }            processing.remove("verse");            an_object["is"]                           = "verse"; @@ -2256,14 +2297,14 @@ template SiSUdocAbstraction() {            comp_obj_block.of_section                 = "body";            comp_obj_block.is_of                      = "block";            comp_obj_block.is_a                       = "verse"; -          comp_obj_block.ocn                        = obj_cite_number; -          comp_obj_block.obj_cite_number            = (obj_cite_number==0) ? "" : obj_cite_number.to!string; +          comp_obj_block.ocn                        = obj_cite_digit; +          comp_obj_block.obj_cite_number            = (obj_cite_digit==0) ? "" : obj_cite_digit.to!string;            comp_obj_block.text                       = an_object["substantive"];            comp_obj_block.inline_notes_reg           = substantive_obj_misc_tuple[sObj.notes_reg];            comp_obj_block.inline_notes_star          = substantive_obj_misc_tuple[sObj.notes_star];            comp_obj_block.inline_links               = substantive_obj_misc_tuple[sObj.links];            the_document_body_section                 ~= comp_obj_block; -          obj_cite_number_poem["end"]               = obj_cite_number.to!string; +          obj_cite_number_poem["end"]               = obj_cite_digit.to!string;            object_reset(an_object);            processing.remove("verse");            ++cntr; @@ -2274,7 +2315,7 @@ template SiSUdocAbstraction() {        } else {          processing["verse"] ~= line ~= "\n";          if (obj_type_status["verse_new"] == State.on) { -          obj_cite_number = +          obj_cite_digit =              ocn_emit(obj_type_status["ocn_status"]);            obj_type_status["verse_new"] = State.off;          } else if (line.matchFirst(rgx.newline_eol_delimiter_only)) { @@ -2288,7 +2329,7 @@ template SiSUdocAbstraction() {            debug(poem) {                            // poem (tic) close              writefln(                "* %s tic\n%s", -              obj_cite_number, +              obj_cite_digit,                an_object[an_object_key]              );            } @@ -2298,7 +2339,7 @@ template SiSUdocAbstraction() {              node_construct.node_location_emitter(                content_non_header,                segment_anchor_tag_that_object_belongs_to, -              obj_cite_number, +              obj_cite_digit,                cntr,                heading_ptr-1,                an_object["is"] @@ -2312,8 +2353,8 @@ template SiSUdocAbstraction() {            comp_obj_block.of_section                 = "body";            comp_obj_block.is_of                      = "block";            comp_obj_block.is_a                       = "verse"; -          comp_obj_block.ocn                        = obj_cite_number; -          comp_obj_block.obj_cite_number            = (obj_cite_number==0) ? "" : obj_cite_number.to!string; +          comp_obj_block.ocn                        = obj_cite_digit; +          comp_obj_block.obj_cite_number            = (obj_cite_digit==0) ? "" : obj_cite_digit.to!string;            comp_obj_block.text                       = an_object["substantive"];            comp_obj_block.inline_notes_reg           = substantive_obj_misc_tuple[sObj.notes_reg];            comp_obj_block.inline_notes_star          = substantive_obj_misc_tuple[sObj.notes_star]; @@ -2408,7 +2449,7 @@ template SiSUdocAbstraction() {            line,            an_object,            the_document_body_section, -          obj_cite_number, +          obj_cite_digit,            comp_obj_heading,            cntr,            obj_type_status, @@ -2584,20 +2625,20 @@ template SiSUdocAbstraction() {      char[]                           line,      return ref string[string]        an_object,      return ref ObjGenericComposite[] the_document_body_section, -    return ref int                   obj_cite_number, +    return ref int                   obj_cite_digit,      return ref ObjGenericComposite   _comp_obj_heading,      return ref int                   cntr,      return ref int[string]           obj_type_status,      string[string][string]           dochead_make_aa,    ) {        comp_obj_block = comp_obj_block.init; -      obj_cite_number = +      obj_cite_digit =          ocn_emit(obj_type_status["ocn_status"]);        auto comp_obj_location =          node_construct.node_location_emitter(            content_non_header,            segment_anchor_tag_that_object_belongs_to, -          obj_cite_number, +          obj_cite_digit,            cntr,            heading_ptr-1,            "table" @@ -2606,8 +2647,8 @@ template SiSUdocAbstraction() {        auto substantive_obj_misc_tuple =          obj_im.obj_inline_markup_and_anchor_tags_and_misc(an_object, "body_nugget", dochead_make_aa);        an_object["substantive"]         = substantive_obj_misc_tuple[sObj.content]; -      comp_obj_block.ocn               = obj_cite_number; -      comp_obj_block.obj_cite_number   = (obj_cite_number==0) ? "" : obj_cite_number.to!string; +      comp_obj_block.ocn               = obj_cite_digit; +      comp_obj_block.obj_cite_number   = (obj_cite_digit==0) ? "" : obj_cite_digit.to!string;        comp_obj_block                   = table_instructions(comp_obj_block, an_object["table_head"]);        comp_obj_block                   = table_substantive_munge_special(comp_obj_block, an_object["substantive"]);        the_document_body_section        ~= comp_obj_block; @@ -2621,7 +2662,7 @@ template SiSUdocAbstraction() {      return ref string[string]           an_object,      return ref ObjGenericComposite[]    the_document_body_section,      return ref string[][string][string] bookindex_unordered_hashes, -    return ref int                      obj_cite_number, +    return ref int                      obj_cite_digit,      return ref ObjGenericComposite      _comp_obj_heading,      return ref int                      cntr,      return ref int[string]              obj_type_status, @@ -2639,14 +2680,14 @@ template SiSUdocAbstraction() {      );      assertions_flag_types_block_status_none_or_closed(obj_type_status);      if (obj_type_status["quote"] == TriState.closing) { -      obj_cite_number = +      obj_cite_digit =          ocn_emit(obj_type_status["ocn_status"]);        an_object["bookindex_nugget"] =          ("bookindex_nugget" in an_object) ? an_object["bookindex_nugget"] : "";        bookindex_unordered_hashes =          bookindex_extract_hash.bookindex_nugget_hash(            an_object["bookindex_nugget"], -          obj_cite_number, +          obj_cite_digit,            segment_anchor_tag_that_object_belongs_to          );        an_object["is"] = "quote"; @@ -2654,7 +2695,7 @@ template SiSUdocAbstraction() {          node_construct.node_location_emitter(            content_non_header,            segment_anchor_tag_that_object_belongs_to, -          obj_cite_number, +          obj_cite_digit,            cntr,            heading_ptr-1,            an_object["is"] @@ -2668,8 +2709,8 @@ template SiSUdocAbstraction() {        comp_obj_block.of_section                 = "body";        comp_obj_block.is_of                      = "block";        comp_obj_block.is_a                       = "quote"; -      comp_obj_block.ocn                        = obj_cite_number; -      comp_obj_block.obj_cite_number            = (obj_cite_number==0) ? "" : obj_cite_number.to!string; +      comp_obj_block.ocn                        = obj_cite_digit; +      comp_obj_block.obj_cite_number            = (obj_cite_digit==0) ? "" : obj_cite_digit.to!string;        comp_obj_block.text                       = an_object["substantive"];        comp_obj_block.inline_notes_reg           = substantive_obj_misc_tuple[sObj.notes_reg];        comp_obj_block.inline_notes_star          = substantive_obj_misc_tuple[sObj.notes_star]; @@ -2681,14 +2722,14 @@ template SiSUdocAbstraction() {        processing.remove("verse");        ++cntr;      } else if (obj_type_status["group"] == TriState.closing) { -      obj_cite_number = +      obj_cite_digit =          ocn_emit(obj_type_status["ocn_status"]);        an_object["bookindex_nugget"] =          ("bookindex_nugget" in an_object) ? an_object["bookindex_nugget"] : "";        bookindex_unordered_hashes =          bookindex_extract_hash.bookindex_nugget_hash(            an_object["bookindex_nugget"], -          obj_cite_number, +          obj_cite_digit,            segment_anchor_tag_that_object_belongs_to          );        an_object["is"] = "group"; @@ -2696,7 +2737,7 @@ template SiSUdocAbstraction() {          node_construct.node_location_emitter(            content_non_header,            segment_anchor_tag_that_object_belongs_to, -          obj_cite_number, +          obj_cite_digit,            cntr,            heading_ptr-1,            an_object["is"] @@ -2710,8 +2751,8 @@ template SiSUdocAbstraction() {        comp_obj_block.of_section                 = "body";        comp_obj_block.is_of                      = "block";        comp_obj_block.is_a                       = "group"; -      comp_obj_block.ocn                        = obj_cite_number; -      comp_obj_block.obj_cite_number            = (obj_cite_number==0) ? "" : obj_cite_number.to!string; +      comp_obj_block.ocn                        = obj_cite_digit; +      comp_obj_block.obj_cite_number            = (obj_cite_digit==0) ? "" : obj_cite_digit.to!string;        comp_obj_block.text                       = an_object["substantive"];        comp_obj_block.inline_notes_reg           = substantive_obj_misc_tuple[sObj.notes_reg];        comp_obj_block.inline_notes_star          = substantive_obj_misc_tuple[sObj.notes_star]; @@ -2723,13 +2764,13 @@ template SiSUdocAbstraction() {        processing.remove("verse");        ++cntr;      } else if (obj_type_status["block"] == TriState.closing) { -      obj_cite_number = ocn_emit(obj_type_status["ocn_status"]); +      obj_cite_digit = ocn_emit(obj_type_status["ocn_status"]);        an_object["bookindex_nugget"] =          ("bookindex_nugget" in an_object) ? an_object["bookindex_nugget"] : "";        bookindex_unordered_hashes =          bookindex_extract_hash.bookindex_nugget_hash(            an_object["bookindex_nugget"], -          obj_cite_number, +          obj_cite_digit,            segment_anchor_tag_that_object_belongs_to          );        an_object["is"] = "block"; @@ -2737,7 +2778,7 @@ template SiSUdocAbstraction() {          node_construct.node_location_emitter(            content_non_header,            segment_anchor_tag_that_object_belongs_to, -          obj_cite_number, +          obj_cite_digit,            cntr,            heading_ptr-1,            an_object["is"] @@ -2750,8 +2791,8 @@ template SiSUdocAbstraction() {        comp_obj_block.of_section                 = "body";        comp_obj_block.is_of                      = "block";        comp_obj_block.is_a                       = "block"; -      comp_obj_block.ocn                        = obj_cite_number; -      comp_obj_block.obj_cite_number            = (obj_cite_number==0) ? "" : obj_cite_number.to!string; +      comp_obj_block.ocn                        = obj_cite_digit; +      comp_obj_block.obj_cite_number            = (obj_cite_digit==0) ? "" : obj_cite_digit.to!string;        comp_obj_block.text                       = an_object["substantive"];        comp_obj_block.inline_notes_reg           = substantive_obj_misc_tuple[sObj.notes_reg];        comp_obj_block.inline_notes_star          = substantive_obj_misc_tuple[sObj.notes_star]; @@ -2768,7 +2809,7 @@ template SiSUdocAbstraction() {        bookindex_unordered_hashes =          bookindex_extract_hash.bookindex_nugget_hash(            an_object["bookindex_nugget"], -          obj_cite_number, +          obj_cite_digit,            segment_anchor_tag_that_object_belongs_to          );        an_object["is"]                           = "verse"; @@ -2776,7 +2817,7 @@ template SiSUdocAbstraction() {          node_construct.node_location_emitter(            content_non_header,            segment_anchor_tag_that_object_belongs_to, -          obj_cite_number, +          obj_cite_digit,            cntr,            heading_ptr-1,            an_object["is"] @@ -2786,7 +2827,7 @@ template SiSUdocAbstraction() {        comp_obj_poem_ocn.of_section              = "body";        comp_obj_poem_ocn.is_of                   = "block";        comp_obj_poem_ocn.is_a                    = "poem"; -      comp_obj_poem_ocn.ocn                     = obj_cite_number; +      comp_obj_poem_ocn.ocn                     = obj_cite_digit;        comp_obj_poem_ocn.obj_cite_number         = (obj_cite_number_poem["start"], obj_cite_number_poem["end"]);        comp_obj_poem_ocn.text                    = "";        the_document_body_section                 ~= comp_obj_poem_ocn; @@ -2795,14 +2836,14 @@ template SiSUdocAbstraction() {        object_reset(an_object);        processing.remove("verse");      } else if (obj_type_status["code"] == TriState.closing) { -      obj_cite_number = +      obj_cite_digit =          ocn_emit(obj_type_status["ocn_status"]);        an_object["bookindex_nugget"] =          ("bookindex_nugget" in an_object) ? an_object["bookindex_nugget"] : "";        bookindex_unordered_hashes =          bookindex_extract_hash.bookindex_nugget_hash(            an_object["bookindex_nugget"], -          obj_cite_number, +          obj_cite_digit,            segment_anchor_tag_that_object_belongs_to          );        an_object["is"] = "code"; @@ -2810,7 +2851,7 @@ template SiSUdocAbstraction() {          node_construct.node_location_emitter(            content_non_header,            segment_anchor_tag_that_object_belongs_to, -          obj_cite_number, +          obj_cite_digit,            cntr,            heading_ptr-1,            an_object["is"] @@ -2824,8 +2865,8 @@ template SiSUdocAbstraction() {        comp_obj_code.of_section                  = "body";        comp_obj_code.is_of                       = "block";        comp_obj_code.is_a                        = "code"; -      comp_obj_code.ocn                         = obj_cite_number; -      comp_obj_code.obj_cite_number             = (obj_cite_number==0) ? "" : obj_cite_number.to!string; +      comp_obj_code.ocn                         = obj_cite_digit; +      comp_obj_code.obj_cite_number             = (obj_cite_digit==0) ? "" : obj_cite_digit.to!string;        comp_obj_code.text                        = an_object["substantive"];        comp_obj_code.inline_notes_reg            = substantive_obj_misc_tuple[sObj.notes_reg];        comp_obj_code.inline_notes_star           = substantive_obj_misc_tuple[sObj.notes_star]; @@ -2838,14 +2879,14 @@ template SiSUdocAbstraction() {        ++cntr;      } else if (obj_type_status["table"] == TriState.closing) {        comp_obj_block = comp_obj_block.init; -      obj_cite_number = +      obj_cite_digit =          ocn_emit(obj_type_status["ocn_status"]);        an_object["bookindex_nugget"] =          ("bookindex_nugget" in an_object) ? an_object["bookindex_nugget"] : "";        bookindex_unordered_hashes =          bookindex_extract_hash.bookindex_nugget_hash(            an_object["bookindex_nugget"], -          obj_cite_number, +          obj_cite_digit,            segment_anchor_tag_that_object_belongs_to          );        an_object["is"] = "table"; @@ -2853,7 +2894,7 @@ template SiSUdocAbstraction() {          node_construct.node_location_emitter(            content_non_header,            segment_anchor_tag_that_object_belongs_to, -          obj_cite_number, +          obj_cite_digit,            cntr,            heading_ptr-1,            an_object["is"] @@ -2862,8 +2903,8 @@ template SiSUdocAbstraction() {          obj_im.obj_inline_markup_and_anchor_tags_and_misc(an_object, an_object_key, dochead_make_aa);        an_object["substantive"] = substantive_obj_misc_tuple[sObj.content];        comp_obj_block                            = comp_obj_block.init; -      comp_obj_block.ocn                        = obj_cite_number; -      comp_obj_block.obj_cite_number            = (obj_cite_number==0) ? "" : obj_cite_number.to!string; +      comp_obj_block.ocn                        = obj_cite_digit; +      comp_obj_block.obj_cite_number            = (obj_cite_digit==0) ? "" : obj_cite_digit.to!string;        comp_obj_block = table_instructions(comp_obj_block, an_object["table_head"]);        comp_obj_block = table_substantive_munge(comp_obj_block, an_object["substantive"]);        the_document_body_section                 ~= comp_obj_block; @@ -3517,19 +3558,31 @@ template SiSUdocAbstraction() {    /+ abstraction functions ↑ +/    /+ ↓ abstraction function emitters +/    pure struct OCNemitter { -    int obj_cite_number, obj_cite_number_; +    int ocn_, ocn_in, ocn_in_, ocn_out_, ocn_bkidx_;      int ocn_emitter(int ocn_status_flag) -    in { assert(ocn_status_flag <= 3); } +    in { assert(ocn_status_flag <= OCNstatus.reset); }      body { -      if (ocn_status_flag == 3) { -        obj_cite_number = obj_cite_number_ = 1; -      } else { -        obj_cite_number=(ocn_status_flag == 0) -        ? ++obj_cite_number_ -        : 0; +      switch(ocn_status_flag) { +      case OCNstatus.reset: +        ocn_ = ocn_in_ = ocn_out_ = 1; +        ocn_bkidx_ = 0; +        break; +      case OCNstatus.inc: +        ocn_ = ++ocn_in_; +        break; +      case OCNstatus.exc: +        ocn_ = ++ocn_out_; +        break; +      case OCNstatus.bkidx: +        ocn_ = ++ocn_bkidx_; +        break; +      case OCNstatus.closing: +        break; +      default: +        ocn_ = 0;        } -      assert(obj_cite_number >= 0); -      return obj_cite_number; +      assert(ocn_ >= 0); +      return ocn_;      }      invariant() {      } @@ -4583,19 +4636,19 @@ template SiSUdocAbstraction() {      string[] bi_main_terms_split_arr;      string[][string][string] bookindex_nugget_hash(BI,N,S)(        BI bookindex_section, -      N  obj_cite_number, +      N  obj_cite_digit,        S  segment_anchor_tag,      )      in {        debug(asserts) {          static assert(is(typeof(bookindex_section) == string)); -        static assert(is(typeof(obj_cite_number)   == int)); +        static assert(is(typeof(obj_cite_digit)   == int));        }        debug(bookindexraw) {          if (!bookindex_section.empty) {            writeln(              "* [bookindex] ", -            "[", obj_cite_number.to!string, ": ", segment_anchor_tag, "] ", bookindex_section +            "[", obj_cite_digit.to!string, ": ", segment_anchor_tag, "] ", bookindex_section            );          }        } @@ -4613,12 +4666,12 @@ template SiSUdocAbstraction() {            ) {              main_term = m.captures[1].strip;              obj_cite_number_offset = m.captures[2].to!int; -            obj_cite_number_endpoint=(obj_cite_number + obj_cite_number_offset); -            obj_cite_numbers ~= (obj_cite_number.to!string ~ "-" ~ to!string(obj_cite_number_endpoint) +            obj_cite_number_endpoint=(obj_cite_digit + obj_cite_number_offset); +            obj_cite_numbers ~= (obj_cite_digit.to!string ~ "-" ~ to!string(obj_cite_number_endpoint)              ~ ":" ~ segment_anchor_tag);            } else {              main_term = bi_main_term_and_rest[0].strip; -            obj_cite_numbers ~= obj_cite_number.to!string +            obj_cite_numbers ~= obj_cite_digit.to!string              ~ ":" ~ segment_anchor_tag;            }            bi[main_term]["_a"] ~= obj_cite_numbers; @@ -4632,12 +4685,12 @@ template SiSUdocAbstraction() {                if (auto m = sub_terms_bits.match(rgx.bi_term_and_obj_cite_numbers_match)) {                  sub_term = m.captures[1].strip;                  obj_cite_number_offset = m.captures[2].to!int; -                obj_cite_number_endpoint=(obj_cite_number + obj_cite_number_offset); -                obj_cite_numbers ~= (obj_cite_number.to!string ~ " - " ~ to!string(obj_cite_number_endpoint) +                obj_cite_number_endpoint=(obj_cite_digit + obj_cite_number_offset); +                obj_cite_numbers ~= (obj_cite_digit.to!string ~ " - " ~ to!string(obj_cite_number_endpoint)                  ~ ":" ~ segment_anchor_tag);                } else {                  sub_term = sub_terms_bits.strip; -                obj_cite_numbers ~= to!string(obj_cite_number) +                obj_cite_numbers ~= to!string(obj_cite_digit)                  ~ ":" ~ segment_anchor_tag;                }                if (!empty(sub_term)) { @@ -4718,12 +4771,12 @@ template SiSUdocAbstraction() {      }      auto bookindex_build_abstraction_section(BI,N,B)(        BI bookindex_unordered_hashes, -      N  obj_cite_number, +      N  obj_cite_digit,        B  opt_action,      ) {        debug(asserts) {          static assert(is(typeof(bookindex_unordered_hashes)                == string[][string][string])); -        static assert(is(typeof(obj_cite_number)                           == int)); +        static assert(is(typeof(obj_cite_digit)                           == int));          static assert(is(typeof(opt_action)                                == bool[string]));        }        mixin SiSUnode; @@ -4762,7 +4815,6 @@ template SiSUdocAbstraction() {          comp_obj_heading.inline_links           = true;          bookindex_section["scroll"]             ~= comp_obj_heading_;          bookindex_section["seg"]                ~= comp_obj_heading_; -        ++obj_cite_number;          ++mkn;          comp_obj_heading_                       = comp_obj_heading_.init;          comp_obj_heading_.of_part               = "backmatter"; @@ -4782,7 +4834,6 @@ template SiSUdocAbstraction() {          comp_obj_heading_.anchor_tags           = ["bookindex"];          bookindex_section["scroll"]             ~= comp_obj_heading_;          bookindex_section["seg"]                ~= comp_obj_heading_; -        ++obj_cite_number;          ++mkn;          import std.array : appender;          auto buffer = appender!(char[])(); @@ -4847,8 +4898,8 @@ template SiSUdocAbstraction() {            comp_obj_para.is_of                 = "para";            comp_obj_para.is_a                  = "bookindex";            comp_obj_para.text                  = bi_tmp_scroll.to!string.strip; -          comp_obj_para.ocn                   = obj_cite_number; -          comp_obj_para.obj_cite_number       = (obj_cite_number==0) ? "" : to!string(obj_cite_number); +          comp_obj_para.ocn                   = 0; +          comp_obj_para.obj_cite_number       = "";            comp_obj_para.anchor_tags           = bi_tmp_tags;            comp_obj_para.indent_hang           = 0;            comp_obj_para.indent_base           = 1; @@ -4857,7 +4908,6 @@ template SiSUdocAbstraction() {            bookindex_section["scroll"]         ~= comp_obj_para;            comp_obj_para.text                  = bi_tmp_seg.to!string.strip;            bookindex_section["seg"]            ~= comp_obj_para; -          ++obj_cite_number;            ++mkn;          }        } else {                              // no book index, (figure out what to do here) @@ -4873,7 +4923,7 @@ template SiSUdocAbstraction() {          bookindex_section["scroll"]             ~= comp_obj_heading_;          bookindex_section["seg"]                ~= comp_obj_heading_;        } -      auto t = tuple(bookindex_section, obj_cite_number); +      auto t = tuple(bookindex_section, obj_cite_digit);        return t;      }    } @@ -4954,7 +5004,7 @@ template SiSUdocAbstraction() {        return endnotes_;      }      private auto endnote_objects( -      int            obj_cite_number, +      int            obj_cite_digit,        bool[string]   opt_action,      )      in { @@ -4985,7 +5035,7 @@ template SiSUdocAbstraction() {          comp_obj_heading_.parent_ocn            = 1;          comp_obj_heading_.parent_lev_markup     = 0;          the_endnotes_section                    ~= comp_obj_heading_; -        ++obj_cite_number; +        ++obj_cite_digit;          ++mkn;          comp_obj_heading_                       = comp_obj_heading_.init;          comp_obj_heading_.of_part               = "backmatter"; @@ -5003,7 +5053,7 @@ template SiSUdocAbstraction() {          comp_obj_heading_.parent_lev_markup     = 0;          comp_obj_heading_.anchor_tags           = ["endnotes"];          the_endnotes_section                    ~= comp_obj_heading_; -        ++obj_cite_number; +        ++obj_cite_digit;          ++mkn;        } else {          comp_obj_heading_                       = comp_obj_heading_.init; @@ -5043,7 +5093,7 @@ template SiSUdocAbstraction() {            the_endnotes_section                  ~= comp_obj_endnote_;          }        } -      auto t = tuple(the_endnotes_section, obj_cite_number); +      auto t = tuple(the_endnotes_section, obj_cite_digit);        return t;      }    } @@ -5150,13 +5200,13 @@ template SiSUdocAbstraction() {    /+ +/    struct NodeStructureMetadata {      int lv, lv0, lv1, lv2, lv3, lv4, lv5, lv6, lv7; -    int obj_cite_number; +    int obj_cite_digit;      int[string] p_; // p_ parent_      static auto rgx = Rgx();      ObjGenericComposite node_location_emitter(Lv,Ta,N,C,P,I)(        Lv lev_markup_number,        Ta segment_anchor_tag, -      N  obj_cite_number_, +      N  obj_cite_digit_,        C  cntr_,        P  ptr_,        I  is_ @@ -5165,18 +5215,18 @@ template SiSUdocAbstraction() {        debug(asserts) {          static assert(is(typeof(lev_markup_number)  == string));          static assert(is(typeof(segment_anchor_tag) == string)); -        static assert(is(typeof(obj_cite_number_)   == int)); +        static assert(is(typeof(obj_cite_digit_)    == int));          static assert(is(typeof(cntr_)              == int));          static assert(is(typeof(ptr_)               == int));          static assert(is(typeof(is_)                == string));        }        assert(is_ != "heading"); -      assert(obj_cite_number_.to!int >= 0); +      assert(obj_cite_digit_.to!int >= 0);      }      body {        assert(is_ != "heading"); // should not be necessary -      assert(obj_cite_number_.to!int >= 0); // should not be necessary -      int obj_cite_number = obj_cite_number_.to!int; +      assert(obj_cite_digit_.to!int >= 0); // should not be necessary +      int obj_cite_digit = obj_cite_digit_.to!int;        if (lv7 > State.off) {          p_["lev_markup_number"] = DocStructMarkupHeading.h_text_4;          p_["obj_cite_number"] = lv7; @@ -5193,7 +5243,7 @@ template SiSUdocAbstraction() {        ObjGenericComposite comp_obj_location;        comp_obj_location                       = comp_obj_location.init;        comp_obj_location.is_a                  = is_; -      comp_obj_location.ocn                   = obj_cite_number_; +      comp_obj_location.ocn                   = obj_cite_digit_;        comp_obj_location.segment_anchor_tag    = segment_anchor_tag.to!string;        comp_obj_location.parent_ocn            = p_["obj_cite_number"];        comp_obj_location.parent_lev_markup     = p_["lev_markup_number"]; @@ -5217,7 +5267,7 @@ template SiSUdocAbstraction() {        Lm  lev_markup_number,        Lc  lev_collapsed_number,        Ta  segment_anchor_tag, -      N   obj_cite_number_, +      N   obj_cite_digit_,        C   cntr_,        P   ptr_,        LA  lv_ancestors_txt, @@ -5234,7 +5284,7 @@ template SiSUdocAbstraction() {          static assert(is(typeof(lev_markup_number)    == string));          static assert(is(typeof(lev_collapsed_number) == string));          static assert(is(typeof(segment_anchor_tag)   == string)); -        static assert(is(typeof(obj_cite_number_)     == int)); +        static assert(is(typeof(obj_cite_digit_)      == int));          static assert(is(typeof(cntr_)                == int));          static assert(is(typeof(ptr_)                 == int));          static assert(is(typeof(lv_ancestors_txt)     == string[])); @@ -5242,30 +5292,30 @@ template SiSUdocAbstraction() {          static assert(is(typeof(html_segnames_ptr)    == int));        }        assert(is_ == "heading"); -      assert(to!int(obj_cite_number_) >= 0); +      assert((obj_cite_digit_).to!int >= 0);        assert(          lev_markup_number.match(rgx.levels_numbered), -        ("not a valid heading level: " ~ lev_markup_number ~ " at " ~ obj_cite_number_.to!string) +        ("not a valid heading level: " ~ lev_markup_number ~ " at " ~ obj_cite_digit_.to!string)        );        if (lev_markup_number.match(rgx.levels_numbered)) {          if (lev_markup_number.to!int == 0) { -          assert(obj_cite_number_.to!int == 1); +          assert(obj_cite_digit_.to!int == 1);          }        }      }      body { -      int obj_cite_number = obj_cite_number_.to!int; +      int obj_cite_digit = obj_cite_digit_.to!int;        switch (lev_markup_number.to!int) {        case 0:          lv = DocStructMarkupHeading.h_sect_A; -        lv0 = obj_cite_number; +        lv0 = obj_cite_digit;          lv1=0; lv2=0; lv3=0; lv4=0; lv5=0; lv6=0; lv7=0;          p_["lev_markup_number"] = 0;          p_["obj_cite_number"] = 0;          break;        case 1:          lv = DocStructMarkupHeading.h_sect_B; -        lv1 = obj_cite_number; +        lv1 = obj_cite_digit;          lv2=0; lv3=0; lv4=0; lv5=0; lv6=0; lv7=0;          p_["lev_markup_number"] =            DocStructMarkupHeading.h_sect_A; @@ -5273,7 +5323,7 @@ template SiSUdocAbstraction() {          break;        case 2:          lv = DocStructMarkupHeading.h_sect_C; -        lv2 = obj_cite_number; +        lv2 = obj_cite_digit;          lv3=0; lv4=0; lv5=0; lv6=0; lv7=0;          p_["lev_markup_number"] =            DocStructMarkupHeading.h_sect_B; @@ -5281,7 +5331,7 @@ template SiSUdocAbstraction() {          break;        case 3:          lv = DocStructMarkupHeading.h_sect_D; -        lv3=obj_cite_number; +        lv3=obj_cite_digit;          lv4=0; lv5=0; lv6=0; lv7=0;          p_["lev_markup_number"] =            DocStructMarkupHeading.h_sect_C; @@ -5289,7 +5339,7 @@ template SiSUdocAbstraction() {          break;        case 4:          lv = DocStructMarkupHeading.h_text_1; -        lv4 = obj_cite_number; +        lv4 = obj_cite_digit;          lv5=0; lv6=0; lv7=0;          if (lv3 > State.off) {            p_["lev_markup_number"] = @@ -5311,7 +5361,7 @@ template SiSUdocAbstraction() {          break;        case 5:          lv = DocStructMarkupHeading.h_text_2; -        lv5 = obj_cite_number; +        lv5 = obj_cite_digit;          lv6=0; lv7=0;          p_["lev_markup_number"] =            DocStructMarkupHeading.h_text_1; @@ -5319,7 +5369,7 @@ template SiSUdocAbstraction() {          break;        case 6:          lv = DocStructMarkupHeading.h_text_3; -        lv6 = obj_cite_number; +        lv6 = obj_cite_digit;          lv7=0;          p_["lev_markup_number"] =            DocStructMarkupHeading.h_text_2; @@ -5327,7 +5377,7 @@ template SiSUdocAbstraction() {          break;        case 7:          lv = DocStructMarkupHeading.h_text_4; -        lv7 = obj_cite_number; +        lv7 = obj_cite_digit;          p_["lev_markup_number"] =            DocStructMarkupHeading.h_text_3;          p_["obj_cite_number"] = lv6; @@ -5342,8 +5392,8 @@ template SiSUdocAbstraction() {        _comp_obj_heading_.is_of                     = "para";        _comp_obj_heading_.is_a                      = "heading";        _comp_obj_heading_.text                      = _text.to!string.strip; -      _comp_obj_heading_.ocn                       = obj_cite_number_; -      _comp_obj_heading_.obj_cite_number           = (obj_cite_number==0) ? "" : obj_cite_number.to!string; +      _comp_obj_heading_.ocn                       = obj_cite_digit_; +      _comp_obj_heading_.obj_cite_number           = (obj_cite_digit==0) ? "" : obj_cite_digit.to!string;        _comp_obj_heading_.segment_anchor_tag        = segment_anchor_tag.to!string;        _comp_obj_heading_.marked_up_level           = lev;        _comp_obj_heading_.heading_lev_markup        = (!(lev_markup_number.empty) ? lev_markup_number.to!int : 0); diff --git a/src/sdp/meta/object_setter.d b/src/sdp/meta/object_setter.d index 48bef54..805afd3 100644 --- a/src/sdp/meta/object_setter.d +++ b/src/sdp/meta/object_setter.d @@ -23,6 +23,9 @@ template ObjectSetter() {      string                 is_a                         = "";      string                 text                         = "";      string                 obj_cite_number              = ""; +    string                 obj_cite_number_non          = ""; +    string                 obj_cite_number_bkidx        = ""; +    int                    obj_cite_number_type         = 0;      string[]               anchor_tags                  = [];      int                    indent_base                  = 0;      int                    indent_hang                  = 0; | 
