From 4ce831bbc753ed1352e615ca79daddd13ea448d5 Mon Sep 17 00:00:00 2001 From: Ralph Amissah Date: Sat, 29 Jul 2017 05:35:06 -0400 Subject: 0.18.1 ocn, looks promising --- src/sdp/meta/metadoc_from_src.d | 456 ++++++++++++++++++++++++---------------- src/sdp/meta/metadoc_summary.d | 9 +- src/sdp/meta/object_setter.d | 2 +- 3 files changed, 286 insertions(+), 181 deletions(-) (limited to 'src/sdp/meta') diff --git a/src/sdp/meta/metadoc_from_src.d b/src/sdp/meta/metadoc_from_src.d index 920e7af..e3cbe2d 100644 --- a/src/sdp/meta/metadoc_from_src.d +++ b/src/sdp/meta/metadoc_from_src.d @@ -47,7 +47,7 @@ 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 OCNstatus { on, off, bkidx, closing, reset, } enum OCNtype { ocn, non, bkidx, } /+ biblio variables +/ string biblio_tag_name, biblio_tag_entry, st; @@ -69,7 +69,15 @@ template SiSUdocAbstraction() { static auto obj_im = ObjInlineMarkup(); static auto obj_att = ObjAttributes(); /+ ocn +/ - int obj_cite_digit, obj_cite_digit_, obj_cite_digit_bkidx; + struct OCNset { + int digit; + int on; + int off; + int bkidx; + int type; + } + OCNset obj_cite_digits; + int obj_cite_digit_, obj_cite_digit_off, obj_cite_digit_bkidx, obj_cite_digit_type; 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,]; @@ -217,7 +225,7 @@ template SiSUdocAbstraction() { obj.dom_collapsed = dom.dup; return obj; } - int ocn_emit(int ocn_status_flag) { + static auto ocn_emit(int ocn_status_flag) { return object_citation_number.ocn_emitter(ocn_status_flag); } /+ book index variables +/ @@ -318,8 +326,8 @@ template SiSUdocAbstraction() { ]; string _anchor_tag; string toc_txt_; - an_object["glossary_nugget"] = ""; - an_object["blurb_nugget"] = ""; + an_object["glossary_nugget"] = ""; + an_object["blurb_nugget"] = ""; comp_obj_heading_ = comp_obj_heading_.init; comp_obj_heading_.of_part = "frontmatter"; comp_obj_heading_.of_section = "toc"; @@ -328,6 +336,8 @@ template SiSUdocAbstraction() { comp_obj_heading_.text = "Table of Contents"; comp_obj_heading_.ocn = 0; comp_obj_heading_.obj_cite_number = ""; + comp_obj_heading_.obj_cite_number_off = ""; + comp_obj_heading_.obj_cite_number_type = 0; comp_obj_heading_.segment_anchor_tag = "toc"; comp_obj_heading_.marked_up_level = "1"; comp_obj_heading_.heading_lev_markup = 4; @@ -442,6 +452,8 @@ template SiSUdocAbstraction() { comp_obj_heading_.text = "Glossary"; comp_obj_heading_.ocn = 0; comp_obj_heading_.obj_cite_number = ""; + comp_obj_heading_.obj_cite_number_off = ""; + comp_obj_heading_.obj_cite_number_type = 0; comp_obj_heading_.segment_anchor_tag = "_part_glossary"; comp_obj_heading_.marked_up_level = "B"; comp_obj_heading_.heading_lev_markup = 1; @@ -459,6 +471,8 @@ template SiSUdocAbstraction() { comp_obj_heading_.text = "Glossary"; comp_obj_heading_.ocn = 0; comp_obj_heading_.obj_cite_number = ""; + comp_obj_heading_.obj_cite_number_off = ""; + comp_obj_heading_.obj_cite_number_type = 0; comp_obj_heading_.segment_anchor_tag = "glossary"; comp_obj_heading_.marked_up_level = "1"; comp_obj_heading_.heading_lev_markup = 4; @@ -479,12 +493,14 @@ template SiSUdocAbstraction() { comp_obj_para.text = line.to!string.strip; comp_obj_para.ocn = 0; comp_obj_para.obj_cite_number = ""; + comp_obj_para.obj_cite_number_off = ""; + comp_obj_para.obj_cite_number_type = 0; comp_obj_para.indent_hang = indent["hang_position"]; comp_obj_para.indent_base = indent["base_position"]; comp_obj_para.bullet = bullet; the_glossary_section ~= comp_obj_para; } - obj_type_status["ocn_status"] = OCNstatus.inc; + obj_type_status["ocn_status"] = OCNstatus.on; } continue; } else if (line.matchFirst(rgx.heading_blurb) @@ -518,6 +534,8 @@ template SiSUdocAbstraction() { comp_obj_heading_.text = "Blurb"; comp_obj_heading_.ocn = 0; comp_obj_heading_.obj_cite_number = ""; + comp_obj_heading_.obj_cite_number_off = ""; + comp_obj_heading_.obj_cite_number_type = 0; comp_obj_heading_.segment_anchor_tag = "_part_blurb"; comp_obj_heading_.marked_up_level = "B"; comp_obj_heading_.heading_lev_markup = 1; @@ -535,6 +553,8 @@ template SiSUdocAbstraction() { comp_obj_heading_.text = "Blurb"; comp_obj_heading_.ocn = 0; comp_obj_heading_.obj_cite_number = ""; + comp_obj_heading_.obj_cite_number_off = ""; + comp_obj_heading_.obj_cite_number_type = 0; comp_obj_heading_.segment_anchor_tag = "blurb"; comp_obj_heading_.marked_up_level = "1"; comp_obj_heading_.heading_lev_markup = 4; @@ -555,6 +575,8 @@ template SiSUdocAbstraction() { comp_obj_heading_.text = line.to!string; comp_obj_heading_.ocn = 0; comp_obj_heading_.obj_cite_number = ""; + comp_obj_heading_.obj_cite_number_off = ""; + comp_obj_heading_.obj_cite_number_type = 0; comp_obj_heading_.segment_anchor_tag = "blurb"; comp_obj_heading_.marked_up_level = an_object["lev"].to!string; comp_obj_heading_.heading_lev_markup = an_object["lev_markup_number"].to!int; // make int, remove need to conv @@ -572,12 +594,14 @@ template SiSUdocAbstraction() { comp_obj_para.text = line.to!string.strip; comp_obj_para.ocn = 0; comp_obj_para.obj_cite_number = ""; + comp_obj_para.obj_cite_number_off = ""; + comp_obj_para.obj_cite_number_type = 0; comp_obj_para.indent_hang = indent["hang_position"]; comp_obj_para.indent_base = indent["base_position"]; comp_obj_para.bullet = bullet; the_blurb_section ~= comp_obj_para; } - obj_type_status["ocn_status"] = OCNstatus.inc; + obj_type_status["ocn_status"] = OCNstatus.on; } continue; } else if (obj_type_status["quote"] == TriState.on) { @@ -624,7 +648,7 @@ template SiSUdocAbstraction() { /+ poem to verse exceptions! +/ object_reset(an_object); processing.remove("verse"); - obj_cite_number_poem["start"] = obj_cite_digit.to!string; + obj_cite_number_poem["start"] = obj_cite_digits.on.to!string; } _start_block_(line, obj_type_status, obj_cite_number_poem); continue; @@ -733,7 +757,7 @@ template SiSUdocAbstraction() { an_object, the_document_body_section, bookindex_unordered_hashes, - obj_cite_digit, + obj_cite_digits, comp_obj_heading, cntr, obj_type_status, @@ -754,9 +778,9 @@ template SiSUdocAbstraction() { if ((obj_type_status["heading"] == State.on) && (line_occur["heading"] > State.off)) { /+ heading object (current line empty) +/ - 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"])); + obj_cite_digits = (an_object["lev_markup_number"].to!int == 0) + ? ocn_emit(OCNstatus.reset) + : ocn_emit(OCNstatus.on); // : ocn_emit(obj_type_status["ocn_status"]); an_object["is"] = "heading"; an_object_key="body_nugget"; auto substantive_object_and_anchor_tags_tuple = @@ -769,7 +793,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_digit.to!string; + segment_anchor_tag_that_object_belongs_to_uri = anchor_tag_ ~ ".fnSuffix#" ~ obj_cite_digits.on.to!string; } else if (an_object["lev_markup_number"].to!int < 4) { string segn; switch (an_object["lev_markup_number"].to!int) { @@ -797,9 +821,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_digit, segment_anchor_tag_that_object_belongs_to); + bookindex_extract_hash.bookindex_nugget_hash(an_object["bookindex_nugget"], obj_cite_digits, segment_anchor_tag_that_object_belongs_to); /+ (incrementally build toc) table of contents here! +/ - _anchor_tag=to!string(obj_cite_digit); + _anchor_tag=to!string(obj_cite_digits.on); the_table_of_contents_section = obj_im.table_of_contents_gather_headings( an_object, dochead_make_aa, @@ -820,7 +844,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_digit, // int + obj_cite_digits, // OCNset cntr, // int heading_ptr, // int lv_ancestors_txt, // string[] @@ -847,17 +871,17 @@ template SiSUdocAbstraction() { } else if ((obj_type_status["para"] == State.on) && (line_occur["para"] > State.off)) { /+ paragraph object (current line empty) +/ - obj_cite_digit = ocn_emit(obj_type_status["ocn_status"]); + obj_cite_digits = 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_digit, segment_anchor_tag_that_object_belongs_to); + bookindex_extract_hash.bookindex_nugget_hash(an_object["bookindex_nugget"], obj_cite_digits, 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_digit, + obj_cite_digits, cntr, heading_ptr-1, an_object["is"], @@ -872,8 +896,11 @@ 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_digit; - comp_obj_para.obj_cite_number = (obj_cite_digit==0) ? "" : obj_cite_digit.to!string; + comp_obj_para.ocn = obj_cite_digits.digit; + comp_obj_para.obj_cite_number = (obj_cite_digits.on==0) ? "" : obj_cite_digits.on.to!string; + comp_obj_para.obj_cite_number_off = (obj_cite_digits.off==0) ? "" : obj_cite_digits.off.to!string; + comp_obj_para.obj_cite_number_bkidx = (obj_cite_digits.bkidx==0) ? "" : obj_cite_digits.bkidx.to!string; + comp_obj_para.obj_cite_number_type = obj_cite_digits.type; comp_obj_para.indent_hang = indent["hang_position"]; comp_obj_para.indent_base = indent["base_position"]; comp_obj_para.bullet = bullet; @@ -946,10 +973,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_digit, opt_action); + note_section.endnote_objects(obj_cite_digits, opt_action); static assert(!isTypeTuple!(en_tuple)); auto the_endnotes_section = en_tuple[0]; - obj_cite_digit = en_tuple[1]; + obj_cite_digits = en_tuple[1]; debug(endnotes) { writefln( "%s %s", @@ -969,6 +996,8 @@ template SiSUdocAbstraction() { comp_obj_heading_.text = "(skip) there is no Glossary section"; comp_obj_heading_.ocn = 0; comp_obj_heading_.obj_cite_number = ""; + comp_obj_heading_.obj_cite_number_off = ""; + comp_obj_heading_.obj_cite_number_type = 0; comp_obj_heading_.marked_up_level = "B"; comp_obj_heading_.heading_lev_markup = 1; comp_obj_heading_.heading_lev_collapsed = 1; @@ -996,6 +1025,8 @@ template SiSUdocAbstraction() { comp_obj_heading_.text = "Bibliography"; comp_obj_heading_.ocn = 0; comp_obj_heading_.obj_cite_number = ""; + comp_obj_heading_.obj_cite_number_off = ""; + comp_obj_heading_.obj_cite_number_type = 0; comp_obj_heading_.segment_anchor_tag = "_part_bibliography"; comp_obj_heading_.marked_up_level = "B"; comp_obj_heading_.heading_lev_markup = 1; @@ -1011,6 +1042,8 @@ template SiSUdocAbstraction() { comp_obj_heading_.text = "Bibliography"; comp_obj_heading_.ocn = 0; comp_obj_heading_.obj_cite_number = ""; + comp_obj_heading_.obj_cite_number_off = ""; + comp_obj_heading_.obj_cite_number_type = 0; comp_obj_heading_.segment_anchor_tag = "bibliography"; comp_obj_heading_.marked_up_level = "1"; comp_obj_heading_.heading_lev_markup = 4; @@ -1028,6 +1061,8 @@ template SiSUdocAbstraction() { comp_obj_heading_.text = "(skip) there is no Bibliography"; comp_obj_heading_.ocn = 0; comp_obj_heading_.obj_cite_number = ""; + comp_obj_heading_.obj_cite_number_off = ""; + comp_obj_heading_.obj_cite_number_type = 0; comp_obj_heading_.marked_up_level = "B"; comp_obj_heading_.heading_lev_markup = 1; comp_obj_heading_.heading_lev_collapsed = 1; @@ -1059,6 +1094,8 @@ template SiSUdocAbstraction() { comp_obj_para.text = out_.to!string.strip; comp_obj_para.ocn = 0; comp_obj_para.obj_cite_number = ""; + comp_obj_para.obj_cite_number_off = ""; + comp_obj_para.obj_cite_number_type = 0; comp_obj_para.indent_hang = 0; comp_obj_para.indent_base = 1; comp_obj_para.bullet = bullet; @@ -1074,13 +1111,13 @@ template SiSUdocAbstraction() { auto bi_tuple = bi.bookindex_build_abstraction_section( bookindex_unordered_hashes, - obj_cite_digit, + obj_cite_digits, opt_action, ); destroy(bookindex_unordered_hashes); static assert(!isTypeTuple!(bi_tuple)); auto the_bookindex_section = bi_tuple[0]; - obj_cite_digit = bi_tuple[1]; + obj_cite_digits = bi_tuple[1]; debug(bookindex) { foreach (bi_entry; the_bookindex_section["seg"]) { writeln(bi_entry); @@ -1095,6 +1132,8 @@ template SiSUdocAbstraction() { comp_obj_heading_.text = "(skip) there is no Blurb section"; comp_obj_heading_.ocn = 0; comp_obj_para.obj_cite_number = ""; + comp_obj_para.obj_cite_number_off = ""; + comp_obj_para.obj_cite_number_type = 0; comp_obj_heading_.segment_anchor_tag = ""; comp_obj_heading_.marked_up_level = "B"; comp_obj_heading_.heading_lev_markup = 1; @@ -1119,6 +1158,8 @@ template SiSUdocAbstraction() { comp_obj_toc.is_a = "toc"; comp_obj_toc.ocn = 0; comp_obj_toc.obj_cite_number = ""; + comp_obj_toc.obj_cite_number_off = ""; + comp_obj_toc.obj_cite_number_type = 0; comp_obj_toc.indent_hang = indent["hang_position"]; comp_obj_toc.indent_base = indent["base_position"]; comp_obj_toc.bullet = false; @@ -1326,6 +1367,12 @@ template SiSUdocAbstraction() { if (obj.heading_lev_markup <= 4) { segnames_0_4 ~= obj.segment_anchor_tag; } + if (obj.heading_lev_markup == 0) { + assert( obj.ocn == 1, "Title OCN should be 1 not: " ~ obj.ocn.to!string); // bug introduced 0.18.1 + obj.ocn = 1; + obj.obj_cite_number = "1"; + obj.obj_cite_number_type = OCNtype.ocn; + } /+ dom structure (marked up & collapsed) +/ if ((opt_action["html"]) || (opt_action["html-scroll"]) @@ -1437,6 +1484,9 @@ template SiSUdocAbstraction() { debug(dom) { writeln(obj.text); } + obj_cite_digits = ocn_emit(OCNstatus.on); + obj.ocn = obj_cite_digits.digit; + obj.obj_cite_number = obj_cite_digits.on.to!string; if (obj.heading_lev_markup <= 4) { segnames_0_4 ~= obj.segment_anchor_tag; if (obj.heading_lev_markup == 4) { @@ -1468,9 +1518,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; + obj_cite_digits = ocn_emit(OCNstatus.on); + obj.ocn = obj_cite_digits.digit; + obj.obj_cite_number = obj_cite_digits.on.to!string; if (obj.heading_lev_markup <= 4) { segnames_0_4 ~= obj.segment_anchor_tag; if (obj.heading_lev_markup == 4) { @@ -1493,9 +1543,9 @@ template SiSUdocAbstraction() { } 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; + obj_cite_digits = ocn_emit(OCNstatus.on); + obj.ocn = obj_cite_digits.digit; + obj.obj_cite_number = obj_cite_digits.on.to!string; } } } @@ -1506,9 +1556,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; + obj_cite_digits = ocn_emit(OCNstatus.on); + obj.ocn = obj_cite_digits.digit; + obj.obj_cite_number = obj_cite_digits.on.to!string; // check if (obj.heading_lev_markup <= 4) { segnames_0_4 ~= obj.segment_anchor_tag; if (obj.heading_lev_markup == 4) { @@ -1531,14 +1581,14 @@ template SiSUdocAbstraction() { } 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; + obj_cite_digits = ocn_emit(OCNstatus.on); + obj.ocn = obj_cite_digits.on; + obj.obj_cite_number = obj_cite_digits.on.to!string; } } } /+ optional only one 1~ level +/ - int ocn_ = obj_cite_digit; + int ocn_ = obj_cite_digits.on; int ocn_bkidx_ = 0; int ocn_bidx_; if (the_bookindex_section["scroll"].length > 1) { @@ -1549,9 +1599,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; + obj_cite_digits = ocn_emit(OCNstatus.on); + obj.ocn = obj_cite_digits.on; + obj.obj_cite_number = obj_cite_digits.on.to!string; if (obj.heading_lev_markup <= 4) { segnames_0_4 ~= obj.segment_anchor_tag; if (obj.heading_lev_markup == 4) { @@ -1574,8 +1624,9 @@ template SiSUdocAbstraction() { } 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_cite_digits = ocn_emit(OCNstatus.bkidx); + obj.ocn = obj_cite_digits.digit; + obj.obj_cite_number_bkidx = obj_cite_digits.bkidx.to!string; obj.obj_cite_number_type = OCNtype.bkidx; } } @@ -1616,7 +1667,6 @@ template SiSUdocAbstraction() { obj.obj_cite_number_type = OCNtype.bkidx; } } - assert(obj_cite_digit == ocn_); assert(obj_cite_digit_bkidx == ocn_bidx_); } /+ optional only one 1~ level +/ @@ -1626,9 +1676,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; + obj_cite_digits = ocn_emit(OCNstatus.on); + obj.ocn = obj_cite_digits.on; + obj.obj_cite_number = obj_cite_digits.on.to!string; if (obj.heading_lev_markup <= 4) { segnames_0_4 ~= obj.segment_anchor_tag; if (obj.heading_lev_markup == 4) { @@ -1651,8 +1701,8 @@ template SiSUdocAbstraction() { } 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_cite_digits = ocn_emit(OCNstatus.off); + obj.obj_cite_number_off = obj_cite_digits.off.to!string; obj.obj_cite_number_type = OCNtype.non; } } @@ -1670,6 +1720,8 @@ template SiSUdocAbstraction() { comp_obj_heading_.is_a = "heading"; comp_obj_heading_.ocn = 0; comp_obj_para.obj_cite_number = ""; + comp_obj_para.obj_cite_number_off = ""; + comp_obj_para.obj_cite_number_type = 0; comp_obj_heading_.segment_anchor_tag = ""; comp_obj_heading_.marked_up_level = ""; comp_obj_heading_.heading_lev_markup = 9; @@ -1749,7 +1801,7 @@ template SiSUdocAbstraction() { destroy(bookindex_unordered_hashes); destroy(an_object); biblio_arr_json = []; - obj_cite_digit=0; + obj_cite_digits=ocn_emit(OCNstatus.reset); obj_cite_digit_=0; html_segnames_ptr=0; html_segnames_ptr_cntr=0; @@ -1790,10 +1842,10 @@ template SiSUdocAbstraction() { static assert(is(typeof(an_object) == string[string])); static assert(is(typeof(obj_type_status) == int[string])); } - line_occur["heading"] = State.off; - line_occur["para"] = State.off; - obj_type_status["heading"] = State.off; - obj_type_status["para"] = State.off; + line_occur["heading"] = State.off; + line_occur["para"] = State.off; + obj_type_status["heading"] = State.off; + obj_type_status["para"] = State.off; an_object = object_reset(an_object); } static auto _check_ocn_status_(L,T)( @@ -1824,11 +1876,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"] = OCNstatus.exc; + obj_type_status["ocn_status"] = OCNstatus.off; } else if (line.matchFirst(rgx.obj_cite_number_off_dh)) { obj_type_status["ocn_status"] = OCNstatus.closing; } else { - obj_type_status["ocn_status"] = OCNstatus.inc; + obj_type_status["ocn_status"] = OCNstatus.on; } } else { obj_type_status["ocn_status"] = @@ -1838,7 +1890,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"] = OCNstatus.inc; + obj_type_status["ocn_status"] = OCNstatus.on; debug(ocnoff) { writeln(line); } @@ -1880,8 +1932,7 @@ template SiSUdocAbstraction() { line ); } - obj_cite_number_poem["start"] = - obj_cite_digit.to!string; + obj_cite_number_poem["start"] = obj_cite_digits.on.to!string; obj_type_status["blocks"] = TriState.on; obj_type_status["verse_new"] = State.on; obj_type_status["poem"] = TriState.on; @@ -1960,7 +2011,7 @@ template SiSUdocAbstraction() { line ); } - obj_cite_number_poem["start"] = obj_cite_digit.to!string; + obj_cite_number_poem["start"] = obj_cite_digits.on.to!string; obj_type_status["blocks"] = TriState.on; obj_type_status["verse_new"] = State.on; obj_type_status["poem"] = TriState.on; @@ -2177,14 +2228,14 @@ template SiSUdocAbstraction() { writeln(__LINE__); writefln( "* %s %s", - obj_cite_digit, + obj_cite_digits.on, line ); } if (an_object.length > 0) { debug(poem) { // poem (curly) close writeln( - obj_cite_digit, + obj_cite_digits.on, an_object[an_object_key] ); } @@ -2198,8 +2249,11 @@ 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_digit; - comp_obj_block.obj_cite_number = (obj_cite_digit==0) ? "" : obj_cite_digit.to!string; + comp_obj_block.ocn = obj_cite_digits.on; + comp_obj_block.obj_cite_number = (obj_cite_digits.on==0) ? "" : obj_cite_digits.on.to!string; + comp_obj_block.obj_cite_number_off = (obj_cite_digits.off==0) ? "" : obj_cite_digits.off.to!string; + comp_obj_block.obj_cite_number_bkidx = (obj_cite_digits.bkidx==0) ? "" : obj_cite_digits.bkidx.to!string; + comp_obj_block.obj_cite_number_type = obj_cite_digits.type; 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]; @@ -2210,16 +2264,14 @@ template SiSUdocAbstraction() { processing.remove("verse"); ++cntr; } - obj_cite_number_poem["end"] = - obj_cite_digit.to!string; + obj_cite_number_poem["end"] = obj_cite_digits.on.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_digit = - ocn_emit(obj_type_status["ocn_status"]); + obj_cite_digits = ocn_emit(OCNstatus.on); obj_type_status["verse_new"] = State.off; } else if (line.matchFirst(rgx.newline_eol_delimiter_only)) { processing["verse"] = processing["verse"].stripRight; @@ -2232,7 +2284,7 @@ template SiSUdocAbstraction() { debug(poem) { // poem verse writefln( "* %s curly\n%s", - obj_cite_digit, + obj_cite_digits.on, an_object[an_object_key] ); } @@ -2241,7 +2293,7 @@ template SiSUdocAbstraction() { auto comp_obj_location = node_construct.node_location_emitter( content_non_header, segment_anchor_tag_that_object_belongs_to, - obj_cite_digit, + obj_cite_digits, cntr, heading_ptr-1, an_object["is"] @@ -2255,8 +2307,11 @@ 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_digit; - comp_obj_block.obj_cite_number = (obj_cite_digit==0) ? "" : obj_cite_digit.to!string; + comp_obj_block.ocn = obj_cite_digits.on; + comp_obj_block.obj_cite_number = (obj_cite_digits.on==0) ? "" : obj_cite_digits.on.to!string; + comp_obj_block.obj_cite_number_off = (obj_cite_digits.off==0) ? "" : obj_cite_digits.off.to!string; + comp_obj_block.obj_cite_number_bkidx = (obj_cite_digits.bkidx==0) ? "" : obj_cite_digits.bkidx.to!string; + comp_obj_block.obj_cite_number_type = obj_cite_digits.type; 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]; @@ -2282,7 +2337,7 @@ template SiSUdocAbstraction() { if (an_object.length > 0) { debug(poem) { // poem (tic) close writeln(__LINE__); - writeln(obj_cite_digit, line); + writeln(obj_cite_digits.on, line); } processing.remove("verse"); an_object["is"] = "verse"; @@ -2295,14 +2350,17 @@ 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_digit; - comp_obj_block.obj_cite_number = (obj_cite_digit==0) ? "" : obj_cite_digit.to!string; + comp_obj_block.ocn = obj_cite_digits.on; + comp_obj_block.obj_cite_number = (obj_cite_digits.on==0) ? "" : obj_cite_digits.on.to!string; + comp_obj_block.obj_cite_number_off = (obj_cite_digits.off==0) ? "" : obj_cite_digits.off.to!string; + comp_obj_block.obj_cite_number_bkidx = (obj_cite_digits.bkidx==0) ? "" : obj_cite_digits.bkidx.to!string; + comp_obj_block.obj_cite_number_type = obj_cite_digits.type; 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_digit.to!string; + obj_cite_number_poem["end"] = obj_cite_digits.on.to!string; object_reset(an_object); processing.remove("verse"); ++cntr; @@ -2313,8 +2371,7 @@ template SiSUdocAbstraction() { } else { processing["verse"] ~= line ~= "\n"; if (obj_type_status["verse_new"] == State.on) { - obj_cite_digit = - ocn_emit(obj_type_status["ocn_status"]); + obj_cite_digits = ocn_emit(OCNstatus.on); obj_type_status["verse_new"] = State.off; } else if (line.matchFirst(rgx.newline_eol_delimiter_only)) { processing["verse"] = processing["verse"].stripRight; @@ -2327,7 +2384,7 @@ template SiSUdocAbstraction() { debug(poem) { // poem (tic) close writefln( "* %s tic\n%s", - obj_cite_digit, + obj_cite_digits.on, an_object[an_object_key] ); } @@ -2337,7 +2394,7 @@ template SiSUdocAbstraction() { node_construct.node_location_emitter( content_non_header, segment_anchor_tag_that_object_belongs_to, - obj_cite_digit, + obj_cite_digits, cntr, heading_ptr-1, an_object["is"] @@ -2351,8 +2408,11 @@ 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_digit; - comp_obj_block.obj_cite_number = (obj_cite_digit==0) ? "" : obj_cite_digit.to!string; + comp_obj_block.ocn = obj_cite_digits.on; + comp_obj_block.obj_cite_number = (obj_cite_digits.on==0) ? "" : obj_cite_digits.on.to!string; + comp_obj_block.obj_cite_number_off = (obj_cite_digits.off==0) ? "" : obj_cite_digits.off.to!string; + comp_obj_block.obj_cite_number_bkidx = (obj_cite_digits.bkidx==0) ? "" : obj_cite_digits.bkidx.to!string; + comp_obj_block.obj_cite_number_type = obj_cite_digits.type; 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]; @@ -2447,7 +2507,7 @@ template SiSUdocAbstraction() { line, an_object, the_document_body_section, - obj_cite_digit, + obj_cite_digits, comp_obj_heading, cntr, obj_type_status, @@ -2619,24 +2679,23 @@ template SiSUdocAbstraction() { header_tag_value=""; } } - void _table_closed_make_special_notation_table_( + void _table_closed_make_special_notation_table_(N)( char[] line, return ref string[string] an_object, return ref ObjGenericComposite[] the_document_body_section, - return ref int obj_cite_digit, + return ref N obj_cite_digits, 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_digit = - ocn_emit(obj_type_status["ocn_status"]); + obj_cite_digits = ocn_emit(OCNstatus.on); auto comp_obj_location = node_construct.node_location_emitter( content_non_header, segment_anchor_tag_that_object_belongs_to, - obj_cite_digit, + obj_cite_digits, cntr, heading_ptr-1, "table" @@ -2644,23 +2703,26 @@ template SiSUdocAbstraction() { an_object["is"] = "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_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; + an_object["substantive"] = substantive_obj_misc_tuple[sObj.content]; + comp_obj_block.ocn = obj_cite_digits.on; + comp_obj_block.obj_cite_number = (obj_cite_digits.on==0) ? "" : obj_cite_digits.on.to!string; + comp_obj_block.obj_cite_number_off = (obj_cite_digits.off==0) ? "" : obj_cite_digits.off.to!string; + comp_obj_block.obj_cite_number_bkidx = (obj_cite_digits.bkidx==0) ? "" : obj_cite_digits.bkidx.to!string; + comp_obj_block.obj_cite_number_type = obj_cite_digits.type; + 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; object_reset(an_object); processing.remove("verse"); ++cntr; } - void _block_flag_line_empty_(B)( + void _block_flag_line_empty_(B,N)( B bookindex_extract_hash, char[] line, 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_digit, + return ref N obj_cite_digits, return ref ObjGenericComposite _comp_obj_heading, return ref int cntr, return ref int[string] obj_type_status, @@ -2678,14 +2740,13 @@ template SiSUdocAbstraction() { ); assertions_flag_types_block_status_none_or_closed(obj_type_status); if (obj_type_status["quote"] == TriState.closing) { - obj_cite_digit = - ocn_emit(obj_type_status["ocn_status"]); + obj_cite_digits = ocn_emit(OCNstatus.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_digit, + obj_cite_digits, segment_anchor_tag_that_object_belongs_to ); an_object["is"] = "quote"; @@ -2693,7 +2754,7 @@ template SiSUdocAbstraction() { node_construct.node_location_emitter( content_non_header, segment_anchor_tag_that_object_belongs_to, - obj_cite_digit, + obj_cite_digits, cntr, heading_ptr-1, an_object["is"] @@ -2707,8 +2768,11 @@ 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_digit; - comp_obj_block.obj_cite_number = (obj_cite_digit==0) ? "" : obj_cite_digit.to!string; + comp_obj_block.ocn = obj_cite_digits.on; + comp_obj_block.obj_cite_number = (obj_cite_digits.on==0) ? "" : obj_cite_digits.on.to!string; + comp_obj_block.obj_cite_number_off = (obj_cite_digits.off==0) ? "" : obj_cite_digits.off.to!string; + comp_obj_block.obj_cite_number_bkidx = (obj_cite_digits.bkidx==0) ? "" : obj_cite_digits.bkidx.to!string; + comp_obj_block.obj_cite_number_type = obj_cite_digit_type; 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]; @@ -2720,14 +2784,13 @@ template SiSUdocAbstraction() { processing.remove("verse"); ++cntr; } else if (obj_type_status["group"] == TriState.closing) { - obj_cite_digit = - ocn_emit(obj_type_status["ocn_status"]); + obj_cite_digits = ocn_emit(OCNstatus.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_digit, + obj_cite_digits, segment_anchor_tag_that_object_belongs_to ); an_object["is"] = "group"; @@ -2735,7 +2798,7 @@ template SiSUdocAbstraction() { node_construct.node_location_emitter( content_non_header, segment_anchor_tag_that_object_belongs_to, - obj_cite_digit, + obj_cite_digits, cntr, heading_ptr-1, an_object["is"] @@ -2749,8 +2812,11 @@ 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_digit; - comp_obj_block.obj_cite_number = (obj_cite_digit==0) ? "" : obj_cite_digit.to!string; + comp_obj_block.ocn = obj_cite_digits.on; + comp_obj_block.obj_cite_number = (obj_cite_digits.on==0) ? "" : obj_cite_digits.on.to!string; + comp_obj_block.obj_cite_number_off = (obj_cite_digits.off==0) ? "" : obj_cite_digits.off.to!string; + comp_obj_block.obj_cite_number_bkidx = (obj_cite_digits.bkidx==0) ? "" : obj_cite_digits.bkidx.to!string; + comp_obj_block.obj_cite_number_type = obj_cite_digits.type; 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]; @@ -2762,13 +2828,13 @@ template SiSUdocAbstraction() { processing.remove("verse"); ++cntr; } else if (obj_type_status["block"] == TriState.closing) { - obj_cite_digit = ocn_emit(obj_type_status["ocn_status"]); + obj_cite_digits = ocn_emit(OCNstatus.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_digit, + obj_cite_digits, segment_anchor_tag_that_object_belongs_to ); an_object["is"] = "block"; @@ -2776,7 +2842,7 @@ template SiSUdocAbstraction() { node_construct.node_location_emitter( content_non_header, segment_anchor_tag_that_object_belongs_to, - obj_cite_digit, + obj_cite_digits, cntr, heading_ptr-1, an_object["is"] @@ -2789,8 +2855,11 @@ 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_digit; - comp_obj_block.obj_cite_number = (obj_cite_digit==0) ? "" : obj_cite_digit.to!string; + comp_obj_block.ocn = obj_cite_digits.on; + comp_obj_block.obj_cite_number = (obj_cite_digits.on==0) ? "" : obj_cite_digits.on.to!string; + comp_obj_block.obj_cite_number_off = (obj_cite_digits.off==0) ? "" : obj_cite_digits.off.to!string; + comp_obj_block.obj_cite_number_bkidx = (obj_cite_digits.bkidx==0) ? "" : obj_cite_digits.bkidx.to!string; + comp_obj_block.obj_cite_number_type = obj_cite_digit_type; 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]; @@ -2807,7 +2876,7 @@ template SiSUdocAbstraction() { bookindex_unordered_hashes = bookindex_extract_hash.bookindex_nugget_hash( an_object["bookindex_nugget"], - obj_cite_digit, + obj_cite_digits, segment_anchor_tag_that_object_belongs_to ); an_object["is"] = "verse"; @@ -2815,7 +2884,7 @@ template SiSUdocAbstraction() { node_construct.node_location_emitter( content_non_header, segment_anchor_tag_that_object_belongs_to, - obj_cite_digit, + obj_cite_digits, cntr, heading_ptr-1, an_object["is"] @@ -2825,8 +2894,11 @@ 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_digit; + comp_obj_poem_ocn.ocn = obj_cite_digits.on; comp_obj_poem_ocn.obj_cite_number = (obj_cite_number_poem["start"], obj_cite_number_poem["end"]); + comp_obj_poem_ocn.obj_cite_number_off = (obj_cite_digits.off==0) ? "" : obj_cite_digits.off.to!string; // + comp_obj_poem_ocn.obj_cite_number_bkidx = (obj_cite_digits.bkidx==0) ? "" : obj_cite_digits.bkidx.to!string; // + comp_obj_poem_ocn.obj_cite_number_type = obj_cite_digits.type; comp_obj_poem_ocn.text = ""; the_document_body_section ~= comp_obj_poem_ocn; obj_type_status["blocks"] = TriState.off; @@ -2834,14 +2906,13 @@ template SiSUdocAbstraction() { object_reset(an_object); processing.remove("verse"); } else if (obj_type_status["code"] == TriState.closing) { - obj_cite_digit = - ocn_emit(obj_type_status["ocn_status"]); + obj_cite_digits = ocn_emit(OCNstatus.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_digit, + obj_cite_digits, segment_anchor_tag_that_object_belongs_to ); an_object["is"] = "code"; @@ -2849,7 +2920,7 @@ template SiSUdocAbstraction() { node_construct.node_location_emitter( content_non_header, segment_anchor_tag_that_object_belongs_to, - obj_cite_digit, + obj_cite_digits, cntr, heading_ptr-1, an_object["is"] @@ -2863,8 +2934,11 @@ 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_digit; - comp_obj_code.obj_cite_number = (obj_cite_digit==0) ? "" : obj_cite_digit.to!string; + comp_obj_code.ocn = obj_cite_digits.on; + comp_obj_code.obj_cite_number = (obj_cite_digits.on==0) ? "" : obj_cite_digits.on.to!string; + comp_obj_block.obj_cite_number_off = (obj_cite_digits.off==0) ? "" : obj_cite_digits.off.to!string; + comp_obj_block.obj_cite_number_bkidx = (obj_cite_digits.bkidx==0) ? "" : obj_cite_digits.bkidx.to!string; + comp_obj_block.obj_cite_number_type = obj_cite_digits.type; 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]; @@ -2877,14 +2951,13 @@ template SiSUdocAbstraction() { ++cntr; } else if (obj_type_status["table"] == TriState.closing) { comp_obj_block = comp_obj_block.init; - obj_cite_digit = - ocn_emit(obj_type_status["ocn_status"]); + obj_cite_digits = ocn_emit(OCNstatus.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_digit, + obj_cite_digits, segment_anchor_tag_that_object_belongs_to ); an_object["is"] = "table"; @@ -2892,7 +2965,7 @@ template SiSUdocAbstraction() { node_construct.node_location_emitter( content_non_header, segment_anchor_tag_that_object_belongs_to, - obj_cite_digit, + obj_cite_digits, cntr, heading_ptr-1, an_object["is"] @@ -2901,8 +2974,11 @@ 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_digit; - comp_obj_block.obj_cite_number = (obj_cite_digit==0) ? "" : obj_cite_digit.to!string; + comp_obj_block.ocn = obj_cite_digits.on; + comp_obj_block.obj_cite_number = (obj_cite_digits.on==0) ? "" : obj_cite_digits.on.to!string; + comp_obj_block.obj_cite_number_off = (obj_cite_digits.off==0) ? "" : obj_cite_digits.off.to!string; + comp_obj_block.obj_cite_number_bkidx = (obj_cite_digits.bkidx==0) ? "" : obj_cite_digits.bkidx.to!string; + comp_obj_block.obj_cite_number_type = obj_cite_digits.type; 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; @@ -3149,19 +3225,19 @@ template SiSUdocAbstraction() { static auto rgx = Rgx(); if (auto m = line.match(rgx.heading)) { /+ heading match +/ - obj_type_status["heading"] = State.on; + ++line_occur["heading"]; + obj_type_status["heading"] = State.on; + obj_type_status["para"] = State.off; if (line.match(rgx.heading_seg_and_above)) { - obj_type_status["biblio_section"] = State.off; + obj_type_status["biblio_section"] = State.off; obj_type_status["glossary_section"] = State.off; - obj_type_status["blurb_section"] = State.off; + obj_type_status["blurb_section"] = State.off; } - obj_type_status["para"] = State.off; - ++line_occur["heading"]; an_object[an_object_key] ~= line ~= "\n"; an_object["lev"] ~= m.captures[1]; assertions_doc_structure(an_object, lv); // includes most of the logic for collapsed levels switch (an_object["lev"]) { - case "A": + case "A": // Title set an_object[an_object_key]=(an_object[an_object_key]) .replaceFirst(rgx.variable_doc_title, (dochead_meta_aa["title"]["full"] ~ ",")) @@ -3556,23 +3632,24 @@ template SiSUdocAbstraction() { /+ abstraction functions ↑ +/ /+ ↓ abstraction function emitters +/ pure struct OCNemitter { - int ocn_, ocn_in, ocn_in_, ocn_out_, ocn_bkidx_; - int ocn_emitter(int ocn_status_flag) - in { assert(ocn_status_flag <= OCNstatus.reset); } - body { + int ocn_, ocn_on, ocn_on_, ocn_off, ocn_off_, ocn_bkidx, ocn_bkidx_; + auto ocn_emitter(int ocn_status_flag) { + OCNset ocn; + assert(ocn_status_flag <= OCNstatus.reset); + ocn_on = ocn_off = ocn_bkidx = 0; switch(ocn_status_flag) { case OCNstatus.reset: - ocn_ = ocn_in_ = ocn_out_ = 1; + ocn_ = ocn_on_ = ocn_off_ = 1; ocn_bkidx_ = 0; break; - case OCNstatus.inc: - ocn_ = ++ocn_in_; + case OCNstatus.on: + ocn_ = ocn_on = ++ocn_on_; break; - case OCNstatus.exc: - ocn_ = ++ocn_out_; + case OCNstatus.off: + ocn_ = ocn_off = ++ocn_off_; break; case OCNstatus.bkidx: - ocn_ = ++ocn_bkidx_; + ocn_ = ocn_bkidx = ++ocn_bkidx_; break; case OCNstatus.closing: break; @@ -3580,7 +3657,12 @@ template SiSUdocAbstraction() { ocn_ = 0; } assert(ocn_ >= 0); - return ocn_; + ocn.digit = ocn_; + ocn.on = ocn_on; + ocn.off = ocn_off; + ocn.bkidx = ocn_bkidx; + ocn.type = ocn_status_flag; + return ocn; } invariant() { } @@ -3600,7 +3682,7 @@ template SiSUdocAbstraction() { n_foot_sp_asterisk = 0; n_foot_sp_plus = 0; } - static string url_links(Ot)(Ot obj_txt_in) { + static auto url_links(Ot)(Ot obj_txt_in) { debug(asserts) { static assert(is(typeof(obj_txt_in) == string)); } @@ -4038,6 +4120,8 @@ template SiSUdocAbstraction() { comp_obj_toc.is_a = "toc"; comp_obj_toc.ocn = 0; comp_obj_toc.obj_cite_number = ""; + comp_obj_toc.obj_cite_number_off = ""; + comp_obj_toc.obj_cite_number_type = 0; comp_obj_toc.indent_hang = indent["hang_position"]; comp_obj_toc.indent_base = indent["base_position"]; comp_obj_toc.bullet = false; @@ -4056,6 +4140,8 @@ template SiSUdocAbstraction() { comp_obj_toc.is_a = "toc"; comp_obj_toc.ocn = 0; comp_obj_toc.obj_cite_number = ""; + comp_obj_toc.obj_cite_number_off = ""; + comp_obj_toc.obj_cite_number_type = 0; comp_obj_toc.indent_hang = indent["hang_position"]; comp_obj_toc.indent_base = indent["base_position"]; comp_obj_toc.bullet = false; @@ -4070,6 +4156,8 @@ template SiSUdocAbstraction() { comp_obj_toc.is_a = "toc"; comp_obj_toc.ocn = 0; comp_obj_toc.obj_cite_number = ""; + comp_obj_toc.obj_cite_number_off = ""; + comp_obj_toc.obj_cite_number_type = 0; comp_obj_toc.bullet = false; comp_obj_toc.inline_links = true; switch (obj_["lev_markup_number"].to!int) { @@ -4634,19 +4722,19 @@ template SiSUdocAbstraction() { string[] bi_main_terms_split_arr; string[][string][string] bookindex_nugget_hash(BI,N,S)( BI bookindex_section, - N obj_cite_digit, + N obj_cite_digits, S segment_anchor_tag, ) in { debug(asserts) { static assert(is(typeof(bookindex_section) == string)); - static assert(is(typeof(obj_cite_digit) == int)); + static assert(is(typeof(obj_cite_digits.on) == int)); } debug(bookindexraw) { if (!bookindex_section.empty) { writeln( "* [bookindex] ", - "[", obj_cite_digit.to!string, ": ", segment_anchor_tag, "] ", bookindex_section + "[", obj_cite_digits.on.to!string, ": ", segment_anchor_tag, "] ", bookindex_section ); } } @@ -4664,12 +4752,12 @@ template SiSUdocAbstraction() { ) { main_term = m.captures[1].strip; obj_cite_number_offset = m.captures[2].to!int; - 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) + obj_cite_number_endpoint=(obj_cite_digits.on + obj_cite_number_offset); + obj_cite_numbers ~= (obj_cite_digits.on.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_digit.to!string + obj_cite_numbers ~= obj_cite_digits.on.to!string ~ ":" ~ segment_anchor_tag; } bi[main_term]["_a"] ~= obj_cite_numbers; @@ -4683,12 +4771,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_digit + obj_cite_number_offset); - obj_cite_numbers ~= (obj_cite_digit.to!string ~ " - " ~ to!string(obj_cite_number_endpoint) + obj_cite_number_endpoint=(obj_cite_digits.on + obj_cite_number_offset); + obj_cite_numbers ~= (obj_cite_digits.on.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_digit) + obj_cite_numbers ~= to!string(obj_cite_digits.on) ~ ":" ~ segment_anchor_tag; } if (!empty(sub_term)) { @@ -4769,12 +4857,12 @@ template SiSUdocAbstraction() { } auto bookindex_build_abstraction_section(BI,N,B)( BI bookindex_unordered_hashes, - N obj_cite_digit, + N obj_cite_digits, B opt_action, ) { debug(asserts) { static assert(is(typeof(bookindex_unordered_hashes) == string[][string][string])); - static assert(is(typeof(obj_cite_digit) == int)); + static assert(is(typeof(obj_cite_digits.on) == int)); static assert(is(typeof(opt_action) == bool[string])); } mixin SiSUnode; @@ -4804,6 +4892,8 @@ template SiSUdocAbstraction() { comp_obj_heading_.text = "Book Index"; comp_obj_heading_.ocn = 0; comp_obj_heading_.obj_cite_number = ""; + comp_obj_heading_.obj_cite_number_off = ""; + comp_obj_heading_.obj_cite_number_type = 0; comp_obj_heading_.segment_anchor_tag = "_part_book_index"; comp_obj_heading_.marked_up_level = "B"; comp_obj_heading_.heading_lev_markup = 1; @@ -4822,6 +4912,8 @@ template SiSUdocAbstraction() { comp_obj_heading_.text = "Index"; comp_obj_heading_.ocn = 0; comp_obj_heading_.obj_cite_number = ""; + comp_obj_heading_.obj_cite_number_off = ""; + comp_obj_heading_.obj_cite_number_type = 0; comp_obj_heading_.segment_anchor_tag = "bookindex"; comp_obj_heading_.marked_up_level = "1"; comp_obj_heading_.heading_lev_markup = 4; @@ -4898,6 +4990,8 @@ template SiSUdocAbstraction() { comp_obj_para.text = bi_tmp_scroll.to!string.strip; comp_obj_para.ocn = 0; comp_obj_para.obj_cite_number = ""; + comp_obj_para.obj_cite_number_off = ""; + comp_obj_para.obj_cite_number_type = 0; comp_obj_para.anchor_tags = bi_tmp_tags; comp_obj_para.indent_hang = 0; comp_obj_para.indent_base = 1; @@ -4913,6 +5007,8 @@ template SiSUdocAbstraction() { comp_obj_heading_.text = "(skip) there is no Book Index"; comp_obj_heading_.ocn = 0; comp_obj_heading_.obj_cite_number = ""; + comp_obj_heading_.obj_cite_number_off = ""; + comp_obj_heading_.obj_cite_number_type = 0; comp_obj_heading_.marked_up_level = "B"; comp_obj_heading_.heading_lev_markup = 1; comp_obj_heading_.heading_lev_collapsed = 1; @@ -4921,7 +5017,7 @@ template SiSUdocAbstraction() { bookindex_section["scroll"] ~= comp_obj_heading_; bookindex_section["seg"] ~= comp_obj_heading_; } - auto t = tuple(bookindex_section, obj_cite_digit); + auto t = tuple(bookindex_section, obj_cite_digits); return t; } } @@ -5001,8 +5097,8 @@ template SiSUdocAbstraction() { } return endnotes_; } - private auto endnote_objects( - int obj_cite_digit, + private auto endnote_objects(N)( + N obj_cite_digits, bool[string] opt_action, ) in { @@ -5026,6 +5122,8 @@ template SiSUdocAbstraction() { comp_obj_heading_.text = "Endnotes"; comp_obj_heading_.ocn = 0; comp_obj_heading_.obj_cite_number = ""; + comp_obj_heading_.obj_cite_number_off = ""; + comp_obj_heading_.obj_cite_number_type = 0; comp_obj_heading_.segment_anchor_tag = "_part_endnotes"; comp_obj_heading_.marked_up_level = "B"; comp_obj_heading_.heading_lev_markup = 1; @@ -5033,7 +5131,6 @@ template SiSUdocAbstraction() { comp_obj_heading_.parent_ocn = 1; comp_obj_heading_.parent_lev_markup = 0; the_endnotes_section ~= comp_obj_heading_; - ++obj_cite_digit; ++mkn; comp_obj_heading_ = comp_obj_heading_.init; comp_obj_heading_.of_part = "backmatter"; @@ -5043,6 +5140,8 @@ template SiSUdocAbstraction() { comp_obj_heading_.text = "Endnotes"; comp_obj_heading_.ocn = 0; comp_obj_heading_.obj_cite_number = ""; + comp_obj_heading_.obj_cite_number_off = ""; + comp_obj_heading_.obj_cite_number_type = 0; comp_obj_heading_.segment_anchor_tag = "endnotes"; comp_obj_heading_.marked_up_level = "1"; comp_obj_heading_.heading_lev_markup = 4; @@ -5051,7 +5150,6 @@ template SiSUdocAbstraction() { comp_obj_heading_.parent_lev_markup = 0; comp_obj_heading_.anchor_tags = ["endnotes"]; the_endnotes_section ~= comp_obj_heading_; - ++obj_cite_digit; ++mkn; } else { comp_obj_heading_ = comp_obj_heading_.init; @@ -5062,6 +5160,8 @@ template SiSUdocAbstraction() { comp_obj_heading_.text = "(skip) there are no Endnotes"; comp_obj_heading_.ocn = 0; comp_obj_heading_.obj_cite_number = ""; + comp_obj_heading_.obj_cite_number_off = ""; + comp_obj_heading_.obj_cite_number_type = 0; comp_obj_heading_.marked_up_level = "B"; comp_obj_heading_.heading_lev_markup = 1; comp_obj_heading_.heading_lev_collapsed = 1; @@ -5078,6 +5178,8 @@ template SiSUdocAbstraction() { comp_obj_endnote_.is_a = "endnote"; comp_obj_endnote_.ocn = 0; comp_obj_heading_.obj_cite_number = ""; + comp_obj_heading_.obj_cite_number_off = ""; + comp_obj_heading_.obj_cite_number_type = 0; comp_obj_endnote_.indent_hang = 0; comp_obj_endnote_.indent_base = 0; comp_obj_endnote_.bullet = false; @@ -5091,7 +5193,7 @@ template SiSUdocAbstraction() { the_endnotes_section ~= comp_obj_endnote_; } } - auto t = tuple(the_endnotes_section, obj_cite_digit); + auto t = tuple(the_endnotes_section, obj_cite_digits); return t; } } @@ -5204,7 +5306,7 @@ template SiSUdocAbstraction() { ObjGenericComposite node_location_emitter(Lv,Ta,N,C,P,I)( Lv lev_markup_number, Ta segment_anchor_tag, - N obj_cite_digit_, + N obj_cite_digits, C cntr_, P ptr_, I is_ @@ -5213,18 +5315,17 @@ 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_digit_) == int)); + static assert(is(typeof(obj_cite_digits.on) == 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_digit_.to!int >= 0); + assert(obj_cite_digits.on.to!int >= 0); } body { assert(is_ != "heading"); // should not be necessary - assert(obj_cite_digit_.to!int >= 0); // should not be necessary - int obj_cite_digit = obj_cite_digit_.to!int; + assert(obj_cite_digits.on.to!int >= 0); // should not be necessary if (lv7 > State.off) { p_["lev_markup_number"] = DocStructMarkupHeading.h_text_4; p_["obj_cite_number"] = lv7; @@ -5241,7 +5342,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_digit_; + comp_obj_location.ocn = obj_cite_digits.on; 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"]; @@ -5265,7 +5366,7 @@ template SiSUdocAbstraction() { Lm lev_markup_number, Lc lev_collapsed_number, Ta segment_anchor_tag, - N obj_cite_digit_, + N obj_cite_digits, C cntr_, P ptr_, LA lv_ancestors_txt, @@ -5282,7 +5383,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_digit_) == int)); + static assert(is(typeof(obj_cite_digits.on) == int)); static assert(is(typeof(cntr_) == int)); static assert(is(typeof(ptr_) == int)); static assert(is(typeof(lv_ancestors_txt) == string[])); @@ -5290,19 +5391,18 @@ template SiSUdocAbstraction() { static assert(is(typeof(html_segnames_ptr) == int)); } assert(is_ == "heading"); - assert((obj_cite_digit_).to!int >= 0); + assert((obj_cite_digits.on).to!int >= 0); assert( lev_markup_number.match(rgx.levels_numbered), - ("not a valid heading level: " ~ lev_markup_number ~ " at " ~ obj_cite_digit_.to!string) + ("not a valid heading level: " ~ lev_markup_number ~ " at " ~ obj_cite_digits.on.to!string) ); if (lev_markup_number.match(rgx.levels_numbered)) { if (lev_markup_number.to!int == 0) { - assert(obj_cite_digit_.to!int == 1); + assert(obj_cite_digits.on.to!int == 1); } } } body { - int obj_cite_digit = obj_cite_digit_.to!int; switch (lev_markup_number.to!int) { case 0: lv = DocStructMarkupHeading.h_sect_A; @@ -5390,8 +5490,10 @@ 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_digit_; - _comp_obj_heading_.obj_cite_number = (obj_cite_digit==0) ? "" : obj_cite_digit.to!string; + _comp_obj_heading_.ocn = obj_cite_digits.on; + _comp_obj_heading_.obj_cite_number = (obj_cite_digits.on==0) ? "" : obj_cite_digits.on.to!string; + _comp_obj_heading_.obj_cite_number_off = (obj_cite_digits.off==0) ? "" : obj_cite_digits.off.to!string; + _comp_obj_heading_.obj_cite_number_type = obj_cite_digits.type; _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/metadoc_summary.d b/src/sdp/meta/metadoc_summary.d index 591844f..a415387 100644 --- a/src/sdp/meta/metadoc_summary.d +++ b/src/sdp/meta/metadoc_summary.d @@ -33,10 +33,13 @@ template SiSUabstractionSummary() { if (k == "body") { check["last_obj_cite_number_body"] = obj.obj_cite_number; } - if ((k != "bookindex_seg") && (k != "blurb")) { + if (!(obj.obj_cite_number.empty)) { check["last_obj_cite_number"] = obj.obj_cite_number; - } else if (k == "bookindex_seg") { - check["last_obj_cite_number_bkidx"] = obj.obj_cite_number; + } + } + if (k == "bookindex_seg") { + if (obj.obj_cite_number_type == 2) { + check["last_obj_cite_number_bkidx"] = obj.obj_cite_number_bkidx; } } } diff --git a/src/sdp/meta/object_setter.d b/src/sdp/meta/object_setter.d index 805afd3..e4bb05f 100644 --- a/src/sdp/meta/object_setter.d +++ b/src/sdp/meta/object_setter.d @@ -23,7 +23,7 @@ template ObjectSetter() { string is_a = ""; string text = ""; string obj_cite_number = ""; - string obj_cite_number_non = ""; + string obj_cite_number_off = ""; string obj_cite_number_bkidx = ""; int obj_cite_number_type = 0; string[] anchor_tags = []; -- cgit v1.2.3