diff options
author | Ralph Amissah <ralph.amissah@gmail.com> | 2021-12-03 22:11:59 -0500 |
---|---|---|
committer | Ralph Amissah <ralph.amissah@gmail.com> | 2021-12-03 22:17:58 -0500 |
commit | bb03ff22fa3af8b731a591fd450b85c5c0c57f02 (patch) | |
tree | e89e74aa6e619fd25ca18c24997bbd062e6e2ba0 /src | |
parent | xmls, html header band (diff) |
metaverse, xml dom close eof
Diffstat (limited to 'src')
-rw-r--r-- | src/doc_reform/io_out/epub3.d | 5 | ||||
-rw-r--r-- | src/doc_reform/io_out/html.d | 13 | ||||
-rw-r--r-- | src/doc_reform/io_out/xmls.d | 23 | ||||
-rw-r--r-- | src/doc_reform/meta/metadoc_from_src.d | 236 |
4 files changed, 170 insertions, 107 deletions
diff --git a/src/doc_reform/io_out/epub3.d b/src/doc_reform/io_out/epub3.d index b930cdf..92d3eba 100644 --- a/src/doc_reform/io_out/epub3.d +++ b/src/doc_reform/io_out/epub3.d @@ -611,6 +611,11 @@ template outputEPub3() { epubWrite.doc_epub3[segment_filename] ~= t[0]; epubWrite.doc_epub3_endnotes[segment_filename] ~= t[1]; break; + case "tail": assert(part == "tail"); + t = xhtml_format.para_seg(_txt, obj, doc_matters, suffix, "epub"); + epubWrite.doc_epub3[segment_filename] ~= t[0]; + epubWrite.doc_epub3_endnotes[segment_filename] ~= t[1]; + break; default: { /+ debug +/ if (doc_matters.opt.action.debug_do diff --git a/src/doc_reform/io_out/html.d b/src/doc_reform/io_out/html.d index d314ed4..adf15a5 100644 --- a/src/doc_reform/io_out/html.d +++ b/src/doc_reform/io_out/html.d @@ -193,6 +193,9 @@ template outputHTML() { case "blurb": assert(part == "blurb"); doc_html ~= xhtml_format.para_scroll(_txt, obj, doc_matters, suffix); break; + case "tail": assert(part == "tail"); + doc_html ~= xhtml_format.para_scroll(_txt, obj, doc_matters, suffix); + break; default: { /+ debug +/ if (doc_matters.opt.action.debug_do @@ -228,7 +231,10 @@ template outputHTML() { } } } - doc = xhtml_format.html_head(doc_matters, "scroll") ~ doc_html ~ xhtml_format.tail; + doc = xhtml_format.html_head(doc_matters, "scroll") + ~ doc_html + ~ xhtml_format.dom_close + ~ xhtml_format.tail; scroll_write_output(doc, doc_matters); } @trusted void scroll_write_output(D,M)( @@ -471,6 +477,11 @@ template outputHTML() { doc_html[segment_filename] ~= t[0]; doc_html_endnotes[segment_filename] ~= t[1]; break; + case "tail": assert(part == "tail"); + t = xhtml_format.para_seg(_txt, obj, doc_matters, suffix, "seg"); + doc_html[segment_filename] ~= t[0]; + doc_html_endnotes[segment_filename] ~= t[1]; + break; default: { /+ debug +/ if (doc_matters.opt.action.debug_do diff --git a/src/doc_reform/io_out/xmls.d b/src/doc_reform/io_out/xmls.d index 747212a..7d7c495 100644 --- a/src/doc_reform/io_out/xmls.d +++ b/src/doc_reform/io_out/xmls.d @@ -355,15 +355,20 @@ template outputXHTMLs() { ); return o; } - @safe string tail() { - string o; - o = format(q"┃ - <a name="bottom" id="bottom"></a> - <a name="end" id="end"></a> - </body> - </html>┃"); - return o; - } +@safe string dom_close() { + string o; + o = format(q"┃</div>┃"); + return o; +} +@safe string tail() { + string o; + o = format(q"┃ + <a name="bottom" id="bottom"></a> + <a name="end" id="end"></a> +</body> +</html>┃"); + return o; +} @safe string inline_images(O,M)( string _txt, const O obj, diff --git a/src/doc_reform/meta/metadoc_from_src.d b/src/doc_reform/meta/metadoc_from_src.d index d433412..ac3a181 100644 --- a/src/doc_reform/meta/metadoc_from_src.d +++ b/src/doc_reform/meta/metadoc_from_src.d @@ -125,7 +125,7 @@ template docAbstraction() { return _e(); } /+ 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; @@ -441,10 +441,13 @@ template docAbstraction() { 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); @@ -568,7 +571,7 @@ template docAbstraction() { 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(); @@ -702,7 +705,7 @@ template docAbstraction() { 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; } @@ -728,7 +731,7 @@ template docAbstraction() { 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; } @@ -747,7 +750,7 @@ template docAbstraction() { 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; } @@ -825,7 +828,7 @@ template docAbstraction() { 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; } @@ -851,7 +854,7 @@ template docAbstraction() { 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; } @@ -875,7 +878,7 @@ template docAbstraction() { 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 { @@ -894,7 +897,7 @@ template docAbstraction() { 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; } @@ -1147,13 +1150,13 @@ template docAbstraction() { = 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"]; @@ -1308,17 +1311,43 @@ template docAbstraction() { } } /+ ← srcDocLoop closed: loop markup document/text line by line +/ /+ ↓ post loop markup document/text +/ + { // 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; + } 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); } } @@ -1338,10 +1367,10 @@ template docAbstraction() { 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); } } @@ -1372,7 +1401,7 @@ template docAbstraction() { 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; } @@ -1398,7 +1427,7 @@ template docAbstraction() { 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; } @@ -1432,7 +1461,7 @@ template docAbstraction() { 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 { @@ -1451,10 +1480,10 @@ template docAbstraction() { 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_; } debug(bibliosection) { - foreach (o; the_bibliography_section) { + foreach (o; the_document_bibliography_section) { writeln(o.text); } } @@ -1466,10 +1495,10 @@ template docAbstraction() { 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); } } @@ -1491,10 +1520,10 @@ template docAbstraction() { 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); } } @@ -1514,7 +1543,7 @@ template docAbstraction() { 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", @@ -1526,9 +1555,9 @@ template docAbstraction() { 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", @@ -1540,9 +1569,9 @@ template docAbstraction() { 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", @@ -1554,9 +1583,9 @@ template docAbstraction() { 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", @@ -1568,9 +1597,9 @@ template docAbstraction() { 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", @@ -1582,14 +1611,14 @@ template docAbstraction() { 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); } } @@ -1788,11 +1817,11 @@ template docAbstraction() { writeln("ancestors collapsed o_n: ", obj.metainfo.markedup_ancestors); } } - 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]; } @@ -1803,11 +1832,11 @@ template docAbstraction() { } html_segnames_ptr_cntr++; } - 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]; } @@ -1818,11 +1847,11 @@ template docAbstraction() { } html_segnames_ptr_cntr++; } - 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]; } @@ -1833,11 +1862,11 @@ template docAbstraction() { } html_segnames_ptr_cntr++; } - 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]; } @@ -1848,11 +1877,11 @@ template docAbstraction() { } html_segnames_ptr_cntr++; } - 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]; } @@ -2005,11 +2034,11 @@ template docAbstraction() { } obj = _links(obj); } - 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; @@ -2073,12 +2102,12 @@ template docAbstraction() { } auto image_list = (_images.sort()).uniq; /+ 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); @@ -2110,8 +2139,8 @@ template docAbstraction() { } } /+ 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); @@ -2147,8 +2176,8 @@ template docAbstraction() { } } /+ 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); @@ -2187,10 +2216,10 @@ template docAbstraction() { 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) { } @@ -2233,8 +2262,8 @@ template docAbstraction() { +/ } /+ 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); @@ -2273,11 +2302,12 @@ template docAbstraction() { 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(); @@ -2305,8 +2335,19 @@ template docAbstraction() { } } } - 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]) { @@ -2316,8 +2357,8 @@ template docAbstraction() { } } } - 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]) { @@ -2327,8 +2368,8 @@ template docAbstraction() { } } } - 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]) { @@ -2338,8 +2379,8 @@ template docAbstraction() { } } } - 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]) { @@ -2349,8 +2390,8 @@ template docAbstraction() { } } } - 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]) { @@ -2394,17 +2435,17 @@ template docAbstraction() { // the_dom_tail_section ~= comp_obj_heading_; // remove tail for now, decide on later 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, ]; string[][string] document_section_keys_sequenced = [ "scroll": ["head", "toc", "body",], @@ -2455,13 +2496,14 @@ template docAbstraction() { writeln("segnames_lv1_to_4: ", segnames_lv1_to_4); } 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); @@ -4810,7 +4852,7 @@ template docAbstraction() { 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; @@ -4850,7 +4892,7 @@ template docAbstraction() { 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"; @@ -4887,7 +4929,7 @@ template docAbstraction() { default: break; } - return the_table_of_contents_section; + return the_document_toc_section; } invariant() { } @@ -5652,7 +5694,7 @@ template docAbstraction() { 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; @@ -5681,7 +5723,7 @@ template docAbstraction() { 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; @@ -5706,7 +5748,7 @@ template docAbstraction() { 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; @@ -5727,7 +5769,7 @@ template docAbstraction() { 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_; @@ -5751,10 +5793,10 @@ template docAbstraction() { 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; } } |