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 --- src/sdp/ao_abstract_doc_source.d | 231 +++++++++++++++++++++++++++++++++------ 1 file changed, 196 insertions(+), 35 deletions(-) (limited to 'src/sdp/ao_abstract_doc_source.d') 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