From bb03ff22fa3af8b731a591fd450b85c5c0c57f02 Mon Sep 17 00:00:00 2001 From: Ralph Amissah Date: Fri, 3 Dec 2021 22:11:59 -0500 Subject: metaverse, xml dom close eof --- org/metaverse.org | 247 ++++++++++++++++++++++++++++++++---------------------- 1 file changed, 149 insertions(+), 98 deletions(-) (limited to 'org/metaverse.org') diff --git a/org/metaverse.org b/org/metaverse.org index 3ea4b56..d562014 100644 --- a/org/metaverse.org +++ b/org/metaverse.org @@ -108,6 +108,7 @@ template docAbstraction() { <> } /+ ← srcDocLoop closed: loop markup document/text line by line +/ /+ ↓ post loop markup document/text +/ + <> <> <> <> @@ -362,7 +363,7 @@ mixin spineRgxIn; #+NAME: abs_top_init_struct_general #+BEGIN_SRC d /+ initialize +/ -ObjGenericComposite[] the_table_of_contents_section, the_document_head_section, the_document_body_section, the_bibliography_section, the_glossary_section, the_blurb_section, the_dom_tail_section; +ObjGenericComposite[] the_document_toc_section, the_document_head_section, the_document_body_section, the_document_bibliography_section, the_document_glossary_section, the_document_blurb_section, the_document_xml_dom_tail_section; string[string] an_object, processing; string an_object_key; string[] anchor_tags; @@ -704,10 +705,13 @@ scope(success) { scope(failure) { } scope(exit) { + destroy(the_document_toc_section); destroy(the_document_head_section); - destroy(the_table_of_contents_section); destroy(the_document_body_section); - destroy(the_bibliography_section); + destroy(the_document_bibliography_section); + destroy(the_document_glossary_section); + destroy(the_document_blurb_section); + destroy(the_document_xml_dom_tail_section); destroy(an_object); destroy(processing); destroy(biblio_arr_json); @@ -837,7 +841,7 @@ tag_assoc[comp_obj_heading_.tags.anchor_tag_html]["seg_lv4"] = comp tag_assoc[comp_obj_heading_.tags.segment_anchor_tag_epub]["seg_lv1_to_4"] = comp_obj_heading_.tags.segment_anchor_tag_epub; auto toc_head = comp_obj_heading_; html_segnames_ptr_cntr++; -the_table_of_contents_section = [toc_head]; +the_document_toc_section = [toc_head]; static auto mkup = InlineMarkup(); static auto munge = ObjInlineMarkupMunge(); auto note_section = NotesSection(); @@ -1013,7 +1017,7 @@ if there is a glossary section you need to: comp_obj_heading_.metainfo.parent_lev_markup = 0; comp_obj_heading_.metainfo.dom_structure_markedup_tags_status = [ 1, 1, 0, 0, 0, 0, 0, 0]; comp_obj_heading_.metainfo.dom_structure_collapsed_tags_status = [ 1, 1, 0, 0, 0, 0, 0, 0]; - the_glossary_section ~= comp_obj_heading_; + the_document_glossary_section ~= comp_obj_heading_; tag_assoc[comp_obj_heading_.tags.anchor_tag_html]["seg_lv4"] = comp_obj_heading_.tags.in_segment_html; tag_assoc[comp_obj_heading_.tags.segment_anchor_tag_epub]["seg_lv1_to_4"] = comp_obj_heading_.tags.segment_anchor_tag_epub; } @@ -1039,7 +1043,7 @@ if there is a glossary section you need to: comp_obj_heading_.metainfo.dom_structure_markedup_tags_status = [ 1, 1, 0, 0, 1, 0, 0, 0]; comp_obj_heading_.metainfo.dom_structure_collapsed_tags_status = [ 1, 1, 1, 0, 0, 0, 0, 0]; comp_obj_heading_.tags.anchor_tags = ["glossary"]; - the_glossary_section ~= comp_obj_heading_; + the_document_glossary_section ~= comp_obj_heading_; tag_assoc[comp_obj_heading_.tags.anchor_tag_html]["seg_lv4"] = comp_obj_heading_.tags.in_segment_html; tag_assoc[comp_obj_heading_.tags.segment_anchor_tag_epub]["seg_lv1_to_4"] = comp_obj_heading_.tags.segment_anchor_tag_epub; } @@ -1058,7 +1062,7 @@ if there is a glossary section you need to: comp_obj_para.attrib.indent_hang = indent["hang_position"]; comp_obj_para.attrib.indent_base = indent["base_position"]; comp_obj_para.attrib.bullet = bullet; - the_glossary_section ~= comp_obj_para; + the_document_glossary_section ~= comp_obj_para; } pith["ocn"] = eN.ocn.on; } @@ -1149,7 +1153,7 @@ if there is a blurb section you need to: comp_obj_heading_.metainfo.parent_lev_markup = 0; comp_obj_heading_.metainfo.dom_structure_markedup_tags_status = [ 1, 1, 0, 0, 0, 0, 0, 0]; comp_obj_heading_.metainfo.dom_structure_collapsed_tags_status = [ 1, 1, 0, 0, 0, 0, 0, 0]; - the_blurb_section ~= comp_obj_heading_; + the_document_blurb_section ~= comp_obj_heading_; tag_assoc[comp_obj_heading_.tags.anchor_tag_html]["seg_lv4"] = comp_obj_heading_.tags.in_segment_html; tag_assoc[comp_obj_heading_.tags.segment_anchor_tag_epub]["seg_lv1_to_4"] = comp_obj_heading_.tags.segment_anchor_tag_epub; } @@ -1175,7 +1179,7 @@ if there is a blurb section you need to: comp_obj_heading_.tags.anchor_tags = ["blurb"]; comp_obj_heading_.metainfo.dom_structure_markedup_tags_status = [ 1, 1, 0, 0, 1, 0, 0, 0]; comp_obj_heading_.metainfo.dom_structure_collapsed_tags_status = [ 1, 1, 1, 0, 0, 0, 0, 0]; - the_blurb_section ~= comp_obj_heading_; + the_document_blurb_section ~= comp_obj_heading_; tag_assoc[comp_obj_heading_.tags.anchor_tag_html]["seg_lv4"] = comp_obj_heading_.tags.in_segment_html; tag_assoc[comp_obj_heading_.tags.segment_anchor_tag_epub]["seg_lv1_to_4"] = comp_obj_heading_.tags.segment_anchor_tag_epub; } @@ -1199,7 +1203,7 @@ if there is a blurb section you need to: 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; comp_obj_heading_.metainfo.parent_lev_markup = 0; - the_blurb_section ~= comp_obj_heading_; + the_document_blurb_section ~= comp_obj_heading_; tag_assoc[comp_obj_heading_.tags.anchor_tag_html]["seg_lv4"] = comp_obj_heading_.tags.in_segment_html; tag_assoc[comp_obj_heading_.tags.segment_anchor_tag_epub]["seg_lv1_to_4"] = comp_obj_heading_.tags.segment_anchor_tag_epub; } else { @@ -1218,7 +1222,7 @@ if there is a blurb section you need to: comp_obj_para.attrib.indent_base = indent["base_position"]; comp_obj_para.has.inline_links = true; comp_obj_para.attrib.bullet = bullet; - the_blurb_section ~= comp_obj_para; + the_document_blurb_section ~= comp_obj_para; } pith["ocn"] = eN.ocn.on; } @@ -1582,13 +1586,13 @@ if (pith["txt_is"] == eN.txt_is.heading = bookindex_extract_hash.bookindex_nugget_hash(an_object["bookindex_nugget"], obj_cite_digits, tag_in_seg); /+ (incrementally build toc) table of contents here! +/ _anchor_tag = obj_cite_digits.identifier; - the_table_of_contents_section = obj_im.flow_table_of_contents_gather_headings( + the_document_toc_section = obj_im.flow_table_of_contents_gather_headings( an_object, conf_make_meta, tag_in_seg, _anchor_tag, lev4_subtoc, - the_table_of_contents_section, + the_document_toc_section, ); if (an_object["lev_markup_number"] == "4") { segnames["html"] ~= tag_in_seg["seg_lv4"]; @@ -1765,21 +1769,55 @@ if (the_document_body_section.length > 0) { +/ *** tie up preparation of document sections +**** in section: xml_dom_tail_section + +eof xml_dom_tail_section + +#+NAME: abs_loop_body_exit_eof_xml_dom_tail +#+BEGIN_SRC d +{ // EOF + comp_obj_heading_ = comp_obj_heading_.init; + comp_obj_heading_.metainfo.is_of_part = "backmatter"; + comp_obj_heading_.metainfo.is_of_section = "tail"; + comp_obj_heading_.metainfo.is_of_type = "para"; + comp_obj_heading_.metainfo.is_a = "heading"; + comp_obj_heading_.text = ""; + comp_obj_heading_.metainfo.ocn = 0; + comp_obj_heading_.metainfo.identifier = ""; + comp_obj_heading_.metainfo.dummy_heading = false; + comp_obj_heading_.metainfo.object_number_off = false; + comp_obj_heading_.metainfo.object_number_type = 0; + comp_obj_heading_.tags.segment_anchor_tag_epub = "_part_eof"; + comp_obj_heading_.tags.anchor_tag_html = comp_obj_heading_.tags.segment_anchor_tag_epub; + comp_obj_heading_.tags.in_segment_html = "tail"; + comp_obj_heading_.tags.anchor_tags = ["section_eof"]; + comp_obj_heading_.metainfo.heading_lev_markup = 1; + comp_obj_heading_.metainfo.heading_lev_collapsed = 1; + comp_obj_heading_.metainfo.parent_ocn = 1; + comp_obj_heading_.metainfo.parent_lev_markup = 0; + comp_obj_heading_.metainfo.dom_structure_markedup_tags_status = [ 0, 0, 0, 0, 0, 0, 0, 0]; + comp_obj_heading_.metainfo.dom_structure_collapsed_tags_status = [ 0, 0, 0, 0, 0, 0, 0, 0]; + the_document_xml_dom_tail_section ~= comp_obj_heading_; + tag_assoc[comp_obj_heading_.tags.anchor_tag_html]["seg_lv4"] = comp_obj_heading_.tags.in_segment_html; + tag_assoc[comp_obj_heading_.tags.segment_anchor_tag_epub]["seg_lv1_to_4"] = comp_obj_heading_.tags.segment_anchor_tag_epub; +} +#+END_SRC + **** endnotes section (scroll & seg) :endnotes: #+NAME: abs_post_endnote_tuple #+BEGIN_SRC d auto en_tuple = note_section.endnote_objects(obj_cite_digits, opt_action); -auto the_endnotes_section = en_tuple[0]; +auto the_document_endnotes_section = en_tuple[0]; obj_cite_digits = en_tuple[1]; debug(endnotes) { writefln( "%s %s", __LINE__, - the_endnotes_section.length + the_document_endnotes_section.length ); - foreach (o; the_endnotes_section) { + foreach (o; the_document_endnotes_section) { writeln(o); } } @@ -1805,10 +1843,10 @@ if (an_object["glossary_nugget"].length == 0) { comp_obj_heading_.metainfo.heading_lev_collapsed = 1; comp_obj_heading_.metainfo.parent_ocn = 1; comp_obj_heading_.metainfo.parent_lev_markup = 0; - the_glossary_section ~= comp_obj_heading_; + the_document_glossary_section ~= comp_obj_heading_; } debug(glossary) { - foreach (gloss; the_glossary_section) { + foreach (gloss; the_document_glossary_section) { writeln(gloss.text); } } @@ -1849,7 +1887,7 @@ if (biblio_ordered.length > 0) { comp_obj_heading_.metainfo.parent_lev_markup = 0; comp_obj_heading_.metainfo.dom_structure_markedup_tags_status = [ 1, 1, 0, 0, 0, 0, 0, 0]; comp_obj_heading_.metainfo.dom_structure_collapsed_tags_status = [ 1, 1, 0, 0, 0, 0, 0, 0]; - the_bibliography_section ~= comp_obj_heading_; + the_document_bibliography_section ~= comp_obj_heading_; tag_assoc[comp_obj_heading_.tags.anchor_tag_html]["seg_lv4"] = comp_obj_heading_.tags.in_segment_html; tag_assoc[comp_obj_heading_.tags.segment_anchor_tag_epub]["seg_lv1_to_4"] = comp_obj_heading_.tags.segment_anchor_tag_epub; } @@ -1875,7 +1913,7 @@ if (biblio_ordered.length > 0) { comp_obj_heading_.metainfo.dom_structure_markedup_tags_status = [ 1, 1, 0, 0, 1, 0, 0, 0]; comp_obj_heading_.metainfo.dom_structure_collapsed_tags_status = [ 1, 1, 1, 0, 0, 0, 0, 0]; comp_obj_heading_.tags.anchor_tags = ["bibliography"]; - the_bibliography_section ~= comp_obj_heading_; + the_document_bibliography_section ~= comp_obj_heading_; tag_assoc[comp_obj_heading_.tags.anchor_tag_html]["seg_lv4"] = comp_obj_heading_.tags.in_segment_html; tag_assoc[comp_obj_heading_.tags.segment_anchor_tag_epub]["seg_lv1_to_4"] = comp_obj_heading_.tags.segment_anchor_tag_epub; } @@ -1909,7 +1947,7 @@ if (biblio_ordered.length > 0) { comp_obj_para.attrib.indent_base = 1; comp_obj_para.attrib.bullet = bullet; comp_obj_para.tags.anchor_tags = [anchor_tag]; - the_bibliography_section ~= comp_obj_para; + the_document_bibliography_section ~= comp_obj_para; } } } else { @@ -1928,14 +1966,14 @@ if (biblio_ordered.length > 0) { comp_obj_heading_.metainfo.heading_lev_collapsed = 1; comp_obj_heading_.metainfo.parent_ocn = 1; comp_obj_heading_.metainfo.parent_lev_markup = 0; - the_bibliography_section ~= comp_obj_heading_; + the_document_bibliography_section ~= comp_obj_heading_; } #+END_SRC #+NAME: abs_post_biblio_debug_write #+BEGIN_SRC d debug(bibliosection) { - foreach (o; the_bibliography_section) { + foreach (o; the_document_bibliography_section) { writeln(o.text); } } @@ -1987,10 +2025,10 @@ auto bi_tuple opt_action, ); destroy(bookindex_unordered_hashes); -auto the_bookindex_section = bi_tuple[0]; +auto the_document_bookindex_section = bi_tuple[0]; obj_cite_digits = bi_tuple[1]; debug(bookindex) { - foreach (bi_entry; the_bookindex_section) { + foreach (bi_entry; the_document_bookindex_section) { writeln(bi_entry); } } @@ -2018,10 +2056,10 @@ if (an_object["blurb_nugget"].length == 0) { comp_obj_heading_.metainfo.heading_lev_collapsed = 1; comp_obj_heading_.metainfo.parent_ocn = 1; comp_obj_heading_.metainfo.parent_lev_markup = 0; - the_blurb_section ~= comp_obj_heading_; + the_document_blurb_section ~= comp_obj_heading_; } debug(blurb) { - foreach (blurb; the_blurb_section) { + foreach (blurb; the_document_blurb_section) { writeln(blurb.text); } } @@ -2047,7 +2085,7 @@ comp_obj_toc.metainfo.object_number_type = 0; comp_obj_toc.attrib.indent_hang = indent["hang_position"]; comp_obj_toc.attrib.indent_base = indent["base_position"]; comp_obj_toc.attrib.bullet = false; -if (the_endnotes_section.length > 1) { +if (the_document_endnotes_section.length > 1) { toc_txt_ = format("%s%s%s%s#%s%s", mkup.lnk_o, "Endnotes", @@ -2059,9 +2097,9 @@ if (the_endnotes_section.length > 1) { toc_txt_= toc_txt_.links_and_images; comp_obj_toc.text = toc_txt_.to!string.strip; comp_obj_toc.has.inline_links = true; - the_table_of_contents_section ~= comp_obj_toc; + the_document_toc_section ~= comp_obj_toc; } -if (the_glossary_section.length > 1) { +if (the_document_glossary_section.length > 1) { toc_txt_ = format("%s%s%s%s#%s%s", mkup.lnk_o, "Glossary", @@ -2073,9 +2111,9 @@ if (the_glossary_section.length > 1) { toc_txt_= toc_txt_.links_and_images; comp_obj_toc.text = toc_txt_.to!string.strip; comp_obj_toc.has.inline_links = true; - the_table_of_contents_section ~= comp_obj_toc; + the_document_toc_section ~= comp_obj_toc; } -if (the_bibliography_section.length > 1){ +if (the_document_bibliography_section.length > 1){ toc_txt_ = format("%s%s%s%s#%s%s", mkup.lnk_o, "Bibliography", @@ -2087,9 +2125,9 @@ if (the_bibliography_section.length > 1){ toc_txt_= toc_txt_.links_and_images; comp_obj_toc.text = toc_txt_.to!string.strip; comp_obj_toc.has.inline_links = true; - the_table_of_contents_section ~= comp_obj_toc; + the_document_toc_section ~= comp_obj_toc; } -if (the_bookindex_section.length > 1) { +if (the_document_bookindex_section.length > 1) { toc_txt_ = format("%s%s%s%s#%s%s", mkup.lnk_o, "Book Index", @@ -2101,9 +2139,9 @@ if (the_bookindex_section.length > 1) { toc_txt_= toc_txt_.links_and_images; comp_obj_toc.text = toc_txt_.to!string.strip; comp_obj_toc.has.inline_links = true; - the_table_of_contents_section ~= comp_obj_toc; + the_document_toc_section ~= comp_obj_toc; } -if (the_blurb_section.length > 1) { +if (the_document_blurb_section.length > 1) { toc_txt_ = format("%s%s%s%s#%s%s", mkup.lnk_o, "Blurb", @@ -2115,14 +2153,14 @@ if (the_blurb_section.length > 1) { toc_txt_= toc_txt_.links_and_images; comp_obj_toc.has.inline_links = true; comp_obj_toc.text = toc_txt_.to!string.strip; - the_table_of_contents_section ~= comp_obj_toc; + the_document_toc_section ~= comp_obj_toc; } debug(toc) { writefln( "%s %s", __LINE__, ); - foreach (toc_linked_heading; the_table_of_contents_section) { + foreach (toc_linked_heading; the_document_toc_section) { writeln(mkup.indent_by_spaces_provided(toc_linked_heading.attrib.indent_hang), toc_linked_heading.text); } } @@ -2136,7 +2174,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_ :loop:post: +*** ↻ *LOOPs* _post main-loop loops_ :loop:post: WORKON **** 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 @@ -2370,11 +2408,11 @@ if (the_document_body_section.length > 1) { #+NAME: abs_post_loop_section_endnotes #+BEGIN_SRC d -if (the_endnotes_section.length > 1) { +if (the_document_endnotes_section.length > 1) { segnames["html"] ~= "endnotes"; segnames["epub"] ~= "endnotes"; html_segnames_ptr = html_segnames_ptr_cntr; - foreach (ref obj; the_endnotes_section) { + foreach (ref obj; the_document_endnotes_section) { if (obj.metainfo.is_a == "heading") { obj.metainfo.parent_ocn = obj.metainfo.markedup_ancestors[obj.metainfo.parent_lev_markup]; } @@ -2391,11 +2429,11 @@ if (the_endnotes_section.length > 1) { #+NAME: abs_post_loop_section_glossary #+BEGIN_SRC d -if (the_glossary_section.length > 1) { +if (the_document_glossary_section.length > 1) { segnames["html"] ~= "glossary"; segnames["epub"] ~= "glossary"; html_segnames_ptr = html_segnames_ptr_cntr; - foreach (ref obj; the_glossary_section) { + foreach (ref obj; the_document_glossary_section) { if (obj.metainfo.is_a == "heading") { obj.metainfo.parent_ocn = obj.metainfo.markedup_ancestors[obj.metainfo.parent_lev_markup]; } @@ -2412,11 +2450,11 @@ if (the_glossary_section.length > 1) { #+NAME: abs_post_loop_section_biblio #+BEGIN_SRC d -if (the_bibliography_section.length > 1) { +if (the_document_bibliography_section.length > 1) { segnames["html"] ~= "bibliography"; segnames["epub"] ~= "bibliography"; html_segnames_ptr = html_segnames_ptr_cntr; - foreach (ref obj; the_bibliography_section) { + foreach (ref obj; the_document_bibliography_section) { if (obj.metainfo.is_a == "heading") { obj.metainfo.parent_ocn = obj.metainfo.markedup_ancestors[obj.metainfo.parent_lev_markup]; } @@ -2433,11 +2471,11 @@ if (the_bibliography_section.length > 1) { #+NAME: abs_post_loop_section_bookindex #+BEGIN_SRC d -if (the_bookindex_section.length > 1) { +if (the_document_bookindex_section.length > 1) { segnames["html"] ~= "bookindex"; segnames["epub"] ~= "bookindex"; html_segnames_ptr = html_segnames_ptr_cntr; - foreach (ref obj; the_bookindex_section) { + foreach (ref obj; the_document_bookindex_section) { if (obj.metainfo.is_a == "heading") { obj.metainfo.parent_ocn = obj.metainfo.markedup_ancestors[obj.metainfo.parent_lev_markup]; } @@ -2454,11 +2492,11 @@ if (the_bookindex_section.length > 1) { #+NAME: abs_post_loop_section_blurb #+BEGIN_SRC d -if (the_blurb_section.length > 1) { +if (the_document_blurb_section.length > 1) { segnames["html"] ~= "blurb"; segnames["epub"] ~= "blurb"; html_segnames_ptr = html_segnames_ptr_cntr; - foreach (ref obj; the_blurb_section) { + foreach (ref obj; the_document_blurb_section) { if (obj.metainfo.is_a == "heading") { obj.metainfo.parent_ocn = obj.metainfo.markedup_ancestors[obj.metainfo.parent_lev_markup]; } @@ -2692,11 +2730,11 @@ foreach (ref obj; the_document_head_section) { #+NAME: abs_post_loop_section_toc #+BEGIN_SRC d -if (the_table_of_contents_section.length > 1) { +if (the_document_toc_section.length > 1) { /+ scroll +/ dom_structure_markedup_tags_status_buffer = dom_structure_markedup_tags_status.dup; dom_structure_collapsed_tags_status_buffer = dom_structure_collapsed_tags_status.dup; - foreach (ref obj; the_table_of_contents_section) { + foreach (ref obj; the_document_toc_section) { if (obj.metainfo.is_a == "heading") { if (obj.metainfo.heading_lev_markup <= 4) { segnames_0_to_4 ~= obj.tags.segment_anchor_tag_epub; @@ -2774,12 +2812,12 @@ auto image_list = (_images.sort()).uniq; #+NAME: abs_post_reloop_section_endnotes #+BEGIN_SRC d /+ optional only one 1~ level +/ -if (the_endnotes_section.length > 1) { +if (the_document_endnotes_section.length > 1) { dom_structure_markedup_tags_status_buffer = dom_structure_markedup_tags_status.dup; dom_structure_collapsed_tags_status_buffer = dom_structure_collapsed_tags_status.dup; dom_structure_markedup_tags_status = dom_structure_markedup_tags_status_buffer.dup; dom_structure_collapsed_tags_status = dom_structure_collapsed_tags_status_buffer.dup; - foreach (ref obj; the_endnotes_section) { + foreach (ref obj; the_document_endnotes_section) { if (obj.metainfo.is_a == "heading") { debug(dom) { writeln(obj.text); @@ -2819,8 +2857,8 @@ if (the_endnotes_section.length > 1) { #+NAME: abs_post_reloop_section_glossary_get_numbering #+BEGIN_SRC d /+ optional only one 1~ level +/ -if (the_glossary_section.length > 1) { - foreach (ref obj; the_glossary_section) { +if (the_document_glossary_section.length > 1) { + foreach (ref obj; the_document_glossary_section) { if (obj.metainfo.is_a == "heading") { debug(dom) { writeln(obj.text); @@ -2864,8 +2902,8 @@ if (the_glossary_section.length > 1) { #+NAME: abs_post_reloop_section_biblio_get_numbering #+BEGIN_SRC d /+ optional only one 1~ level +/ -if (the_bibliography_section.length > 1) { - foreach (ref obj; the_bibliography_section) { +if (the_document_bibliography_section.length > 1) { + foreach (ref obj; the_document_bibliography_section) { if (obj.metainfo.is_a == "heading") { debug(dom) { writeln(obj.text); @@ -2912,10 +2950,10 @@ if (the_bibliography_section.length > 1) { int ocn_ = obj_cite_digits.object_number; int ocn_bkidx_ = 0; int ocn_bidx_; -if (the_bookindex_section.length > 1) { /+ scroll +/ +if (the_document_bookindex_section.length > 1) { /+ scroll +/ dom_structure_markedup_tags_status_buffer = dom_structure_markedup_tags_status.dup; dom_structure_collapsed_tags_status_buffer = dom_structure_collapsed_tags_status.dup; - foreach (ref obj; the_bookindex_section) { + foreach (ref obj; the_document_bookindex_section) { if (obj.metainfo.is_a == "heading") { debug(dom) { } @@ -2964,8 +3002,8 @@ if (the_bookindex_section.length > 1) { / #+NAME: abs_post_reloop_section_blurb_get_numbering #+BEGIN_SRC d /+ optional only one 1~ level +/ -if (the_blurb_section.length > 1) { - foreach (ref obj; the_blurb_section) { +if (the_document_blurb_section.length > 1) { + foreach (ref obj; the_document_blurb_section) { if (obj.metainfo.is_a == "heading") { debug(dom) { writeln(obj.text); @@ -3010,11 +3048,12 @@ if (the_document_body_section.length > 1) { auto pairs = get_decendants( the_document_head_section ~ the_document_body_section ~ - the_endnotes_section ~ - the_glossary_section ~ - the_bibliography_section ~ - the_bookindex_section ~ - the_blurb_section + the_document_endnotes_section ~ + the_document_glossary_section ~ + the_document_bibliography_section ~ + the_document_bookindex_section ~ + the_document_blurb_section ~ + the_document_xml_dom_tail_section ); debug(decendants_tuple) { pairs = pairs.sort(); @@ -3042,8 +3081,19 @@ if (the_document_body_section.length > 1) { } } } - if (the_endnotes_section.length > 1) { - foreach (ref obj; the_endnotes_section) { + if (the_document_endnotes_section.length > 1) { + foreach (ref obj; the_document_endnotes_section) { + if (obj.metainfo.is_a == "heading") { + foreach (pair; pairs) { + if (obj.metainfo.ocn == pair[0]) { + obj.metainfo.last_decendant_ocn = pair[1]; + } + } + } + } + } + if (the_document_glossary_section.length > 1) { + foreach (ref obj; the_document_glossary_section) { if (obj.metainfo.is_a == "heading") { foreach (pair; pairs) { if (obj.metainfo.ocn == pair[0]) { @@ -3053,8 +3103,8 @@ if (the_document_body_section.length > 1) { } } } - if (the_glossary_section.length > 1) { - foreach (ref obj; the_glossary_section) { + if (the_document_bibliography_section.length > 1) { + foreach (ref obj; the_document_bibliography_section) { if (obj.metainfo.is_a == "heading") { foreach (pair; pairs) { if (obj.metainfo.ocn == pair[0]) { @@ -3064,8 +3114,8 @@ if (the_document_body_section.length > 1) { } } } - if (the_bibliography_section.length > 1) { - foreach (ref obj; the_bibliography_section) { + if (the_document_bookindex_section.length > 1) { + foreach (ref obj; the_document_bookindex_section) { if (obj.metainfo.is_a == "heading") { foreach (pair; pairs) { if (obj.metainfo.ocn == pair[0]) { @@ -3075,8 +3125,8 @@ if (the_document_body_section.length > 1) { } } } - if (the_bookindex_section.length > 1) { - foreach (ref obj; the_bookindex_section) { + if (the_document_blurb_section.length > 1) { + foreach (ref obj; the_document_blurb_section) { if (obj.metainfo.is_a == "heading") { foreach (pair; pairs) { if (obj.metainfo.ocn == pair[0]) { @@ -3086,8 +3136,8 @@ if (the_document_body_section.length > 1) { } } } - if (the_blurb_section.length > 1) { - foreach (ref obj; the_blurb_section) { + if (the_document_xml_dom_tail_section.length > 1) { + foreach (ref obj; the_document_xml_dom_tail_section) { if (obj.metainfo.is_a == "heading") { foreach (pair; pairs) { if (obj.metainfo.ocn == pair[0]) { @@ -3144,17 +3194,17 @@ comp_obj_heading_ = comp_obj_heading_.obj_heading_ancestors(lv_ancestors_txt); #+BEGIN_SRC d ObjGenericComposite[][string] document_the = [ "head": the_document_head_section, - "toc": the_table_of_contents_section, + "toc": the_document_toc_section, /+ substantive/body: +/ "body": the_document_body_section, /+ backmatter: +/ - "endnotes": the_endnotes_section, - "glossary": the_glossary_section, - "bibliography": the_bibliography_section, - "bookindex": the_bookindex_section, - "blurb": the_blurb_section, + "endnotes": the_document_endnotes_section, + "glossary": the_document_glossary_section, + "bibliography": the_document_bibliography_section, + "bookindex": the_document_bookindex_section, + "blurb": the_document_blurb_section, /+ dom tail only +/ - "tail": the_dom_tail_section, + "tail": the_document_xml_dom_tail_section, ]; #+END_SRC @@ -3223,13 +3273,14 @@ debug(segnames) { #+NAME: abs_post_document_reinitialize #+BEGIN_SRC d destroy(the_document_head_section); -destroy(the_table_of_contents_section); +destroy(the_document_toc_section); destroy(the_document_body_section); -destroy(the_endnotes_section); -destroy(the_glossary_section); -destroy(the_bibliography_section); -destroy(the_bookindex_section); -destroy(the_blurb_section); +destroy(the_document_endnotes_section); +destroy(the_document_glossary_section); +destroy(the_document_bibliography_section); +destroy(the_document_bookindex_section); +destroy(the_document_blurb_section); +destroy(the_document_xml_dom_tail_section); destroy(segnames); destroy(bookindex_unordered_hashes); destroy(an_object); @@ -6104,7 +6155,7 @@ invariant() { string[string] tag_in_seg, string _anchor_tag, return ref string[][string] lev4_subtoc, - ObjGenericComposite[] the_table_of_contents_section, + ObjGenericComposite[] the_document_toc_section, ) { ObjGenericComposite comp_obj_toc; mixin InternalMarkup; @@ -6144,7 +6195,7 @@ invariant() { comp_obj_toc.attrib.bullet = false; comp_obj_toc.text = toc_txt_.to!string.strip; comp_obj_toc.has.inline_links = true; - the_table_of_contents_section ~= comp_obj_toc; + the_document_toc_section ~= comp_obj_toc; } comp_obj_toc = comp_obj_toc.init; comp_obj_toc.metainfo.is_of_part = "frontmatter"; @@ -6181,7 +6232,7 @@ invariant() { default: break; } - return the_table_of_contents_section; + return the_document_toc_section; } invariant() { } @@ -7120,7 +7171,7 @@ struct NotesSection { O opt_action, ) { mixin spineNode; - ObjGenericComposite[] the_endnotes_section; + ObjGenericComposite[] the_document_endnotes_section; auto endnotes_ = gathered_notes(); string type_is; string lev, lev_markup_number, lev_collapsed_number; @@ -7149,7 +7200,7 @@ struct NotesSection { comp_obj_heading_.metainfo.heading_lev_collapsed = 1; comp_obj_heading_.metainfo.parent_ocn = 1; comp_obj_heading_.metainfo.parent_lev_markup = 0; - the_endnotes_section ~= comp_obj_heading_; + the_document_endnotes_section ~= comp_obj_heading_; tag_assoc[comp_obj_heading_.tags.anchor_tag_html]["seg_lv4"] = comp_obj_heading_.tags.in_segment_html; tag_assoc[comp_obj_heading_.tags.segment_anchor_tag_epub]["seg_lv1_to_4"] = comp_obj_heading_.tags.segment_anchor_tag_epub; ++mkn; @@ -7174,7 +7225,7 @@ struct NotesSection { comp_obj_heading_.metainfo.parent_ocn = 1; comp_obj_heading_.metainfo.parent_lev_markup = 0; comp_obj_heading_.tags.anchor_tags = ["endnotes"]; - the_endnotes_section ~= comp_obj_heading_; + the_document_endnotes_section ~= comp_obj_heading_; tag_assoc[comp_obj_heading_.tags.anchor_tag_html]["seg_lv4"] = comp_obj_heading_.tags.in_segment_html; tag_assoc[comp_obj_heading_.tags.segment_anchor_tag_epub]["seg_lv1_to_4"] = comp_obj_heading_.tags.segment_anchor_tag_epub; ++mkn; @@ -7195,7 +7246,7 @@ struct NotesSection { comp_obj_heading_.metainfo.heading_lev_collapsed = 1; comp_obj_heading_.metainfo.parent_ocn = 1; comp_obj_heading_.metainfo.parent_lev_markup = 0; - the_endnotes_section ~= comp_obj_heading_; + the_document_endnotes_section ~= comp_obj_heading_; } if (opt_action.backmatter && opt_action.section_endnotes) { ObjGenericComposite comp_obj_endnote_; @@ -7219,10 +7270,10 @@ struct NotesSection { comp_obj_endnote_.tags.anchor_tags = [ endnotes_["anchor"][i] ]; comp_obj_endnote_.has.inline_links = true; comp_obj_endnote_.text = endnote.inline_markup_faces.strip; - the_endnotes_section ~= comp_obj_endnote_; + the_document_endnotes_section ~= comp_obj_endnote_; } } - auto t = tuple(the_endnotes_section, obj_cite_digits); + auto t = tuple(the_document_endnotes_section, obj_cite_digits); return t; } #+END_SRC -- cgit v1.2.3