diff options
| author | Ralph Amissah <ralph.amissah@gmail.com> | 2023-12-18 23:22:41 -0500 | 
|---|---|---|
| committer | Ralph Amissah <ralph.amissah@gmail.com> | 2023-12-21 09:06:40 -0500 | 
| commit | 0eb90521fc3b9943ce99400dea97f548934d4335 (patch) | |
| tree | a16a2dd53ea11f5022b0589651927d2b003d38e6 /org/ocda.org | |
| parent | org, ocda (ongoing) (diff) | |
org, ocda (ongoing)
Diffstat (limited to 'org/ocda.org')
| -rw-r--r-- | org/ocda.org | 796 | 
1 files changed, 504 insertions, 292 deletions
| diff --git a/org/ocda.org b/org/ocda.org index 77913f9..66e3870 100644 --- a/org/ocda.org +++ b/org/ocda.org @@ -124,7 +124,7 @@ mixin spineRgxIn;    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; @@ -190,6 +190,14 @@ struct OCNset {  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,]; @@ -1578,6 +1586,58 @@ auto loopMarkupSrcByLine(  #+NAME: docAbstractionPostMainLoop  #+HEADER: :noweb yes  #+BEGIN_SRC d +<<docAbstractionRelatedFunctionsBackMatter>> +<<docAbstractionRelatedFunctionsEndnotes>> +<<docAbstractionRelatedFunctionsGlossary>> +<<docAbstractionRelatedFunctionsBibliography>> +<<docAbstractionRelatedFunctionsBookIndex>> +<<docAbstractionRelatedFunctionsBlurb>> +<<docAbstractionRelatedFunctionsTOCgather>> +<<docAbstractionDocHeadAndBody>> +<<docAbstractionAncestors>> +<<docAbstractionSegNames>> +<<docAbstractionDecendants>> +<<docAbstractionRelatedFunctionsImages>> +<<docAbstractionLinks>> +<<docAbstractionSegNamesLinkedAndImages>> +<<docAbstractionEndnotes>> +<<docAbstractionGlossary>> +<<docAbstractionBibliography>> +<<docAbstractionBookIndex>> +<<docAbstractionBlurb>> +<<docAbstractionGetDecendants>> +<<docAbstractionHeadingCloseOpenTags>> +// the_dom_tail_section                      ~= comp_obj_heading_; // remove tail for now, decide on later +<<docAbstractionTheDoc>> +<<docAbstractionDocReInit>> +<<docAbstractionDocHasParts>> +#+END_SRC + +*** return structure + +#+NAME: docAbstractionReturnsStruct +#+HEADER: :noweb yes +#+BEGIN_SRC d +// the doc to be returned +struct ST_docAbstraction { +  ObjGenericComposite[][string] document_the; +  DocHas_                       doc_has; +} +ST_docAbstraction ret; +{ +  ret.document_the = document_the; +  ret.doc_has      = doc_has; +} +return ret; +#+END_SRC + +** docAbstraction Functions (post loop) +*** Back Matter (added after end of document loop) +**** Back Matter + +#+NAME: docAbstractionRelatedFunctionsBackMatter +#+HEADER: :noweb yes +#+BEGIN_SRC d  { // EOF  backMatter    comp_obj_heading_                                              = comp_obj_heading_.init;    comp_obj_heading_.metainfo.is_of_part                          = "backmatter"; @@ -1604,281 +1664,340 @@ auto loopMarkupSrcByLine(    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;  } +#+END_SRC + +**** Endnotes function (add gathered endnotes) + +#+NAME: docAbstractionRelatedFunctionsEndnotes +#+HEADER: :noweb yes +#+BEGIN_SRC d  // 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); } +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_; +#+END_SRC + +**** Glossary function + +#+NAME: docAbstractionRelatedFunctionsGlossary +#+HEADER: :noweb yes +#+BEGIN_SRC d +{ // 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); } }  } -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); +#+END_SRC + +**** Bibliography function + +#+NAME: docAbstractionRelatedFunctionsBibliography +#+HEADER: :noweb yes +#+BEGIN_SRC d +{ // 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; +    } +    { +      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); } }  } -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); } } -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; +#+END_SRC + +**** Book Index function + +#+NAME: docAbstractionRelatedFunctionsBookIndex +#+HEADER: :noweb yes +#+BEGIN_SRC d +{ // 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); } }  } -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; +#+END_SRC + +**** Blurb function + +#+NAME: docAbstractionRelatedFunctionsBlurb +#+HEADER: :noweb yes +#+BEGIN_SRC d +{ // 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); } }  } -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); +#+END_SRC + +**** TOC gather function + +#+NAME: docAbstractionRelatedFunctionsTOCgather +#+HEADER: :noweb yes +#+BEGIN_SRC d +{ // 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;    } +  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; +  } +  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); +    } +  } +} +#+END_SRC + +*** Doc Head and Body + +#+NAME: docAbstractionDocHeadAndBody +#+HEADER: :noweb yes +#+BEGIN_SRC d +{ // document head and body +  the_document_head_section ~= the_document_body_section[0]; +  the_document_body_section = the_document_body_section[1..$];  } -// document head and body -the_document_head_section ~= the_document_body_section[0]; -the_document_body_section = the_document_body_section[1..$]; +#+END_SRC + +*** Extract +**** Ancestors + +#+NAME: docAbstractionAncestors +#+HEADER: :noweb yes +#+BEGIN_SRC d  // document ancestors  @safe int[] _get_ancestors_markup(O)(O obj, ref int[] _ancestors_markup) {    if (obj.metainfo.is_a == "heading") { @@ -2067,6 +2186,13 @@ if (the_document_body_section.length > 1) {      writeln("ancestors collapsed o_n: ", obj.metainfo.markedup_ancestors);    }  } +#+END_SRC + +**** SegNames + +#+NAME: docAbstractionSegNames +#+HEADER: :noweb yes +#+BEGIN_SRC d  // segnames  if (the_document_endnotes_section.length > 1) {    segnames["html"] ~= "endnotes"; @@ -2143,6 +2269,13 @@ if (the_document_blurb_section.length > 1) {    }    html_segnames_ptr_cntr++;  } +#+END_SRC + +**** Decendants + +#+NAME: docAbstractionDecendants +#+HEADER: :noweb yes +#+BEGIN_SRC d  // decendants  @safe auto get_decendants()(ObjGenericComposite[] document_sections) {    int[string] _heading_ocn_decendants; @@ -2191,6 +2324,13 @@ if (the_document_blurb_section.length > 1) {    }    return pairs.sort;  } +#+END_SRC + +**** Images + +#+NAME: docAbstractionRelatedFunctionsImages +#+HEADER: :noweb yes +#+BEGIN_SRC d  // images  string[] _images;  @safe string[] extract_images()(string content_block) { @@ -2200,7 +2340,6 @@ string[] _images;    }    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; @@ -2238,6 +2377,13 @@ string[] segnames_0_to_4;    }    return obj;  } +#+END_SRC + +**** Links + +#+NAME: docAbstractionLinks +#+HEADER: :noweb yes +#+BEGIN_SRC d  // links  @safe auto _links(O)(O obj) {    if (auto m = obj.text.match(rgx.inline_link_stow_uri)) { @@ -2258,7 +2404,15 @@ string[] segnames_0_to_4;    }    return obj;  } +#+END_SRC + +**** SegNames with links and Images + +#+NAME: docAbstractionSegNamesLinkedAndImages +#+HEADER: :noweb yes +#+BEGIN_SRC d  // 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); } @@ -2347,6 +2501,14 @@ if (the_document_body_section.length > 1) {    }  }  auto image_list = (_images.sort()).uniq; +#+END_SRC + +*** Level 1~ +**** Endnotes + +#+NAME: docAbstractionEndnotes +#+HEADER: :noweb yes +#+BEGIN_SRC d  // endnotes optional only one 1~ level  if (the_document_endnotes_section.length > 1) {    dom_structure_markedup_tags_status_buffer           = dom_structure_markedup_tags_status.dup; @@ -2382,6 +2544,13 @@ if (the_document_endnotes_section.length > 1) {      obj = _links(obj);    }  } +#+END_SRC + +**** Glossary + +#+NAME: docAbstractionGlossary +#+HEADER: :noweb yes +#+BEGIN_SRC d  // glossary optional only one 1~ level  if (the_document_glossary_section.length > 1) {    foreach (ref obj; the_document_glossary_section) { @@ -2417,6 +2586,13 @@ if (the_document_glossary_section.length > 1) {      obj = _links(obj);    }  } +#+END_SRC + +**** Bibliography + +#+NAME: docAbstractionBibliography +#+HEADER: :noweb yes +#+BEGIN_SRC d  // bibliography optional only one 1~ level  if (the_document_bibliography_section.length > 1) {    foreach (ref obj; the_document_bibliography_section) { @@ -2452,6 +2628,13 @@ if (the_document_bibliography_section.length > 1) {      obj = _links(obj);    }  } +#+END_SRC + +**** Book Index + +#+NAME: docAbstractionBookIndex +#+HEADER: :noweb yes +#+BEGIN_SRC d  // book index, optional only one 1~ level  int ocn_       = obj_cite_digits.object_number;  int ocn_bkidx_ = 0; @@ -2498,6 +2681,13 @@ if (the_document_bookindex_section.length > 1) {    // TODO assert failure, reinstate    // assert(obj_cite_digit_bkidx == ocn_bidx_ obj_cite_digit_bkidx ~ " == ocn_" ~ ocn_ ~ "?");  } +#+END_SRC + +**** Blurb + +#+NAME: docAbstractionBlurb +#+HEADER: :noweb yes +#+BEGIN_SRC d  // blurb optional only one 1~ level  if (the_document_blurb_section.length > 1) {    foreach (ref obj; the_document_blurb_section) { @@ -2533,6 +2723,13 @@ if (the_document_blurb_section.length > 1) {      obj = _links(obj);    }  } +#+END_SRC + +*** Get Decendants + +#+NAME: docAbstractionGetDecendants +#+HEADER: :noweb yes +#+BEGIN_SRC d  // get decendants  if (the_document_body_section.length > 1) {    auto pairs = get_decendants( @@ -2638,6 +2835,13 @@ if (the_document_body_section.length > 1) {      }    }  } +#+END_SRC + +*** Heading Closes All Open Tags + +#+NAME: docAbstractionHeadingCloseOpenTags +#+HEADER: :noweb yes +#+BEGIN_SRC d  // TODO  //  - note create/insert heading object sole purpose eof close all open tags  //    sort out: @@ -2667,7 +2871,13 @@ comp_obj_heading_.metainfo.dom_structure_collapsed_tags_status  = dom_structure_  comp_obj_heading_ = comp_obj_heading_.obj_dom_structure_set_markup_tags(dom_structure_markedup_tags_status, 0);  comp_obj_heading_ = comp_obj_heading_.obj_dom_set_collapsed_tags(dom_structure_collapsed_tags_status, 0);  comp_obj_heading_ = comp_obj_heading_.obj_heading_ancestors(lv_ancestors_txt); -// the_dom_tail_section                      ~= comp_obj_heading_; // remove tail for now, decide on later +#+END_SRC + +*** The Doc + +#+NAME: docAbstractionTheDoc +#+HEADER: :noweb yes +#+BEGIN_SRC d  // the doc  ObjGenericComposite[][string] document_the = [    "head":             the_document_head_section, @@ -2733,6 +2943,13 @@ debug(segnames) {    writeln("segnames_lv4:    ", segnames_4);    writeln("segnames_lv1to4: ", segnames_lv1to4);  } +#+END_SRC + +*** Doc Re Init + +#+NAME: docAbstractionDocReInit +#+HEADER: :noweb yes +#+BEGIN_SRC d  // restart  destroy(the_document_head_section);  destroy(the_document_toc_section); @@ -2758,6 +2975,13 @@ dom_structure_collapsed_tags_status         = [ 0, 0, 0, 0, 0, 0, 0, 0,];  dom_structure_collapsed_tags_status_buffer  = [ 0, 0, 0, 0, 0, 0, 0, 0,];  lev_anchor_tag = "";  anchor_tag = ""; +#+END_SRC + +*** Doc Has (identify parts) + +#+NAME: docAbstractionDocHasParts +#+HEADER: :noweb yes +#+BEGIN_SRC d  // identify parts  struct DocHas_ {    uint inline_links() { @@ -2811,25 +3035,8 @@ struct DocHas_ {  }  #+END_SRC -*** return structure - -#+NAME: docAbstractionReturnsStruct -#+HEADER: :noweb yes -#+BEGIN_SRC d -// the doc to be returned -struct ST_docAbstraction { -  ObjGenericComposite[][string] document_the; -  DocHas_                       doc_has; -} -ST_docAbstraction ret; -{ -  ret.document_the = document_the; -  ret.doc_has      = doc_has; -} -return ret; -#+END_SRC -  ** docAbstraction related Functions +*** docAbstraction related Functions  #+NAME: docAbstractionRelatedFunctions  #+HEADER: :noweb yes @@ -5687,7 +5894,7 @@ struct BookIndexReportSection {        ++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, @@ -5836,11 +6043,12 @@ struct BookIndexReportSection {        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 { @@ -5937,7 +6145,7 @@ struct NotesSection {      }      return endnotes_;    } -  @safe private auto endnote_objects(O)( +  @safe private ST_endnotes backmatter_endnote_objects(O)(      OCNset         obj_cite_digits,      O              opt_action,    ) { @@ -6044,8 +6252,12 @@ struct NotesSection {          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 { | 
