From 0eb90521fc3b9943ce99400dea97f548934d4335 Mon Sep 17 00:00:00 2001 From: Ralph Amissah Date: Mon, 18 Dec 2023 23:22:41 -0500 Subject: org, ocda (ongoing) --- src/doc_reform/meta/metadoc_from_src.d | 563 +++++++++++++++++---------------- 1 file changed, 289 insertions(+), 274 deletions(-) (limited to 'src/doc_reform/meta') diff --git a/src/doc_reform/meta/metadoc_from_src.d b/src/doc_reform/meta/metadoc_from_src.d index 7374c76..53179b5 100644 --- a/src/doc_reform/meta/metadoc_from_src.d +++ b/src/doc_reform/meta/metadoc_from_src.d @@ -123,7 +123,7 @@ template docAbstraction() { return _e(); } // initialize - 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; + ObjGenericComposite[] the_document_toc_section, the_document_head_section, the_document_body_section, the_document_endnotes_section, the_document_bibliography_section, the_document_bookindex_section, the_document_glossary_section, the_document_blurb_section, the_document_xml_dom_tail_section; struct _theDoc { ObjGenericComposite[] toc; ObjGenericComposite[] head; @@ -189,6 +189,14 @@ template docAbstraction() { OCNset obj_cite_digits; int obj_cite_digit_, obj_cite_digit_off, obj_cite_digit_bkidx, obj_cite_digit_type; auto object_citation_number = OCNemitter(); + struct ST_endnotes { + ObjGenericComposite[] endnotes; + OCNset ocn; + } + struct ST_bookindex { + ObjGenericComposite[] bookindex; + OCNset ocn; + } int[] dom_structure_markedup_tags_status = [ 0, 0, 0, 0, 0, 0, 0, 0, 0,]; int[] dom_structure_markedup_tags_status_buffer = [ 0, 0, 0, 0, 0, 0, 0, 0, 0,]; int[] dom_structure_collapsed_tags_status = [ 0, 0, 0, 0, 0, 0, 0, 0, 0,]; @@ -1570,280 +1578,282 @@ template docAbstraction() { tag_assoc[comp_obj_heading_.tags.segment_anchor_tag_epub]["seg_lv1to4"] = comp_obj_heading_.tags.segment_anchor_tag_epub; } // endNotes - auto en_tuple = note_section.endnote_objects(obj_cite_digits, opt_action); // endnotes, check - auto the_document_endnotes_section = en_tuple[0]; - obj_cite_digits = en_tuple[1]; - debug(endnotes) { - writefln("%s %s", __LINE__, the_document_endnotes_section.length); - foreach (o; the_document_endnotes_section) { writeln(o); } - } - // glossary - if (an_object["glossary_nugget"].length == 0) { - comp_obj_heading_ = comp_obj_heading_.init; - comp_obj_heading_.metainfo.is_of_part = "empty"; - comp_obj_heading_.metainfo.is_of_section = "empty"; - comp_obj_heading_.metainfo.is_of_type = "para"; - comp_obj_heading_.metainfo.is_a = "heading"; - comp_obj_heading_.text = "(skip) there is no Glossary section"; - comp_obj_heading_.metainfo.ocn = 0; - comp_obj_heading_.metainfo.identifier = ""; - comp_obj_heading_.metainfo.dummy_heading = true; - comp_obj_heading_.metainfo.object_number_off = true; - comp_obj_heading_.metainfo.object_number_type = 0; - 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; - the_document_glossary_section ~= comp_obj_heading_; - } - debug(glossary) { foreach (gloss; the_document_glossary_section) { writeln(gloss.text); } } - // bibliography - auto biblio_unsorted_incomplete = biblio_arr_json.dup; - auto biblio = Bibliography(); - JSONValue[] biblio_ordered; - { - auto _get = biblio.flow_bibliography_(biblio_unsorted_incomplete, bib_arr_json); + ST_endnotes en_st = note_section.backmatter_endnote_objects(obj_cite_digits, opt_action); + { // endnotes + the_document_endnotes_section = en_st.endnotes; + obj_cite_digits = en_st.ocn; + debug(endnotes) { + writefln("%s %s", __LINE__, the_document_endnotes_section.length); + foreach (o; the_document_endnotes_section) { writeln(o); } + } + } + { // glossary + if (an_object["glossary_nugget"].length == 0) { + comp_obj_heading_ = comp_obj_heading_.init; + comp_obj_heading_.metainfo.is_of_part = "empty"; + comp_obj_heading_.metainfo.is_of_section = "empty"; + comp_obj_heading_.metainfo.is_of_type = "para"; + comp_obj_heading_.metainfo.is_a = "heading"; + comp_obj_heading_.text = "(skip) there is no Glossary section"; + comp_obj_heading_.metainfo.ocn = 0; + comp_obj_heading_.metainfo.identifier = ""; + comp_obj_heading_.metainfo.dummy_heading = true; + comp_obj_heading_.metainfo.object_number_off = true; + comp_obj_heading_.metainfo.object_number_type = 0; + 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; + the_document_glossary_section ~= comp_obj_heading_; + } + debug(glossary) { foreach (gloss; the_document_glossary_section) { writeln(gloss.text); } } + } + { // bibliography + string[] biblio_unsorted_incomplete = biblio_arr_json.dup; + Bibliography biblio = Bibliography(); + JSONValue[] biblio_ordered; + ST_flow_bibliography _get = biblio.flow_bibliography_(biblio_unsorted_incomplete, bib_arr_json); { biblio_ordered = _get.biblio_sorted; bib_arr_json = _get.bib_arr_json; biblio_unsorted_incomplete = _get.biblio_unsorted_incomplete; } - } - if (biblio_ordered.length > 0) { - { - comp_obj_heading_ = comp_obj_heading_.init; - comp_obj_heading_.metainfo.is_of_part = "backmatter"; - comp_obj_heading_.metainfo.is_of_section = "bibliography"; - comp_obj_heading_.metainfo.is_of_type = "para"; - comp_obj_heading_.metainfo.is_a = "heading"; - comp_obj_heading_.text = "Bibliography"; - 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_bibliography"; - comp_obj_heading_.tags.anchor_tag_html = comp_obj_heading_.tags.segment_anchor_tag_epub; - comp_obj_heading_.tags.in_segment_html = "bibliography"; - comp_obj_heading_.tags.anchor_tags = ["section_bibliography"]; - 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 = [ 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_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_lv1to4"] = comp_obj_heading_.tags.segment_anchor_tag_epub; + if (biblio_ordered.length > 0) { + { + comp_obj_heading_ = comp_obj_heading_.init; + comp_obj_heading_.metainfo.is_of_part = "backmatter"; + comp_obj_heading_.metainfo.is_of_section = "bibliography"; + comp_obj_heading_.metainfo.is_of_type = "para"; + comp_obj_heading_.metainfo.is_a = "heading"; + comp_obj_heading_.text = "Bibliography"; + 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_bibliography"; + comp_obj_heading_.tags.anchor_tag_html = comp_obj_heading_.tags.segment_anchor_tag_epub; + comp_obj_heading_.tags.in_segment_html = "bibliography"; + comp_obj_heading_.tags.anchor_tags = ["section_bibliography"]; + 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 = [ 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_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_lv1to4"] = comp_obj_heading_.tags.segment_anchor_tag_epub; + } + { + comp_obj_heading_ = comp_obj_heading_.init; + comp_obj_heading_.metainfo.is_of_part = "backmatter"; + comp_obj_heading_.metainfo.is_of_section = "bibliography"; + comp_obj_heading_.metainfo.is_of_type = "para"; + comp_obj_heading_.metainfo.is_a = "heading"; + comp_obj_heading_.text = "Bibliography"; + comp_obj_heading_.metainfo.ocn = 0; + comp_obj_heading_.metainfo.identifier = ""; + comp_obj_heading_.metainfo.dummy_heading = true; + comp_obj_heading_.metainfo.object_number_off = true; + comp_obj_heading_.metainfo.object_number_type = 0; + comp_obj_heading_.tags.segment_anchor_tag_epub = "bibliography"; + comp_obj_heading_.tags.anchor_tag_html = comp_obj_heading_.tags.segment_anchor_tag_epub; + comp_obj_heading_.tags.in_segment_html = comp_obj_heading_.tags.anchor_tag_html; + comp_obj_heading_.metainfo.heading_lev_markup = 4; + comp_obj_heading_.metainfo.heading_lev_collapsed = 2; + comp_obj_heading_.metainfo.parent_ocn = 1; + comp_obj_heading_.metainfo.parent_lev_markup = 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_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_lv1to4"] = comp_obj_heading_.tags.segment_anchor_tag_epub; + } + { + string out_; + foreach (entry; biblio_ordered) { + out_ = format("%s \"%s\"%s%s%s%s%s%s%s%s%s.", + ((entry["author"].str.empty) ? entry["editor"].str : entry["author"].str), + entry["fulltitle"].str, + ((entry["journal"].str.empty) ? "" : ", " ~ mkup.ff_i ~ mkup.italic ~ mkup.ff_o ~ entry["journal"].str ~ mkup.ff_c ~ mkup.italic), + ((entry["volume"].str.empty) ? "" : ", " ~ entry["volume"].str), + ((entry["in"].str.empty) ? "" : ", " ~ entry["in"].str), + ((!(entry["author"].str.empty) && (!(entry["editor"].str.empty))) ? entry["editor"].str : ""), + ", " ~ entry["year"].str, + ((entry["pages"].str.empty) ? "" : ", " ~ entry["pages"].str), + ((entry["publisher"].str.empty) ? "" : ", " ~ entry["publisher"].str), + ((entry["place"].str.empty) ? "" : ", " ~ entry["place"].str), + ((entry["url"].str.empty) ? "" : ", [" ~ entry["url"].str ~ "]"), + ); + comp_obj_para = comp_obj_para.init; + comp_obj_para.metainfo.is_of_part = "backmatter"; + comp_obj_para.metainfo.is_of_section = "bibliography"; + comp_obj_para.metainfo.is_of_type = "para"; + comp_obj_para.metainfo.is_a = "bibliography"; + comp_obj_para.text = out_.to!string.strip; + comp_obj_para.metainfo.ocn = 0; + comp_obj_para.metainfo.identifier = ""; + comp_obj_para.metainfo.object_number_off = true; + comp_obj_para.metainfo.object_number_type = 0; + 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_tag]; + the_document_bibliography_section ~= comp_obj_para; + } + } + } else { + comp_obj_heading_ = comp_obj_heading_.init; + comp_obj_heading_.metainfo.is_of_part = "empty"; + comp_obj_heading_.metainfo.is_of_section = "empty"; + comp_obj_heading_.metainfo.is_of_type = "para"; + comp_obj_heading_.metainfo.is_a = "heading"; + comp_obj_heading_.text = "(skip) there is no Bibliography"; + comp_obj_heading_.metainfo.ocn = 0; + comp_obj_heading_.metainfo.identifier = ""; + comp_obj_heading_.metainfo.dummy_heading = true; + comp_obj_heading_.metainfo.object_number_off = true; + comp_obj_heading_.metainfo.object_number_type = 0; + 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; + the_document_bibliography_section ~= comp_obj_heading_; + } + debug(bibliosection) { foreach (o; the_document_bibliography_section) { writeln(o.text); } } + } + { // bookindex + BookIndexReportSection bi = BookIndexReportSection(); + ST_bookindex bi_st + = bi.backmatter_bookindex_build_abstraction_section(bookindex_unordered_hashes, obj_cite_digits, opt_action); + destroy(bookindex_unordered_hashes); + the_document_bookindex_section = bi_st.bookindex; + obj_cite_digits = bi_st.ocn; + debug(bookindex) { foreach (bi_entry; the_document_bookindex_section) { writeln(bi_entry); } } + } + { // blurb + if (an_object["blurb_nugget"].length == 0) { + comp_obj_heading_ = comp_obj_heading_.init; + comp_obj_heading_.metainfo.is_of_part = "empty"; + comp_obj_heading_.metainfo.is_of_section = "empty"; + comp_obj_heading_.metainfo.is_of_type = "para"; + comp_obj_heading_.metainfo.is_a = "heading"; + comp_obj_heading_.text = "(skip) there is no Blurb section"; + comp_obj_heading_.metainfo.ocn = 0; + comp_obj_heading_.metainfo.identifier = ""; + comp_obj_para.metainfo.object_number_off = true; + comp_obj_para.metainfo.object_number_type = 0; + comp_obj_heading_.tags.segment_anchor_tag_epub = ""; + comp_obj_heading_.tags.anchor_tag_html = ""; + comp_obj_heading_.tags.in_segment_html = ""; + 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; + the_document_blurb_section ~= comp_obj_heading_; + } + debug(blurb) { foreach (blurb; the_document_blurb_section) { writeln(blurb.text); } } + } + { // toc gather backmatter + indent = [ + "hang_position" : 1, + "base_position" : 1, + ]; + comp_obj_toc = comp_obj_toc.init; + comp_obj_toc.metainfo.is_of_part = "frontmatter"; + comp_obj_toc.metainfo.is_of_section = "toc"; + comp_obj_toc.metainfo.is_of_type = "para"; + comp_obj_toc.metainfo.is_a = "toc"; + comp_obj_toc.metainfo.ocn = 0; + comp_obj_toc.metainfo.identifier = ""; + comp_obj_toc.metainfo.object_number_off = true; + 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_document_endnotes_section.length > 1) { + toc_txt_ = format("%s%s%s%s#%s%s", + mkup.lnk_o, + "Endnotes", + mkup.lnk_c, + mkup.url_o, + "endnotes", + mkup.url_c, + ); + toc_txt_= toc_txt_.links_and_images; + comp_obj_toc.text = toc_txt_.to!string.strip; + comp_obj_toc.has.inline_links = true; + the_document_toc_section ~= comp_obj_toc; } - { - comp_obj_heading_ = comp_obj_heading_.init; - comp_obj_heading_.metainfo.is_of_part = "backmatter"; - comp_obj_heading_.metainfo.is_of_section = "bibliography"; - comp_obj_heading_.metainfo.is_of_type = "para"; - comp_obj_heading_.metainfo.is_a = "heading"; - comp_obj_heading_.text = "Bibliography"; - comp_obj_heading_.metainfo.ocn = 0; - comp_obj_heading_.metainfo.identifier = ""; - comp_obj_heading_.metainfo.dummy_heading = true; - comp_obj_heading_.metainfo.object_number_off = true; - comp_obj_heading_.metainfo.object_number_type = 0; - comp_obj_heading_.tags.segment_anchor_tag_epub = "bibliography"; - comp_obj_heading_.tags.anchor_tag_html = comp_obj_heading_.tags.segment_anchor_tag_epub; - comp_obj_heading_.tags.in_segment_html = comp_obj_heading_.tags.anchor_tag_html; - comp_obj_heading_.metainfo.heading_lev_markup = 4; - comp_obj_heading_.metainfo.heading_lev_collapsed = 2; - comp_obj_heading_.metainfo.parent_ocn = 1; - comp_obj_heading_.metainfo.parent_lev_markup = 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_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_lv1to4"] = comp_obj_heading_.tags.segment_anchor_tag_epub; + if (the_document_glossary_section.length > 1) { + toc_txt_ = format("%s%s%s%s#%s%s", + mkup.lnk_o, + "Glossary", + mkup.lnk_c, + mkup.url_o, + "glossary", + mkup.url_c, + ); + toc_txt_= toc_txt_.links_and_images; + comp_obj_toc.text = toc_txt_.to!string.strip; + comp_obj_toc.has.inline_links = true; + the_document_toc_section ~= comp_obj_toc; } - { - string out_; - foreach (entry; biblio_ordered) { - out_ = format("%s \"%s\"%s%s%s%s%s%s%s%s%s.", - ((entry["author"].str.empty) ? entry["editor"].str : entry["author"].str), - entry["fulltitle"].str, - ((entry["journal"].str.empty) ? "" : ", " ~ mkup.ff_i ~ mkup.italic ~ mkup.ff_o ~ entry["journal"].str ~ mkup.ff_c ~ mkup.italic), - ((entry["volume"].str.empty) ? "" : ", " ~ entry["volume"].str), - ((entry["in"].str.empty) ? "" : ", " ~ entry["in"].str), - ((!(entry["author"].str.empty) && (!(entry["editor"].str.empty))) ? entry["editor"].str : ""), - ", " ~ entry["year"].str, - ((entry["pages"].str.empty) ? "" : ", " ~ entry["pages"].str), - ((entry["publisher"].str.empty) ? "" : ", " ~ entry["publisher"].str), - ((entry["place"].str.empty) ? "" : ", " ~ entry["place"].str), - ((entry["url"].str.empty) ? "" : ", [" ~ entry["url"].str ~ "]"), - ); - comp_obj_para = comp_obj_para.init; - comp_obj_para.metainfo.is_of_part = "backmatter"; - comp_obj_para.metainfo.is_of_section = "bibliography"; - comp_obj_para.metainfo.is_of_type = "para"; - comp_obj_para.metainfo.is_a = "bibliography"; - comp_obj_para.text = out_.to!string.strip; - comp_obj_para.metainfo.ocn = 0; - comp_obj_para.metainfo.identifier = ""; - comp_obj_para.metainfo.object_number_off = true; - comp_obj_para.metainfo.object_number_type = 0; - 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_tag]; - the_document_bibliography_section ~= comp_obj_para; + if (the_document_bibliography_section.length > 1){ + toc_txt_ = format("%s%s%s%s#%s%s", + mkup.lnk_o, + "Bibliography", + mkup.lnk_c, + mkup.url_o, + "bibliography", + mkup.url_c, + ); + toc_txt_= toc_txt_.links_and_images; + comp_obj_toc.text = toc_txt_.to!string.strip; + comp_obj_toc.has.inline_links = true; + the_document_toc_section ~= comp_obj_toc; + } + if (the_document_bookindex_section.length > 1) { + toc_txt_ = format("%s%s%s%s#%s%s", + mkup.lnk_o, + "Book Index", + mkup.lnk_c, + mkup.url_o, + "bookindex", + mkup.url_c, + ); + toc_txt_= toc_txt_.links_and_images; + comp_obj_toc.text = toc_txt_.to!string.strip; + comp_obj_toc.has.inline_links = true; + the_document_toc_section ~= comp_obj_toc; + } + if (the_document_blurb_section.length > 1) { + toc_txt_ = format("%s%s%s%s#%s%s", + mkup.lnk_o, + "Blurb", + mkup.lnk_c, + mkup.url_o, + "blurb", + mkup.url_c, + ); + toc_txt_= toc_txt_.links_and_images; + comp_obj_toc.has.inline_links = true; + comp_obj_toc.text = toc_txt_.to!string.strip; + the_document_toc_section ~= comp_obj_toc; + } + debug(toc) { + writefln( "%s %s", __LINE__,); + foreach (toc_linked_heading; the_document_toc_section) { + writeln(mkup.indent_by_spaces_provided(toc_linked_heading.attrib.indent_hang), toc_linked_heading.text); } } - } else { - comp_obj_heading_ = comp_obj_heading_.init; - comp_obj_heading_.metainfo.is_of_part = "empty"; - comp_obj_heading_.metainfo.is_of_section = "empty"; - comp_obj_heading_.metainfo.is_of_type = "para"; - comp_obj_heading_.metainfo.is_a = "heading"; - comp_obj_heading_.text = "(skip) there is no Bibliography"; - comp_obj_heading_.metainfo.ocn = 0; - comp_obj_heading_.metainfo.identifier = ""; - comp_obj_heading_.metainfo.dummy_heading = true; - comp_obj_heading_.metainfo.object_number_off = true; - comp_obj_heading_.metainfo.object_number_type = 0; - 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; - the_document_bibliography_section ~= comp_obj_heading_; - } - debug(bibliosection) { foreach (o; the_document_bibliography_section) { writeln(o.text); } } - auto bi = BookIndexReportSection(); - auto bi_tuple - = bi.bookindex_build_abstraction_section( - bookindex_unordered_hashes, - obj_cite_digits, - opt_action, - ); - // bookindex - destroy(bookindex_unordered_hashes); - auto the_document_bookindex_section = bi_tuple[0]; - obj_cite_digits = bi_tuple[1]; - debug(bookindex) { foreach (bi_entry; the_document_bookindex_section) { writeln(bi_entry); } } - if (an_object["blurb_nugget"].length == 0) { - comp_obj_heading_ = comp_obj_heading_.init; - comp_obj_heading_.metainfo.is_of_part = "empty"; - comp_obj_heading_.metainfo.is_of_section = "empty"; - comp_obj_heading_.metainfo.is_of_type = "para"; - comp_obj_heading_.metainfo.is_a = "heading"; - comp_obj_heading_.text = "(skip) there is no Blurb section"; - comp_obj_heading_.metainfo.ocn = 0; - comp_obj_heading_.metainfo.identifier = ""; - comp_obj_para.metainfo.object_number_off = true; - comp_obj_para.metainfo.object_number_type = 0; - comp_obj_heading_.tags.segment_anchor_tag_epub = ""; - comp_obj_heading_.tags.anchor_tag_html = ""; - comp_obj_heading_.tags.in_segment_html = ""; - 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; - the_document_blurb_section ~= comp_obj_heading_; - } - // blurb - debug(blurb) { foreach (blurb; the_document_blurb_section) { writeln(blurb.text); } } - indent = [ - "hang_position" : 1, - "base_position" : 1, - ]; - comp_obj_toc = comp_obj_toc.init; - comp_obj_toc.metainfo.is_of_part = "frontmatter"; - comp_obj_toc.metainfo.is_of_section = "toc"; - comp_obj_toc.metainfo.is_of_type = "para"; - comp_obj_toc.metainfo.is_a = "toc"; - comp_obj_toc.metainfo.ocn = 0; - comp_obj_toc.metainfo.identifier = ""; - comp_obj_toc.metainfo.object_number_off = true; - 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; - // use gathered - if (the_document_endnotes_section.length > 1) { - toc_txt_ = format("%s%s%s%s#%s%s", - mkup.lnk_o, - "Endnotes", - mkup.lnk_c, - mkup.url_o, - "endnotes", - mkup.url_c, - ); - toc_txt_= toc_txt_.links_and_images; - comp_obj_toc.text = toc_txt_.to!string.strip; - comp_obj_toc.has.inline_links = true; - the_document_toc_section ~= comp_obj_toc; - } - if (the_document_glossary_section.length > 1) { - toc_txt_ = format("%s%s%s%s#%s%s", - mkup.lnk_o, - "Glossary", - mkup.lnk_c, - mkup.url_o, - "glossary", - mkup.url_c, - ); - toc_txt_= toc_txt_.links_and_images; - comp_obj_toc.text = toc_txt_.to!string.strip; - comp_obj_toc.has.inline_links = true; - the_document_toc_section ~= comp_obj_toc; - } - if (the_document_bibliography_section.length > 1){ - toc_txt_ = format("%s%s%s%s#%s%s", - mkup.lnk_o, - "Bibliography", - mkup.lnk_c, - mkup.url_o, - "bibliography", - mkup.url_c, - ); - toc_txt_= toc_txt_.links_and_images; - comp_obj_toc.text = toc_txt_.to!string.strip; - comp_obj_toc.has.inline_links = true; - the_document_toc_section ~= comp_obj_toc; - } - if (the_document_bookindex_section.length > 1) { - toc_txt_ = format("%s%s%s%s#%s%s", - mkup.lnk_o, - "Book Index", - mkup.lnk_c, - mkup.url_o, - "bookindex", - mkup.url_c, - ); - toc_txt_= toc_txt_.links_and_images; - comp_obj_toc.text = toc_txt_.to!string.strip; - comp_obj_toc.has.inline_links = true; - the_document_toc_section ~= comp_obj_toc; } - if (the_document_blurb_section.length > 1) { - toc_txt_ = format("%s%s%s%s#%s%s", - mkup.lnk_o, - "Blurb", - mkup.lnk_c, - mkup.url_o, - "blurb", - mkup.url_c, - ); - toc_txt_= toc_txt_.links_and_images; - comp_obj_toc.has.inline_links = true; - comp_obj_toc.text = toc_txt_.to!string.strip; - the_document_toc_section ~= comp_obj_toc; + { // document head and body + the_document_head_section ~= the_document_body_section[0]; + the_document_body_section = the_document_body_section[1..$]; } - debug(toc) { - writefln( "%s %s", __LINE__,); - foreach (toc_linked_heading; the_document_toc_section) { - writeln(mkup.indent_by_spaces_provided(toc_linked_heading.attrib.indent_hang), toc_linked_heading.text); - } - } - // document head and body - the_document_head_section ~= the_document_body_section[0]; - the_document_body_section = the_document_body_section[1..$]; // document ancestors @safe int[] _get_ancestors_markup(O)(O obj, ref int[] _ancestors_markup) { if (obj.metainfo.is_a == "heading") { @@ -2165,7 +2175,6 @@ template docAbstraction() { } return images_; } - string[] segnames_0_to_4; @system auto _image_dimensions(O,M)(O obj, M manifested) { if (obj.has.image_without_dimensions) { import std.math; @@ -2224,6 +2233,7 @@ template docAbstraction() { return obj; } // document head + string[] segnames_0_to_4; foreach (ref obj; the_document_head_section) { if (obj.metainfo.is_a == "heading") { debug(dom) { writeln(obj.text); } @@ -5639,7 +5649,7 @@ template docAbstraction() { ++mkn; } } - @system auto bookindex_build_abstraction_section(B)( + @system ST_bookindex backmatter_bookindex_build_abstraction_section(B)( string[][string][string] bookindex_unordered_hashes, OCNset obj_cite_digits, B opt_action, @@ -5788,11 +5798,12 @@ template docAbstraction() { comp_obj_heading_.metainfo.parent_lev_markup = 0; bookindex_section ~= comp_obj_heading_; } - auto t = tuple( - bookindex_section, - obj_cite_digits - ); - return t; + ST_bookindex ret; + { + ret.bookindex = bookindex_section; + ret.ocn = obj_cite_digits; + } + return ret; } } struct NotesSection { @@ -5889,7 +5900,7 @@ template docAbstraction() { } return endnotes_; } - @safe private auto endnote_objects(O)( + @safe private ST_endnotes backmatter_endnote_objects(O)( OCNset obj_cite_digits, O opt_action, ) { @@ -5996,8 +6007,12 @@ template docAbstraction() { the_document_endnotes_section ~= comp_obj_endnote_; } } - auto t = tuple(the_document_endnotes_section, obj_cite_digits); - return t; + ST_endnotes ret; + { + ret.endnotes = the_document_endnotes_section; + ret.ocn = obj_cite_digits; + } + return ret; } } struct Bibliography { -- cgit v1.2.3