From 19a2b6255a84b89a3c8a3032d4f21076d98e8c47 Mon Sep 17 00:00:00 2001 From: Ralph Amissah Date: Sat, 12 Nov 2016 18:48:45 -0500 Subject: complete toc section to include (existing) backmatter headings --- org/ao_abstract_doc_source.org | 257 +++++++++++++++++++++++++++++++-------- src/sdp/ao_abstract_doc_source.d | 231 +++++++++++++++++++++++++++++------ 2 files changed, 405 insertions(+), 83 deletions(-) diff --git a/org/ao_abstract_doc_source.org b/org/ao_abstract_doc_source.org index 6bdd46b..6fa984e 100644 --- a/org/ao_abstract_doc_source.org +++ b/org/ao_abstract_doc_source.org @@ -185,6 +185,8 @@ auto heading_match_rgx = [ "h_3": regex(r"^(none)"), "h_4": regex(r"^(none)") ]; +string _anchor_tag; +string toc_txt_; an_object["glossary_nugget"] = ""; an_object["blurb_nugget"] = ""; auto toc_head = @@ -702,7 +704,7 @@ if ((type["heading"] == State.on) an_object, dochead_make_aa, segment_object_belongs_to, - obj_cite_number, + _anchor_tag, the_table_of_contents_section, ); _node = @@ -846,22 +848,6 @@ debug(objectrelated2) { // check #+END_SRC *** document sections -**** DONE [#B] toc, table of contents section (scroll & seg) :contents: - -#+name: abs_post -#+BEGIN_SRC d -debug(toc) { - writefln( - "%s %s", - __LINE__, - the_table_of_contents_section["seg"].length - ); - foreach (toc_linked_heading; the_table_of_contents_section["seg"]) { - writeln(toc_linked_heading.object); - } -} -#+END_SRC - **** DONE endnotes section (scroll & seg) :endnotes: #+name: abs_post @@ -883,7 +869,7 @@ debug(endnotes) { } #+END_SRC -**** TODO glossary section? +**** DONE glossary section? #+name: abs_post #+BEGIN_SRC d @@ -909,32 +895,6 @@ debug(glossary) { } #+END_SRC -**** TODO blurb section? - -#+name: abs_post -#+BEGIN_SRC d -if (an_object["blurb_nugget"].length == 0) { - writeln("no blurb"); - the_blurb_section ~= - set_abstract_object.contents_heading( - "(skip) there is no Blurb section", // nugget/object - "", // attrib - 0, // obj_cite_number - [""], // anchor tag - "B", // lev - 1, // lev_markup_number - 1, // lev_collapsed_number - ); -} else { - writeln("blurb"); -} -debug(blurb) { - foreach (blurb; the_blurb_section) { - writeln(blurb.object); - } -} -#+END_SRC - **** DONE [#B] bibliography section (objects) :bibliography: #+name: abs_post @@ -1077,6 +1037,207 @@ debug(bookindex) { // bookindex } #+END_SRC +**** DONE blurb section? + +#+name: abs_post +#+BEGIN_SRC d +if (an_object["blurb_nugget"].length == 0) { + writeln("no blurb"); + the_blurb_section ~= + set_abstract_object.contents_heading( + "(skip) there is no Blurb section", // nugget/object + "", // attrib + 0, // obj_cite_number + [""], // anchor tag + "B", // lev + 1, // lev_markup_number + 1, // lev_collapsed_number + ); +} else { + writeln("blurb"); +} +debug(blurb) { + foreach (blurb; the_blurb_section) { + writeln(blurb.object); + } +} +#+END_SRC + +**** DONE [#B] toc, table of contents section (scroll & seg) :contents: + +#+name: abs_post +#+BEGIN_SRC d + +indent=[ + "hang_position" : 1, + "base_position" : 1, +]; +if (the_endnotes_section["seg"].length > 1) { + toc_txt_ = format( + "{ %s }../%s.fn_suffix", + "Endnotes", + "endnotes", // segment_object_belongs_to + ); + the_table_of_contents_section["seg"] ~= + set_abstract_object.contents_para( + "toc", + toc_txt_, + "", // attrib + 0, + indent, + false + ); +} +if (the_endnotes_section["scroll"].length > 1) { + toc_txt_ = format( + "{ %s }#%s", + "Endnotes", + "endnotes", // _anchor_tag + ); + the_table_of_contents_section["scroll"] ~= + set_abstract_object.contents_para( + "toc", + toc_txt_, + "", // attrib + 0, + indent, + false + ); +} +if (the_glossary_section.length > 1) { + toc_txt_ = format( + "{ %s }../%s.fn_suffixs", + "Glossary", + "glossary", // segment_object_belongs_to + ); + the_table_of_contents_section["seg"] ~= + set_abstract_object.contents_para( + "toc", + toc_txt_, + "", // attrib + 0, + indent, + false + ); + toc_txt_ = format( + "{ %s }#%s", + "Glossary", + "glossary", // _anchor_tag + ); + the_table_of_contents_section["scroll"] ~= + set_abstract_object.contents_para( + "toc", + toc_txt_, + "", // attrib + 0, + indent, + false + ); +} +if (the_bibliography_section.length > 1){ + toc_txt_ = format( + "{ %s }../%s.fn_suffix", + "Bibliography", + "bibliography", // segment_object_belongs_to + ); + the_table_of_contents_section["seg"] ~= + set_abstract_object.contents_para( + "toc", + toc_txt_, + "", // attrib + 0, + indent, + false + ); + toc_txt_ = format( + "{ %s }#%s", + "Bibliography", + "bibliography", // _anchor_tag + ); + the_table_of_contents_section["scroll"] ~= + set_abstract_object.contents_para( + "toc", + toc_txt_, + "", // attrib + 0, + indent, + false + ); +} +if (the_bookindex_section["seg"].length > 1) { + toc_txt_ = format( + "{ %s }../%s.fn_suffix", + "Book Index", + "bookindex", // segment_object_belongs_to + ); + the_table_of_contents_section["seg"] ~= + set_abstract_object.contents_para( + "toc", + toc_txt_, + "", // attrib + 0, + indent, + false + ); +} +if (the_bookindex_section["scroll"].length > 1) { + toc_txt_ = format( + "{ %s }#%s", + "Book Index", + "bookindex", // _anchor_tag + ); + the_table_of_contents_section["scroll"] ~= + set_abstract_object.contents_para( + "toc", + toc_txt_, + "", // attrib + 0, + indent, + false + ); +} +if (the_blurb_section.length > 1) { + toc_txt_ = format( + "{ %s }../%s.fn_suffix", + "Blurb", + "blurb", // segment_object_belongs_to + ); + the_table_of_contents_section["seg"] ~= + set_abstract_object.contents_para( + "toc", + toc_txt_, + "", // attrib + 0, + indent, + false + ); + toc_txt_ = format( + "{ %s }#%s", + "Blurb", + "blurb", // _anchor_tag + ); + the_table_of_contents_section["scroll"] ~= + set_abstract_object.contents_para( + "toc", + toc_txt_, + "", // attrib + 0, + indent, + false + ); +} +debug(toc) { + writefln( + "%s %s", + __LINE__, + the_table_of_contents_section["seg"].length + ); + foreach (toc_linked_heading; the_table_of_contents_section["seg"]) { + writeln(toc_linked_heading.object); + } +} +#+END_SRC + *** [#B] the document :document: #+name: abs_post @@ -2918,7 +3079,7 @@ struct ObjInlineMarkup { string[string] obj_, string[string][string] dochead_make_aa, string segment_object_belongs_to, - int obj_cite_number, + string _anchor_tag, ObjComposite[][string] the_table_of_contents_section, ) in { } @@ -2933,7 +3094,7 @@ struct ObjInlineMarkup { toc_txt_ = format( "{ %s }#%s", heading_toc_, - obj_cite_number, + _anchor_tag, ); indent=[ "hang_position" : to!int(obj_["lev_markup_number"]), @@ -2942,7 +3103,7 @@ struct ObjInlineMarkup { toc_txt_ = format( "{ %s }#%s", heading_toc_, - obj_cite_number, + _anchor_tag, ); the_table_of_contents_section["scroll"] ~= set_abstract_object.contents_para( @@ -3028,7 +3189,7 @@ struct ObjInlineMarkup { "{ %s }../%s.fn_suffix#%s", heading_toc_, segment_object_belongs_to, - obj_cite_number, + _anchor_tag, ); indent=[ "hang_position" : to!int(obj_["lev_markup_number"]), diff --git a/src/sdp/ao_abstract_doc_source.d b/src/sdp/ao_abstract_doc_source.d index 1429a97..1677aed 100644 --- a/src/sdp/ao_abstract_doc_source.d +++ b/src/sdp/ao_abstract_doc_source.d @@ -153,6 +153,8 @@ template SiSUdocAbstraction() { "h_3": regex(r"^(none)"), "h_4": regex(r"^(none)") ]; + string _anchor_tag; + string toc_txt_; an_object["glossary_nugget"] = ""; an_object["blurb_nugget"] = ""; auto toc_head = @@ -527,7 +529,7 @@ template SiSUdocAbstraction() { an_object, dochead_make_aa, segment_object_belongs_to, - obj_cite_number, + _anchor_tag, the_table_of_contents_section, ); _node = @@ -652,16 +654,6 @@ template SiSUdocAbstraction() { +/ // TODO FIGURE OUT, you need this possibility // obj_im.obj_inline_markup_and_anchor_tags("doc_end_reset", an_object_key, "", dochead_make_aa); - debug(toc) { - writefln( - "%s %s", - __LINE__, - the_table_of_contents_section["seg"].length - ); - foreach (toc_linked_heading; the_table_of_contents_section["seg"]) { - writeln(toc_linked_heading.object); - } - } auto en_tuple = note_section.endnote_objects(obj_cite_number); static assert(!isTypeTuple!(en_tuple)); @@ -697,26 +689,6 @@ template SiSUdocAbstraction() { writeln(gloss.object); } } - if (an_object["blurb_nugget"].length == 0) { - writeln("no blurb"); - the_blurb_section ~= - set_abstract_object.contents_heading( - "(skip) there is no Blurb section", // nugget/object - "", // attrib - 0, // obj_cite_number - [""], // anchor tag - "B", // lev - 1, // lev_markup_number - 1, // lev_collapsed_number - ); - } else { - writeln("blurb"); - } - debug(blurb) { - foreach (blurb; the_blurb_section) { - writeln(blurb.object); - } - } auto biblio_unsorted_incomplete = biblio_arr_json.dup; // destroy(biblio_arr_json); auto biblio = Bibliography(); @@ -801,6 +773,195 @@ template SiSUdocAbstraction() { writeln(bi_entry); } } + if (an_object["blurb_nugget"].length == 0) { + writeln("no blurb"); + the_blurb_section ~= + set_abstract_object.contents_heading( + "(skip) there is no Blurb section", // nugget/object + "", // attrib + 0, // obj_cite_number + [""], // anchor tag + "B", // lev + 1, // lev_markup_number + 1, // lev_collapsed_number + ); + } else { + writeln("blurb"); + } + debug(blurb) { + foreach (blurb; the_blurb_section) { + writeln(blurb.object); + } + } + + indent=[ + "hang_position" : 1, + "base_position" : 1, + ]; + if (the_endnotes_section["seg"].length > 1) { + toc_txt_ = format( + "{ %s }../%s.fn_suffix", + "Endnotes", + "endnotes", // segment_object_belongs_to + ); + the_table_of_contents_section["seg"] ~= + set_abstract_object.contents_para( + "toc", + toc_txt_, + "", // attrib + 0, + indent, + false + ); + } + if (the_endnotes_section["scroll"].length > 1) { + toc_txt_ = format( + "{ %s }#%s", + "Endnotes", + "endnotes", // _anchor_tag + ); + the_table_of_contents_section["scroll"] ~= + set_abstract_object.contents_para( + "toc", + toc_txt_, + "", // attrib + 0, + indent, + false + ); + } + if (the_glossary_section.length > 1) { + toc_txt_ = format( + "{ %s }../%s.fn_suffixs", + "Glossary", + "glossary", // segment_object_belongs_to + ); + the_table_of_contents_section["seg"] ~= + set_abstract_object.contents_para( + "toc", + toc_txt_, + "", // attrib + 0, + indent, + false + ); + toc_txt_ = format( + "{ %s }#%s", + "Glossary", + "glossary", // _anchor_tag + ); + the_table_of_contents_section["scroll"] ~= + set_abstract_object.contents_para( + "toc", + toc_txt_, + "", // attrib + 0, + indent, + false + ); + } + if (the_bibliography_section.length > 1){ + toc_txt_ = format( + "{ %s }../%s.fn_suffix", + "Bibliography", + "bibliography", // segment_object_belongs_to + ); + the_table_of_contents_section["seg"] ~= + set_abstract_object.contents_para( + "toc", + toc_txt_, + "", // attrib + 0, + indent, + false + ); + toc_txt_ = format( + "{ %s }#%s", + "Bibliography", + "bibliography", // _anchor_tag + ); + the_table_of_contents_section["scroll"] ~= + set_abstract_object.contents_para( + "toc", + toc_txt_, + "", // attrib + 0, + indent, + false + ); + } + if (the_bookindex_section["seg"].length > 1) { + toc_txt_ = format( + "{ %s }../%s.fn_suffix", + "Book Index", + "bookindex", // segment_object_belongs_to + ); + the_table_of_contents_section["seg"] ~= + set_abstract_object.contents_para( + "toc", + toc_txt_, + "", // attrib + 0, + indent, + false + ); + } + if (the_bookindex_section["scroll"].length > 1) { + toc_txt_ = format( + "{ %s }#%s", + "Book Index", + "bookindex", // _anchor_tag + ); + the_table_of_contents_section["scroll"] ~= + set_abstract_object.contents_para( + "toc", + toc_txt_, + "", // attrib + 0, + indent, + false + ); + } + if (the_blurb_section.length > 1) { + toc_txt_ = format( + "{ %s }../%s.fn_suffix", + "Blurb", + "blurb", // segment_object_belongs_to + ); + the_table_of_contents_section["seg"] ~= + set_abstract_object.contents_para( + "toc", + toc_txt_, + "", // attrib + 0, + indent, + false + ); + toc_txt_ = format( + "{ %s }#%s", + "Blurb", + "blurb", // _anchor_tag + ); + the_table_of_contents_section["scroll"] ~= + set_abstract_object.contents_para( + "toc", + toc_txt_, + "", // attrib + 0, + indent, + false + ); + } + debug(toc) { + writefln( + "%s %s", + __LINE__, + the_table_of_contents_section["seg"].length + ); + foreach (toc_linked_heading; the_table_of_contents_section["seg"]) { + writeln(toc_linked_heading.object); + } + } the_document_head_section ~= the_document_body_section[0]; the_document_body_section=the_document_body_section[1..$]; auto document_the = [ @@ -2400,7 +2561,7 @@ template SiSUdocAbstraction() { string[string] obj_, string[string][string] dochead_make_aa, string segment_object_belongs_to, - int obj_cite_number, + string _anchor_tag, ObjComposite[][string] the_table_of_contents_section, ) in { } @@ -2415,7 +2576,7 @@ template SiSUdocAbstraction() { toc_txt_ = format( "{ %s }#%s", heading_toc_, - obj_cite_number, + _anchor_tag, ); indent=[ "hang_position" : to!int(obj_["lev_markup_number"]), @@ -2424,7 +2585,7 @@ template SiSUdocAbstraction() { toc_txt_ = format( "{ %s }#%s", heading_toc_, - obj_cite_number, + _anchor_tag, ); the_table_of_contents_section["scroll"] ~= set_abstract_object.contents_para( @@ -2510,7 +2671,7 @@ template SiSUdocAbstraction() { "{ %s }../%s.fn_suffix#%s", heading_toc_, segment_object_belongs_to, - obj_cite_number, + _anchor_tag, ); indent=[ "hang_position" : to!int(obj_["lev_markup_number"]), -- cgit v1.2.3