diff options
Diffstat (limited to 'org/meta_abstraction.org')
-rw-r--r-- | org/meta_abstraction.org | 206 |
1 files changed, 130 insertions, 76 deletions
diff --git a/org/meta_abstraction.org b/org/meta_abstraction.org index 39bc9eb..2a447bc 100644 --- a/org/meta_abstraction.org +++ b/org/meta_abstraction.org @@ -183,8 +183,11 @@ ObjGenericComposite[] the_dom_tail_section; string[string] an_object, processing; string an_object_key; string[] anchor_tags; +string anchor_tag; string anchor_tag_; string segment_anchor_tag_that_object_belongs_to; +string lev_anchor_tag; +string[][string] tag_assoc; string segment_anchor_tag_that_object_belongs_to_uri; /+ enum +/ enum State { off, on } @@ -412,7 +415,7 @@ string[][string][string] bookindex_unordered_hashes; /+ node +/ ObjGenericComposite comp_obj_heading, comp_obj_location, comp_obj_block, comp_obj_code, comp_obj_poem_ocn, comp_obj_comment; auto node_construct = NodeStructureMetadata(); -enum sObj { content, anchor_tags, notes_reg, notes_star, links, image_no_dimensions } +enum sObj { content, anchor_tag, notes_reg, notes_star, links, image_no_dimensions } #+END_SRC *** scope @@ -513,6 +516,7 @@ comp_obj_heading_.metainfo.ocn = 0; comp_obj_heading_.metainfo.object_number_off = ""; comp_obj_heading_.metainfo.object_number_type = 0; comp_obj_heading_.tags.segment_anchor_tag = "toc"; +comp_obj_heading_.tags.segment_anchor_tag_is = comp_obj_heading_.tags.segment_anchor_tag; comp_obj_heading_.metainfo.heading_lev_markup = 4; comp_obj_heading_.metainfo.heading_lev_collapsed = 1; comp_obj_heading_.metainfo.parent_ocn = 1; @@ -600,7 +604,7 @@ debug(srclines) { } #+END_SRC -*** check whether object_number is on or turned off :ocn: +*** check whether object_number is on or turned off :ocn: #+name: abs_in_loop_body_00 #+BEGIN_SRC d @@ -688,6 +692,7 @@ if there is a glossary section you need to: comp_obj_heading_.metainfo.object_number_off = ""; comp_obj_heading_.metainfo.object_number_type = 0; comp_obj_heading_.tags.segment_anchor_tag = "_part_glossary"; + comp_obj_heading_.tags.segment_anchor_tag_is = comp_obj_heading_.tags.segment_anchor_tag; comp_obj_heading_.metainfo.heading_lev_markup = 1; comp_obj_heading_.metainfo.heading_lev_collapsed = 1; comp_obj_heading_.metainfo.parent_ocn = 1; @@ -705,6 +710,7 @@ if there is a glossary section you need to: comp_obj_heading_.metainfo.object_number_off = ""; comp_obj_heading_.metainfo.object_number_type = 0; comp_obj_heading_.tags.segment_anchor_tag = "glossary"; + comp_obj_heading_.tags.segment_anchor_tag_is = comp_obj_heading_.tags.segment_anchor_tag; comp_obj_heading_.metainfo.heading_lev_markup = 4; comp_obj_heading_.metainfo.heading_lev_collapsed = 2; comp_obj_heading_.metainfo.parent_ocn = 1; @@ -807,6 +813,7 @@ if there is a blurb section you need to: comp_obj_heading_.metainfo.object_number_off = ""; comp_obj_heading_.metainfo.object_number_type = 0; comp_obj_heading_.tags.segment_anchor_tag = "_part_blurb"; + comp_obj_heading_.tags.segment_anchor_tag_is = comp_obj_heading_.tags.segment_anchor_tag; comp_obj_heading_.metainfo.heading_lev_markup = 1; comp_obj_heading_.metainfo.heading_lev_collapsed = 1; comp_obj_heading_.metainfo.parent_ocn = 1; @@ -824,6 +831,7 @@ if there is a blurb section you need to: comp_obj_heading_.metainfo.object_number_off = ""; comp_obj_heading_.metainfo.object_number_type = 0; comp_obj_heading_.tags.segment_anchor_tag = "blurb"; + comp_obj_heading_.tags.segment_anchor_tag_is = comp_obj_heading_.tags.segment_anchor_tag; comp_obj_heading_.metainfo.heading_lev_markup = 4; comp_obj_heading_.metainfo.heading_lev_collapsed = 2; comp_obj_heading_.metainfo.parent_ocn = 1; @@ -844,6 +852,7 @@ if there is a blurb section you need to: comp_obj_heading_.metainfo.object_number_off = ""; comp_obj_heading_.metainfo.object_number_type = 0; comp_obj_heading_.tags.segment_anchor_tag = "blurb"; + comp_obj_heading_.tags.segment_anchor_tag_is = comp_obj_heading_.tags.segment_anchor_tag; comp_obj_heading_.metainfo.heading_lev_markup = an_object["lev_markup_number"].to!int; // make int, remove need to conv comp_obj_heading_.metainfo.heading_lev_collapsed = an_object["lev_collapsed_number"].to!int; // make int, remove need to conv comp_obj_heading_.metainfo.parent_ocn = 1; @@ -1159,7 +1168,7 @@ if ((obj_type_status["heading"] == State.on) auto substantive_object_and_anchor_tags_tuple = obj_im.obj_inline_markup_and_anchor_tags_and_misc(an_object, an_object_key, conf_make_meta, _new_doc); an_object["substantive"] = substantive_object_and_anchor_tags_tuple[sObj.content]; - anchor_tags = substantive_object_and_anchor_tags_tuple[sObj.anchor_tags]; + anchor_tag = substantive_object_and_anchor_tags_tuple[sObj.anchor_tag]; if (_new_doc) { cnt1 = 1; cnt2 = 1; @@ -1168,13 +1177,17 @@ if ((obj_type_status["heading"] == State.on) } if ( an_object["lev_markup_number"].to!int == 4 - && anchor_tags.length > 0 + && !(anchor_tag.empty) ) { - segment_anchor_tag_that_object_belongs_to = anchor_tags[0]; - segment_anchor_tag_that_object_belongs_to_uri = anchor_tags[0] ~ ".fnSuffix"; - anchor_tag_ = anchor_tags[0]; + segment_anchor_tag_that_object_belongs_to = anchor_tag; + lev_anchor_tag = anchor_tag; + tag_assoc[anchor_tag] = [segment_anchor_tag_that_object_belongs_to]; + segment_anchor_tag_that_object_belongs_to_uri = anchor_tag ~ ".fnSuffix"; + anchor_tag_ = anchor_tag; } else if (an_object["lev_markup_number"].to!int > 4) { segment_anchor_tag_that_object_belongs_to = anchor_tag_; + lev_anchor_tag = anchor_tag; + tag_assoc[anchor_tag] = [segment_anchor_tag_that_object_belongs_to]; 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; @@ -1205,7 +1218,7 @@ if ((obj_type_status["heading"] == State.on) bookindex_unordered_hashes = 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_digits.on); + _anchor_tag=obj_cite_digits.on.to!string; the_table_of_contents_section = obj_im.table_of_contents_gather_headings( an_object, conf_make_meta, @@ -1225,6 +1238,8 @@ 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 + lev_anchor_tag, // string + tag_assoc, obj_cite_digits, // OCNset cntr, // int heading_ptr, // int @@ -1268,6 +1283,8 @@ if ((obj_type_status["heading"] == State.on) = node_construct.node_location_emitter( content_non_header, segment_anchor_tag_that_object_belongs_to, + lev_anchor_tag, + tag_assoc, obj_cite_digits, cntr, heading_ptr-1, @@ -1276,14 +1293,14 @@ if ((obj_type_status["heading"] == State.on) auto substantive_obj_misc_tuple = obj_im.obj_inline_markup_and_anchor_tags_and_misc(an_object, an_object_key, conf_make_meta, false); an_object["substantive"] = substantive_obj_misc_tuple[sObj.content]; - anchor_tags = substantive_obj_misc_tuple[sObj.anchor_tags]; + anchor_tag = substantive_obj_misc_tuple[sObj.anchor_tag]; comp_obj_para = comp_obj_para.init; comp_obj_para.metainfo.is_of_part = "body"; comp_obj_para.metainfo.is_of_section = "body"; comp_obj_para.metainfo.is_of_type = "para"; comp_obj_para.metainfo.is_a = "para"; comp_obj_para.text = an_object["substantive"].to!string.strip; - comp_obj_para.tags.segment_anchor_tag = segment_anchor_tag_that_object_belongs_to.to!string; // TODO + comp_obj_para.tags.segment_anchor_tag_is = segment_anchor_tag_that_object_belongs_to; comp_obj_para.metainfo.ocn = obj_cite_digits.digit; comp_obj_para.metainfo.object_number_off = (obj_cite_digits.off==0) ? "" : obj_cite_digits.off.to!string; comp_obj_para.metainfo.o_n_book_index = obj_cite_digits.bkidx; @@ -1291,7 +1308,7 @@ if ((obj_type_status["heading"] == State.on) comp_obj_para.attrib.indent_hang = indent["hang_position"]; comp_obj_para.attrib.indent_base = indent["base_position"]; comp_obj_para.attrib.bullet = bullet; - comp_obj_para.tags.anchor_tags = anchor_tags; + comp_obj_para.tags.anchor_tags = [anchor_tag]; comp_obj_para.has.inline_notes_reg = substantive_obj_misc_tuple[sObj.notes_reg]; comp_obj_para.has.inline_notes_star = substantive_obj_misc_tuple[sObj.notes_star]; comp_obj_para.has.inline_links = substantive_obj_misc_tuple[sObj.links]; @@ -1447,6 +1464,7 @@ if (biblio_ordered.length > 0) { comp_obj_heading_.metainfo.object_number_off = ""; comp_obj_heading_.metainfo.object_number_type = 0; comp_obj_heading_.tags.segment_anchor_tag = "_part_bibliography"; + comp_obj_heading_.tags.segment_anchor_tag_is = comp_obj_heading_.tags.segment_anchor_tag; comp_obj_heading_.metainfo.heading_lev_markup = 1; comp_obj_heading_.metainfo.heading_lev_collapsed = 1; comp_obj_heading_.metainfo.parent_ocn = 1; @@ -1462,6 +1480,7 @@ if (biblio_ordered.length > 0) { comp_obj_heading_.metainfo.object_number_off = ""; comp_obj_heading_.metainfo.object_number_type = 0; comp_obj_heading_.tags.segment_anchor_tag = "bibliography"; + comp_obj_heading_.tags.segment_anchor_tag_is = comp_obj_heading_.tags.segment_anchor_tag; comp_obj_heading_.metainfo.heading_lev_markup = 4; comp_obj_heading_.metainfo.heading_lev_collapsed = 2; comp_obj_heading_.metainfo.parent_ocn = 1; @@ -1518,7 +1537,7 @@ foreach (entry; biblio_ordered) { comp_obj_para.attrib.indent_hang = 0; comp_obj_para.attrib.indent_base = 1; comp_obj_para.attrib.bullet = bullet; - comp_obj_para.tags.anchor_tags = anchor_tags; + comp_obj_para.tags.anchor_tags = [anchor_tag]; the_bibliography_section ~= comp_obj_para; } #+END_SRC @@ -1601,6 +1620,7 @@ if (an_object["blurb_nugget"].length == 0) { comp_obj_para.metainfo.object_number_off = ""; comp_obj_para.metainfo.object_number_type = 0; comp_obj_heading_.tags.segment_anchor_tag = ""; + comp_obj_heading_.tags.segment_anchor_tag_is = comp_obj_heading_.tags.segment_anchor_tag; comp_obj_heading_.metainfo.heading_lev_markup = 1; comp_obj_heading_.metainfo.heading_lev_collapsed = 1; comp_obj_heading_.metainfo.parent_ocn = 1; @@ -1638,7 +1658,7 @@ if (the_endnotes_section.length > 1) { "{ %s }%s%s%s", "Endnotes", mkup.mark_internal_site_lnk, - "endnotes", // segment_anchor_tag_that_object_belongs_to + "endnotes", ".fnSuffix", ); toc_txt_= munge.url_links(toc_txt_); @@ -1651,7 +1671,7 @@ if (the_glossary_section.length > 1) { "{ %s }%s%s%s", "Glossary", mkup.mark_internal_site_lnk, - "glossary", // segment_anchor_tag_that_object_belongs_to + "glossary", ".fnSuffix", ); toc_txt_= munge.url_links(toc_txt_); @@ -1673,7 +1693,7 @@ if (the_bibliography_section.length > 1){ "{ %s }%s%s%s", "Bibliography", mkup.mark_internal_site_lnk, - "bibliography", // segment_anchor_tag_that_object_belongs_to + "bibliography", ".fnSuffix", ); toc_txt_= munge.url_links(toc_txt_); @@ -1696,7 +1716,7 @@ if (the_bookindex_section["seg"].length > 1) { "{ %s }%s%s%s", "Book Index", mkup.mark_internal_site_lnk, - "bookindex", // segment_anchor_tag_that_object_belongs_to + "bookindex", ".fnSuffix", ); toc_txt_= munge.url_links(toc_txt_); @@ -1720,7 +1740,7 @@ if (the_blurb_section.length > 1) { "{ %s }%s%s%s", "Blurb", mkup.mark_internal_site_lnk, - "blurb", // segment_anchor_tag_that_object_belongs_to + "blurb", ".fnSuffix", ); toc_txt_= munge.url_links(toc_txt_); @@ -1767,7 +1787,7 @@ the_document_head_section ~= the_document_body_section[0]; the_document_body_section=the_document_body_section[1..$]; #+END_SRC -*** ↻ *LOOPs* _post main-loop loops_ :post: +*** ↻ *LOOPs* _post main-loop loops_ :loop:post: **** 1. ↻ _Loop as required_ (e.g. backmatter): loop up to lev4, extract html_segnames, set pointers this extra loop is used/needed to determine pre and (in particular) next segment @@ -2207,7 +2227,7 @@ auto extract_images(S)(S content_block) { } return images_; } -string[] segnames_0_4; +string[] segnames_lv0_to_4; #+END_SRC ****** images: dimensions @@ -2260,7 +2280,7 @@ foreach (ref obj; the_document_head_section) { writeln(obj.text); } if (obj.metainfo.heading_lev_markup <= 4) { - segnames_0_4 ~= obj.tags.segment_anchor_tag; + segnames_lv0_to_4 ~= obj.tags.segment_anchor_tag; } if (obj.metainfo.heading_lev_markup == 0) { /+ TODO second hit (of two) with same assertion failure, check, fix and reinstate @@ -2296,7 +2316,7 @@ if (the_table_of_contents_section["scroll"].length > 1) { foreach (ref obj; the_table_of_contents_section["scroll"]) { if (obj.metainfo.is_a == "heading") { if (obj.metainfo.heading_lev_markup <= 4) { - segnames_0_4 ~= obj.tags.segment_anchor_tag; + segnames_lv0_to_4 ~= obj.tags.segment_anchor_tag; if (obj.metainfo.heading_lev_markup == 4) { obj.tags.segname_next = html_segnames[obj.ptr.html_segnames + 1]; assert(obj.tags.segment_anchor_tag == html_segnames[obj.ptr.html_segnames], @@ -2325,7 +2345,7 @@ if (the_table_of_contents_section["scroll"].length > 1) { writeln(obj.text); } if (obj.metainfo.heading_lev_markup <= 4) { - segnames_0_4 ~= obj.tags.segment_anchor_tag; + segnames_lv0_to_4 ~= obj.tags.segment_anchor_tag; if (obj.metainfo.heading_lev_markup == 4) { obj.tags.segname_next = html_segnames[obj.ptr.html_segnames + 1]; assert(obj.tags.segment_anchor_tag == html_segnames[obj.ptr.html_segnames], @@ -2357,7 +2377,7 @@ if (the_document_body_section.length > 1) { writeln(obj.text); } if (obj.metainfo.heading_lev_markup <= 4) { - segnames_0_4 ~= obj.tags.segment_anchor_tag; + segnames_lv0_to_4 ~= obj.tags.segment_anchor_tag; if (obj.metainfo.heading_lev_markup == 4) { obj.tags.lev4_subtoc = lev4_subtoc[obj.tags.segment_anchor_tag]; obj.tags.segname_prev = html_segnames[obj.ptr.html_segnames - 1]; @@ -2408,7 +2428,7 @@ if (the_endnotes_section.length > 1) { obj_cite_digits = ocn_emit(OCNstatus.on); obj.metainfo.ocn = obj_cite_digits.digit; if (obj.metainfo.heading_lev_markup <= 4) { - segnames_0_4 ~= obj.tags.segment_anchor_tag; + segnames_lv0_to_4 ~= obj.tags.segment_anchor_tag; if (obj.metainfo.heading_lev_markup == 4) { obj.tags.segname_prev = html_segnames[obj.ptr.html_segnames - 1]; if (html_segnames.length > obj.ptr.html_segnames + 1) { @@ -2450,7 +2470,7 @@ if (the_glossary_section.length > 1) { obj_cite_digits = ocn_emit(OCNstatus.on); obj.metainfo.ocn = obj_cite_digits.digit; if (obj.metainfo.heading_lev_markup <= 4) { - segnames_0_4 ~= obj.tags.segment_anchor_tag; + segnames_lv0_to_4 ~= obj.tags.segment_anchor_tag; if (obj.metainfo.heading_lev_markup == 4) { obj.tags.segname_prev = html_segnames[obj.ptr.html_segnames - 1]; if (html_segnames.length > obj.ptr.html_segnames + 1) { @@ -2495,7 +2515,7 @@ if (the_bibliography_section.length > 1) { obj_cite_digits = ocn_emit(OCNstatus.on); obj.metainfo.ocn = obj_cite_digits.digit; if (obj.metainfo.heading_lev_markup <= 4) { - segnames_0_4 ~= obj.tags.segment_anchor_tag; + segnames_lv0_to_4 ~= obj.tags.segment_anchor_tag; if (obj.metainfo.heading_lev_markup == 4) { obj.tags.segname_prev = html_segnames[obj.ptr.html_segnames - 1]; if (html_segnames.length > obj.ptr.html_segnames + 1) { @@ -2545,7 +2565,7 @@ if (the_bookindex_section["scroll"].length > 1) { obj_cite_digits = ocn_emit(OCNstatus.on); obj.metainfo.ocn = obj_cite_digits.on; if (obj.metainfo.heading_lev_markup <= 4) { - segnames_0_4 ~= obj.tags.segment_anchor_tag; + segnames_lv0_to_4 ~= obj.tags.segment_anchor_tag; if (obj.metainfo.heading_lev_markup == 4) { obj.tags.segname_prev = html_segnames[obj.ptr.html_segnames - 1]; if (html_segnames.length > obj.ptr.html_segnames + 1) { @@ -2583,7 +2603,7 @@ if (the_bookindex_section["scroll"].length > 1) { } obj.metainfo.ocn = ++ocn_; if (obj.metainfo.heading_lev_markup <= 4) { - segnames_0_4 ~= obj.tags.segment_anchor_tag; + segnames_lv0_to_4 ~= obj.tags.segment_anchor_tag; if (obj.metainfo.heading_lev_markup == 4) { obj.tags.segname_prev = html_segnames[obj.ptr.html_segnames - 1]; if (html_segnames.length > obj.ptr.html_segnames + 1) { @@ -2631,7 +2651,7 @@ if (the_blurb_section.length > 1) { obj_cite_digits = ocn_emit(OCNstatus.on); obj.metainfo.ocn = obj_cite_digits.on; if (obj.metainfo.heading_lev_markup <= 4) { - segnames_0_4 ~= obj.tags.segment_anchor_tag; + segnames_lv0_to_4 ~= obj.tags.segment_anchor_tag; if (obj.metainfo.heading_lev_markup == 4) { obj.tags.segname_prev = html_segnames[obj.ptr.html_segnames - 1]; if (html_segnames.length > obj.ptr.html_segnames + 1) { @@ -2862,7 +2882,7 @@ auto sequenced_document_keys = docSectKeysSeq!()(document_section_keys_sequenced #+name: abs_post #+BEGIN_SRC d -auto segnames = html_segnames.dup; +auto segnames_lv4 = html_segnames.dup; #+END_SRC *** clean out structure @@ -2951,8 +2971,9 @@ debug(abstraction) { auto t = tuple( document_the, sequenced_document_keys, - segnames, - segnames_0_4, + segnames_lv4, + segnames_lv0_to_4, + tag_assoc, images, ); return t; @@ -3002,7 +3023,7 @@ auto _common_reset_(L,O,T)( } #+END_SRC -*** check object_number status in document :ocn: +*** check object_number status in document :ocn: #+name: abs_functions_ocn_status #+BEGIN_SRC d @@ -3760,7 +3781,7 @@ void _poem_block_(L,O,T,C,N,CMM,Ts)( auto substantive_obj_misc_tuple = obj_im.obj_inline_markup_and_anchor_tags_and_misc(an_object, an_object_key, conf_make_meta, false); an_object["substantive"] = substantive_obj_misc_tuple[sObj.content]; - anchor_tags = substantive_obj_misc_tuple[sObj.anchor_tags]; + anchor_tag = substantive_obj_misc_tuple[sObj.anchor_tag]; comp_obj_block = comp_obj_block.init; comp_obj_block.metainfo.is_of_part = "body"; comp_obj_block.metainfo.is_of_section = "body"; @@ -3768,7 +3789,7 @@ void _poem_block_(L,O,T,C,N,CMM,Ts)( comp_obj_block.metainfo.is_a = "verse"; comp_obj_block.metainfo.ocn = obj_cite_digits.on; comp_obj_block.metainfo.object_number_off = (obj_cite_digits.off==0) ? "" : obj_cite_digits.off.to!string; - comp_obj_block.tags.segment_anchor_tag = segment_anchor_tag_that_object_belongs_to.to!string; // TODO + comp_obj_block.tags.segment_anchor_tag_is = segment_anchor_tag_that_object_belongs_to; comp_obj_block.metainfo.o_n_book_index = obj_cite_digits.bkidx; comp_obj_block.metainfo.object_number_type = obj_cite_digits.type; comp_obj_block.text = an_object["substantive"]; @@ -3810,6 +3831,8 @@ void _poem_block_(L,O,T,C,N,CMM,Ts)( auto comp_obj_location = node_construct.node_location_emitter( content_non_header, segment_anchor_tag_that_object_belongs_to, + lev_anchor_tag, + tag_assoc, obj_cite_digits, cntr, heading_ptr-1, @@ -3818,7 +3841,7 @@ void _poem_block_(L,O,T,C,N,CMM,Ts)( auto substantive_obj_misc_tuple = obj_im.obj_inline_markup_and_anchor_tags_and_misc(an_object, an_object_key, conf_make_meta, false); an_object["substantive"] = substantive_obj_misc_tuple[sObj.content]; - anchor_tags = substantive_obj_misc_tuple[sObj.anchor_tags]; + anchor_tag = substantive_obj_misc_tuple[sObj.anchor_tag]; comp_obj_block = comp_obj_block.init; comp_obj_block.metainfo.is_of_part = "body"; comp_obj_block.metainfo.is_of_section = "body"; @@ -3826,7 +3849,7 @@ void _poem_block_(L,O,T,C,N,CMM,Ts)( comp_obj_block.metainfo.is_a = "verse"; comp_obj_block.metainfo.ocn = obj_cite_digits.on; comp_obj_block.metainfo.object_number_off = (obj_cite_digits.off==0) ? "" : obj_cite_digits.off.to!string; - comp_obj_block.tags.segment_anchor_tag = segment_anchor_tag_that_object_belongs_to.to!string; // TODO + comp_obj_block.tags.segment_anchor_tag_is = segment_anchor_tag_that_object_belongs_to; comp_obj_block.metainfo.o_n_book_index = obj_cite_digits.bkidx; comp_obj_block.metainfo.object_number_type = obj_cite_digits.type; comp_obj_block.text = an_object["substantive"]; @@ -3861,7 +3884,7 @@ void _poem_block_(L,O,T,C,N,CMM,Ts)( auto substantive_obj_misc_tuple = obj_im.obj_inline_markup_and_anchor_tags_and_misc(an_object, an_object_key, conf_make_meta, false); an_object["substantive"] = substantive_obj_misc_tuple[sObj.content]; - anchor_tags = substantive_obj_misc_tuple[sObj.anchor_tags]; + anchor_tag = substantive_obj_misc_tuple[sObj.anchor_tag]; comp_obj_block = comp_obj_block.init; comp_obj_block.metainfo.is_of_part = "body"; comp_obj_block.metainfo.is_of_section = "body"; @@ -3869,7 +3892,7 @@ void _poem_block_(L,O,T,C,N,CMM,Ts)( comp_obj_block.metainfo.is_a = "verse"; comp_obj_block.metainfo.ocn = obj_cite_digits.on; comp_obj_block.metainfo.object_number_off = (obj_cite_digits.off==0) ? "" : obj_cite_digits.off.to!string; - comp_obj_block.tags.segment_anchor_tag = segment_anchor_tag_that_object_belongs_to.to!string; // TODO + comp_obj_block.tags.segment_anchor_tag_is = segment_anchor_tag_that_object_belongs_to; comp_obj_block.metainfo.o_n_book_index = obj_cite_digits.bkidx; comp_obj_block.metainfo.object_number_type = obj_cite_digits.type; comp_obj_block.text = an_object["substantive"]; @@ -3911,6 +3934,8 @@ void _poem_block_(L,O,T,C,N,CMM,Ts)( = node_construct.node_location_emitter( content_non_header, segment_anchor_tag_that_object_belongs_to, + lev_anchor_tag, + tag_assoc, obj_cite_digits, cntr, heading_ptr-1, @@ -3919,7 +3944,7 @@ void _poem_block_(L,O,T,C,N,CMM,Ts)( auto substantive_obj_misc_tuple = obj_im.obj_inline_markup_and_anchor_tags_and_misc(an_object, an_object_key, conf_make_meta, false); an_object["substantive"] = substantive_obj_misc_tuple[sObj.content]; - anchor_tags = substantive_obj_misc_tuple[sObj.anchor_tags]; + anchor_tag = substantive_obj_misc_tuple[sObj.anchor_tag]; comp_obj_block = comp_obj_block.init; comp_obj_block.metainfo.is_of_part = "body"; comp_obj_block.metainfo.is_of_section = "body"; @@ -3927,7 +3952,7 @@ void _poem_block_(L,O,T,C,N,CMM,Ts)( comp_obj_block.metainfo.is_a = "verse"; comp_obj_block.metainfo.ocn = obj_cite_digits.on; comp_obj_block.metainfo.object_number_off = (obj_cite_digits.off==0) ? "" : obj_cite_digits.off.to!string; - comp_obj_block.tags.segment_anchor_tag = segment_anchor_tag_that_object_belongs_to.to!string; // TODO + comp_obj_block.tags.segment_anchor_tag_is = segment_anchor_tag_that_object_belongs_to; comp_obj_block.metainfo.o_n_book_index = obj_cite_digits.bkidx; comp_obj_block.metainfo.object_number_type = obj_cite_digits.type; comp_obj_block.text = an_object["substantive"]; @@ -4055,6 +4080,8 @@ void _table_closed_make_special_notation_table_(N,CMM)( = node_construct.node_location_emitter( content_non_header, segment_anchor_tag_that_object_belongs_to, + lev_anchor_tag, + tag_assoc, obj_cite_digits, cntr, heading_ptr-1, @@ -4066,7 +4093,7 @@ void _table_closed_make_special_notation_table_(N,CMM)( an_object["substantive"] = substantive_obj_misc_tuple[sObj.content]; comp_obj_block.metainfo.ocn = obj_cite_digits.on; comp_obj_block.metainfo.object_number_off = (obj_cite_digits.off==0) ? "" : obj_cite_digits.off.to!string; - comp_obj_block.tags.segment_anchor_tag = segment_anchor_tag_that_object_belongs_to.to!string; // TODO + comp_obj_block.tags.segment_anchor_tag_is = segment_anchor_tag_that_object_belongs_to; comp_obj_block.metainfo.o_n_book_index = obj_cite_digits.bkidx; comp_obj_block.metainfo.object_number_type = obj_cite_digits.type; comp_obj_block = table_instructions(comp_obj_block, an_object["table_head"]); @@ -4129,6 +4156,8 @@ void _block_flag_line_empty_(B,N,CMM,Ts)( = node_construct.node_location_emitter( content_non_header, segment_anchor_tag_that_object_belongs_to, + lev_anchor_tag, + tag_assoc, obj_cite_digits, cntr, heading_ptr-1, @@ -4137,7 +4166,7 @@ void _block_flag_line_empty_(B,N,CMM,Ts)( auto substantive_obj_misc_tuple = obj_im.obj_inline_markup_and_anchor_tags_and_misc(an_object, an_object_key, conf_make_meta, false); an_object["substantive"] = substantive_obj_misc_tuple[sObj.content]; - anchor_tags = substantive_obj_misc_tuple[sObj.anchor_tags]; + anchor_tag = substantive_obj_misc_tuple[sObj.anchor_tag]; comp_obj_block = comp_obj_block.init; comp_obj_block.metainfo.is_of_part = "body"; comp_obj_block.metainfo.is_of_section = "body"; @@ -4145,7 +4174,7 @@ void _block_flag_line_empty_(B,N,CMM,Ts)( comp_obj_block.metainfo.is_a = "quote"; comp_obj_block.metainfo.ocn = obj_cite_digits.on; comp_obj_block.metainfo.object_number_off = (obj_cite_digits.off==0) ? "" : obj_cite_digits.off.to!string; - comp_obj_block.tags.segment_anchor_tag = segment_anchor_tag_that_object_belongs_to.to!string; // TODO + comp_obj_block.tags.segment_anchor_tag_is = segment_anchor_tag_that_object_belongs_to; comp_obj_block.metainfo.o_n_book_index = obj_cite_digits.bkidx; comp_obj_block.metainfo.object_number_type = obj_cite_digit_type; comp_obj_block.text = an_object["substantive"]; @@ -4179,6 +4208,8 @@ void _block_flag_line_empty_(B,N,CMM,Ts)( = node_construct.node_location_emitter( content_non_header, segment_anchor_tag_that_object_belongs_to, + lev_anchor_tag, + tag_assoc, obj_cite_digits, cntr, heading_ptr-1, @@ -4187,7 +4218,7 @@ void _block_flag_line_empty_(B,N,CMM,Ts)( auto substantive_obj_misc_tuple = obj_im.obj_inline_markup_and_anchor_tags_and_misc(an_object, an_object_key, conf_make_meta, false); an_object["substantive"] = substantive_obj_misc_tuple[sObj.content]; - anchor_tags = substantive_obj_misc_tuple[sObj.anchor_tags]; + anchor_tag = substantive_obj_misc_tuple[sObj.anchor_tag]; comp_obj_block = comp_obj_block.init; comp_obj_block.metainfo.is_of_part = "body"; comp_obj_block.metainfo.is_of_section = "body"; @@ -4195,7 +4226,7 @@ void _block_flag_line_empty_(B,N,CMM,Ts)( comp_obj_block.metainfo.is_a = "group"; comp_obj_block.metainfo.ocn = obj_cite_digits.on; comp_obj_block.metainfo.object_number_off = (obj_cite_digits.off==0) ? "" : obj_cite_digits.off.to!string; - comp_obj_block.tags.segment_anchor_tag = segment_anchor_tag_that_object_belongs_to.to!string; // TODO + comp_obj_block.tags.segment_anchor_tag_is = segment_anchor_tag_that_object_belongs_to; comp_obj_block.metainfo.o_n_book_index = obj_cite_digits.bkidx; comp_obj_block.metainfo.object_number_type = obj_cite_digits.type; comp_obj_block.text = an_object["substantive"]; @@ -4229,6 +4260,8 @@ void _block_flag_line_empty_(B,N,CMM,Ts)( = node_construct.node_location_emitter( content_non_header, segment_anchor_tag_that_object_belongs_to, + lev_anchor_tag, + tag_assoc, obj_cite_digits, cntr, heading_ptr-1, @@ -4244,7 +4277,7 @@ void _block_flag_line_empty_(B,N,CMM,Ts)( comp_obj_block.metainfo.is_a = "block"; comp_obj_block.metainfo.ocn = obj_cite_digits.on; comp_obj_block.metainfo.object_number_off = (obj_cite_digits.off==0) ? "" : obj_cite_digits.off.to!string; - comp_obj_block.tags.segment_anchor_tag = segment_anchor_tag_that_object_belongs_to.to!string; // TODO + comp_obj_block.tags.segment_anchor_tag_is = segment_anchor_tag_that_object_belongs_to; comp_obj_block.metainfo.o_n_book_index = obj_cite_digits.bkidx; comp_obj_block.metainfo.object_number_type = obj_cite_digit_type; comp_obj_block.text = an_object["substantive"]; @@ -4277,6 +4310,8 @@ void _block_flag_line_empty_(B,N,CMM,Ts)( = node_construct.node_location_emitter( content_non_header, segment_anchor_tag_that_object_belongs_to, + lev_anchor_tag, + tag_assoc, obj_cite_digits, cntr, heading_ptr-1, @@ -4318,6 +4353,8 @@ void _block_flag_line_empty_(B,N,CMM,Ts)( = node_construct.node_location_emitter( content_non_header, segment_anchor_tag_that_object_belongs_to, + lev_anchor_tag, + tag_assoc, obj_cite_digits, cntr, heading_ptr-1, @@ -4326,7 +4363,7 @@ void _block_flag_line_empty_(B,N,CMM,Ts)( auto substantive_obj_misc_tuple = obj_im.obj_inline_markup_and_anchor_tags_and_misc(an_object, an_object_key, conf_make_meta, false); an_object["substantive"] = substantive_obj_misc_tuple[sObj.content]; - anchor_tags = substantive_obj_misc_tuple[sObj.anchor_tags]; + anchor_tag = substantive_obj_misc_tuple[sObj.anchor_tag]; comp_obj_code = comp_obj_code.init; comp_obj_code.metainfo.is_of_part = "body"; comp_obj_code.metainfo.is_of_section = "body"; @@ -4334,7 +4371,7 @@ void _block_flag_line_empty_(B,N,CMM,Ts)( comp_obj_code.metainfo.is_a = "code"; comp_obj_code.metainfo.ocn = obj_cite_digits.on; comp_obj_code.metainfo.object_number_off = (obj_cite_digits.off==0) ? "" : obj_cite_digits.off.to!string; - comp_obj_code.tags.segment_anchor_tag = segment_anchor_tag_that_object_belongs_to.to!string; + comp_obj_code.tags.segment_anchor_tag_is = segment_anchor_tag_that_object_belongs_to; comp_obj_code.metainfo.o_n_book_index = obj_cite_digits.bkidx; comp_obj_code.metainfo.object_number_type = obj_cite_digits.type; comp_obj_code.text = an_object["substantive"]; @@ -4369,6 +4406,8 @@ void _block_flag_line_empty_(B,N,CMM,Ts)( = node_construct.node_location_emitter( content_non_header, segment_anchor_tag_that_object_belongs_to, + lev_anchor_tag, + tag_assoc, obj_cite_digits, cntr, heading_ptr-1, @@ -4380,7 +4419,7 @@ void _block_flag_line_empty_(B,N,CMM,Ts)( comp_obj_block = comp_obj_block.init; comp_obj_block.metainfo.ocn = obj_cite_digits.on; comp_obj_block.metainfo.object_number_off = (obj_cite_digits.off==0) ? "" : obj_cite_digits.off.to!string; - comp_obj_block.tags.segment_anchor_tag = segment_anchor_tag_that_object_belongs_to.to!string; // TODO + comp_obj_block.tags.segment_anchor_tag_is = segment_anchor_tag_that_object_belongs_to; comp_obj_block.metainfo.o_n_book_index = obj_cite_digits.bkidx; comp_obj_block.metainfo.object_number_type = obj_cite_digits.type; comp_obj_block = table_instructions(comp_obj_block, an_object["table_head"]); @@ -5337,7 +5376,7 @@ static struct ObjInlineMarkupMunge { n_foot=n_foot_reg; obj_txt_out ~= n.hit.to!string.replaceFirst( rgx.inline_al_delimiter_open_regular, - (mkup.en_a_o ~ to!string(n_foot) ~ " ") + (mkup.en_a_o ~ n_foot.to!string ~ " ") ) ~ "\n"; } else { obj_txt_out ~= n.hit.to!string ~ "\n"; @@ -5659,7 +5698,6 @@ static struct ObjInlineMarkup { static auto rgx = Rgx(); static auto munge = ObjInlineMarkupMunge(); string[string] obj_txt; - static string[] anchor_tags_ = []; static string anchor_tag = ""; #+END_SRC @@ -5685,7 +5723,7 @@ static struct ObjInlineMarkup { ? obj_txt["munge"] : obj_txt["munge"].strip; if (_new_doc) { - anchor_tags_ = []; + anchor_tag = ""; } auto x = munge.init; bool[string] obj_notes_and_links; @@ -5702,7 +5740,6 @@ static struct ObjInlineMarkup { obj_txt["munge"]=_make_segment_anchor_tags_if_none_provided(obj_txt["munge"], obj_["lev"], _new_doc); if (auto m = obj_txt["munge"].match(rgx.heading_anchor_tag)) { anchor_tag = m.captures[1]; - anchor_tags_ ~= anchor_tag; } else if (obj_["lev"] == "1") { writeln("heading anchor tag missing: ", obj_txt["munge"]); } @@ -5748,13 +5785,13 @@ static struct ObjInlineMarkup { } auto t = tuple( obj_txt["munge"], - anchor_tags_, + anchor_tag, obj_notes_and_links["notes_reg"], obj_notes_and_links["notes_star"], obj_notes_and_links["links"], obj_notes_and_links["image_no_dimensions"], ); - anchor_tags_=[]; + anchor_tag = ""; return t; } invariant() { @@ -6089,7 +6126,8 @@ private: rgx.heading_marker_missing_tag, "$1~" ~ m.captures[1].toLower ~ "_" ~ m.captures[2] ~ " "); if (auto n = munge_.match(rgx.heading_anchor_tag_plus_colon)) { - auto tag_remunge_ = n.captures[2].replaceAll(rgx.heading_marker_tag_has_colon, ".."); + auto tag_remunge_ = n.captures[2] + .replaceAll(rgx.heading_marker_tag_has_colon, ".."); munge_=(munge_).replaceFirst(rgx.heading_anchor_tag_plus_colon, n.captures[1] ~ tag_remunge_ ~ " "); } } else if (auto m = munge_.match(rgx.heading_extract_unnamed_anchor_tag)) { @@ -6562,7 +6600,8 @@ struct BookIndexNuggetHash { main_term = m.captures[1].strip; object_number_offset = m.captures[2].to!int; object_number_endpoint=(obj_cite_digits.on + object_number_offset); - object_numbers ~= (obj_cite_digits.on.to!string ~ "-" ~ to!string(object_number_endpoint) + object_numbers ~= (obj_cite_digits.on.to!string + ~ "-" ~ object_number_endpoint.to!string ~ ":" ~ segment_anchor_tag); } else { main_term = bi_main_term_and_rest[0].strip; @@ -6581,11 +6620,12 @@ struct BookIndexNuggetHash { sub_term = m.captures[1].strip; object_number_offset = m.captures[2].to!int; object_number_endpoint=(obj_cite_digits.on + object_number_offset); - object_numbers ~= (obj_cite_digits.on.to!string ~ " - " ~ to!string(object_number_endpoint) + object_numbers ~= (obj_cite_digits.on.to!string + ~ " - " ~ object_number_endpoint.to!string ~ ":" ~ segment_anchor_tag); } else { sub_term = sub_terms_bits.strip; - object_numbers ~= to!string(obj_cite_digits.on) + object_numbers ~= obj_cite_digits.on.to!string ~ ":" ~ segment_anchor_tag; } if (!empty(sub_term)) { @@ -6727,6 +6767,7 @@ struct BookIndexReportSection { comp_obj_heading_.metainfo.object_number_off = ""; comp_obj_heading_.metainfo.object_number_type = 0; comp_obj_heading_.tags.segment_anchor_tag = "_part_book_index"; + comp_obj_heading_.tags.segment_anchor_tag_is = comp_obj_heading_.tags.segment_anchor_tag; comp_obj_heading_.metainfo.heading_lev_markup = 1; comp_obj_heading_.metainfo.heading_lev_collapsed = 1; comp_obj_heading_.metainfo.parent_ocn = 1; @@ -6745,6 +6786,7 @@ struct BookIndexReportSection { comp_obj_heading_.metainfo.object_number_off = ""; comp_obj_heading_.metainfo.object_number_type = 0; comp_obj_heading_.tags.segment_anchor_tag = "bookindex"; + comp_obj_heading_.tags.segment_anchor_tag_is = comp_obj_heading_.tags.segment_anchor_tag; comp_obj_heading_.metainfo.heading_lev_markup = 4; comp_obj_heading_.metainfo.heading_lev_collapsed = 2; comp_obj_heading_.metainfo.parent_ocn = 1; @@ -6979,6 +7021,7 @@ struct NotesSection { comp_obj_heading_.metainfo.object_number_off = ""; comp_obj_heading_.metainfo.object_number_type = 0; comp_obj_heading_.tags.segment_anchor_tag = "_part_endnotes"; + comp_obj_heading_.tags.segment_anchor_tag_is = comp_obj_heading_.tags.segment_anchor_tag; comp_obj_heading_.metainfo.heading_lev_markup = 1; comp_obj_heading_.metainfo.heading_lev_collapsed = 1; comp_obj_heading_.metainfo.parent_ocn = 1; @@ -6995,6 +7038,7 @@ struct NotesSection { comp_obj_heading_.metainfo.object_number_off = ""; comp_obj_heading_.metainfo.object_number_type = 0; comp_obj_heading_.tags.segment_anchor_tag = "endnotes"; + comp_obj_heading_.tags.segment_anchor_tag_is = comp_obj_heading_.tags.segment_anchor_tag; comp_obj_heading_.metainfo.heading_lev_markup = 4; comp_obj_heading_.metainfo.heading_lev_collapsed = 2; comp_obj_heading_.metainfo.parent_ocn = 1; @@ -7205,9 +7249,11 @@ struct NodeStructureMetadata { #+name: meta_emitters_metadata #+BEGIN_SRC d - ObjGenericComposite node_location_emitter(Lv,Ta,N,C,P,I)( + ObjGenericComposite node_location_emitter(Lv,Tg,La,Ta,N,C,P,I)( Lv lev_markup_number, - Ta segment_anchor_tag, + Tg segment_anchor_tag, + La lev_anchor_tag, + Ta tag_assoc, N obj_cite_digits, C cntr_, P ptr_, @@ -7246,6 +7292,8 @@ struct NodeStructureMetadata { comp_obj_location.metainfo.is_a = is_; comp_obj_location.metainfo.ocn = obj_cite_digits.on; comp_obj_location.tags.segment_anchor_tag = segment_anchor_tag.to!string; + comp_obj_location.tags.segment_anchor_tag_is = comp_obj_location.tags.segment_anchor_tag; + comp_obj_location.tags.heading_lev_anchor_tag = lev_anchor_tag; comp_obj_location.metainfo.parent_ocn = p_["object_number"]; comp_obj_location.metainfo.parent_lev_markup = p_["lev_markup_number"]; debug(_node) { @@ -7268,11 +7316,13 @@ struct NodeStructureMetadata { #+name: meta_emitters_metadata #+BEGIN_SRC d - ObjGenericComposite node_emitter_heading(T,Lm,Lc,Ta,N,C,P,LA,I,PSn,fNr,fNs,fL)( + ObjGenericComposite node_emitter_heading(T,Lm,Lc,TaB,TaL,TA,N,C,P,LA,I,PSn,fNr,fNs,fL)( T _text, Lm lev_markup_number, Lc lev_collapsed_number, - Ta segment_anchor_tag, + TaB segment_anchor_tag_that_object_belongs_to, + TaL lev_anchor_tag, + TA tag_assoc, N obj_cite_digits, C cntr_, P ptr_, @@ -7285,17 +7335,17 @@ struct NodeStructureMetadata { ) in { debug(asserts) { - static assert(is(typeof(_text) == string)); - static assert(is(typeof(lev) == string)); - 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_digits.on) == int)); - static assert(is(typeof(cntr_) == int)); - static assert(is(typeof(ptr_) == int)); - static assert(is(typeof(lv_ancestors_txt) == string[])); - static assert(is(typeof(is_) == string)); - static assert(is(typeof(html_segnames_ptr) == int)); + static assert(is(typeof(_text) == string)); + static assert(is(typeof(lev) == string)); + static assert(is(typeof(lev_markup_number) == string)); + static assert(is(typeof(lev_collapsed_number) == string)); + static assert(is(typeof(segment_anchor_tag_that_object_belongs_to) == string)); + 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[])); + static assert(is(typeof(is_) == string)); + static assert(is(typeof(html_segnames_ptr) == int)); } assert(is_ == "heading"); assert((obj_cite_digits.on).to!int >= 0); @@ -7407,7 +7457,9 @@ struct NodeStructureMetadata { _comp_obj_heading_.metainfo.ocn = obj_cite_digits.on; _comp_obj_heading_.metainfo.object_number_off = (obj_cite_digits.off==0) ? "" : obj_cite_digits.off.to!string; _comp_obj_heading_.metainfo.object_number_type = obj_cite_digits.type; - _comp_obj_heading_.tags.segment_anchor_tag = segment_anchor_tag.to!string; + _comp_obj_heading_.tags.segment_anchor_tag = segment_anchor_tag_that_object_belongs_to; + _comp_obj_heading_.tags.heading_lev_anchor_tag = lev_anchor_tag; + _comp_obj_heading_.tags.segment_anchor_tag_is = segment_anchor_tag_that_object_belongs_to; _comp_obj_heading_.metainfo.heading_lev_markup = (!(lev_markup_number.empty) ? lev_markup_number.to!int : 0); _comp_obj_heading_.metainfo.heading_lev_collapsed = (!(lev_collapsed_number.empty) ? lev_collapsed_number.to!int : 0); _comp_obj_heading_.metainfo.parent_ocn = p_["object_number"]; @@ -7848,6 +7900,8 @@ struct DocObj_Pointer_ { struct DocObj_Tags_ { string[] heading_ancestors_text = [ "", "", "", "", "", "", "", "", ]; // TODO redundant? see markedup and collapsed ancestors DONE string segment_anchor_tag = ""; + string segment_anchor_tag_is = ""; + string heading_lev_anchor_tag = ""; string segname_prev = ""; string segname_next = ""; string[] lev4_subtoc = []; |