diff options
author | Ralph Amissah <ralph@amissah.com> | 2016-11-06 11:53:45 -0500 |
---|---|---|
committer | Ralph Amissah <ralph@amissah.com> | 2019-04-10 15:14:13 -0400 |
commit | 1f489efb19f023946638453b597c7226a429edd5 (patch) | |
tree | 629765657d012e1075ed4665aa4794daf2d6fce8 /org | |
parent | cleaning (one hash key renamed) (diff) |
empty sections?
Diffstat (limited to 'org')
-rw-r--r-- | org/ao_abstract_doc_source.org | 406 |
1 files changed, 233 insertions, 173 deletions
diff --git a/org/ao_abstract_doc_source.org b/org/ao_abstract_doc_source.org index 1578ce3..1e5ef1c 100644 --- a/org/ao_abstract_doc_source.org +++ b/org/ao_abstract_doc_source.org @@ -707,30 +707,6 @@ debug(endnotes) { #+name: abs_post #+BEGIN_SRC d -the_bibliography_section ~= - set_abstract_object.contents_heading( - "Bibliography", // nugget/object - "", // attrib - 0, // obj_cite_number - [""], // anchor tag - "B", // lev - 1, // lev_markup_number - 1, // lev_collapsed_number - ); -the_bibliography_section ~= - set_abstract_object.contents_heading( - "Bibliography", // nugget/object - "", // attrib - 0, // obj_cite_number - ["bibliography"], // anchor tag - "1", // lev - 4, // lev_markup_number - 2, // lev_collapsed_number - ); -#+END_SRC - -#+name: abs_post -#+BEGIN_SRC d auto biblio_unsorted_incomplete = biblio_arr_json.dup; // destroy(biblio_arr_json); auto biblio = Bibliography(); @@ -738,6 +714,43 @@ auto biblio_ordered = biblio._bibliography_(biblio_unsorted_incomplete, bib_arr_json); #+END_SRC +#+name: abs_post +#+BEGIN_SRC d +if (biblio_ordered.length > 0) { + the_bibliography_section ~= + set_abstract_object.contents_heading( + "Bibliography", // nugget/object + "", // attrib + 0, // obj_cite_number + [""], // anchor tag + "B", // lev + 1, // lev_markup_number + 1, // lev_collapsed_number + ); + the_bibliography_section ~= + set_abstract_object.contents_heading( + "Bibliography", // nugget/object + "", // attrib + 0, // obj_cite_number + ["bibliography"], // anchor tag + "1", // lev + 4, // lev_markup_number + 2, // lev_collapsed_number + ); +} else { + the_bibliography_section ~= + set_abstract_object.contents_heading( + "(skip) there is no Bibliography", // nugget/object + "", // attrib + 0, // obj_cite_number + [""], // anchor tag + "B", // lev + 1, // lev_markup_number + 1, // lev_collapsed_number + ); +} +#+END_SRC + ***** format biblio string #+name: abs_post @@ -3489,79 +3502,66 @@ struct BookIndexReportSection { auto set_abstract_object = ObjectAbstractSet(); auto mainkeys = bookindex_unordered_hashes.byKey.array.sort().release; - string bi_tmp_seg, bi_tmp_scroll; ObjComposite[][string] bookindex_section; - attrib=""; - lev="B"; - lev_markup_number=1; - lev_collapsed_number=1; - bookindex_section["scroll"] ~= - set_abstract_object.contents_heading( - "Book Index", - attrib, - obj_cite_number, - [], - to!string(lev), - to!int(lev_markup_number), - to!int(lev_collapsed_number) - ); - bookindex_section["seg"] ~= - set_abstract_object.contents_heading( - "Book Index", - attrib, - obj_cite_number, - [], - to!string(lev), - to!int(lev_markup_number), - to!int(lev_collapsed_number) - ); - ++obj_cite_number; - ++mkn; - attrib=""; - lev="1"; - lev_markup_number=4; - lev_collapsed_number=2; - bookindex_section["scroll"] ~= - set_abstract_object.contents_heading( - "Index", - attrib, - obj_cite_number, - ["book_index"], - to!string(lev), - to!int(lev_markup_number), - to!int(lev_collapsed_number) - ); - bookindex_section["seg"] ~= - set_abstract_object.contents_heading( - "Index", - attrib, - obj_cite_number, - ["book_index"], - to!string(lev), - to!int(lev_markup_number), - to!int(lev_collapsed_number) - ); - ++obj_cite_number; - ++mkn; - foreach (mainkey; mainkeys) { - bi_tmp_scroll = "!{" ~ mainkey ~ "}! "; - bi_tmp_seg = "!{" ~ mainkey ~ "}! "; - foreach (ref_; bookindex_unordered_hashes[mainkey]["_a"]) { - auto go = replaceAll(ref_, rgx.book_index_go, "$1"); - bi_tmp_scroll ~= (" {" ~ ref_ ~ "}#" ~ go ~ ", "); - bi_tmp_seg ~= (segment_object_belongs_to.empty) - ? (" {" ~ ref_ ~ "}#" ~ go ~ ", ") - : (" {" ~ ref_ ~ "}../" ~ segment_object_belongs_to ~ ".fn_suffix#" ~ go ~ ", "); - } - bi_tmp_scroll ~= " \\\\\n "; - bi_tmp_seg ~= " \\\\\n "; - bookindex_unordered_hashes[mainkey].remove("_a"); - auto subkeys = - bookindex_unordered_hashes[mainkey].byKey.array.sort().release; - foreach (subkey; subkeys) { - bi_tmp_scroll ~= subkey ~ ", "; - bi_tmp_seg ~= subkey ~ ", "; - foreach (ref_; bookindex_unordered_hashes[mainkey][subkey]) { + if (mainkeys.length > 0) { + string bi_tmp_seg, bi_tmp_scroll; + attrib=""; + lev="B"; + lev_markup_number=1; + lev_collapsed_number=1; + bookindex_section["scroll"] ~= + set_abstract_object.contents_heading( + "Book Index", + attrib, + obj_cite_number, + [], + to!string(lev), + lev_markup_number, + lev_collapsed_number + ); + bookindex_section["seg"] ~= + set_abstract_object.contents_heading( + "Book Index", + attrib, + obj_cite_number, + [], + to!string(lev), + lev_markup_number, + lev_collapsed_number + ); + ++obj_cite_number; + ++mkn; + // 1~ Index + attrib=""; + lev="1"; + lev_markup_number=4; + lev_collapsed_number=2; + bookindex_section["scroll"] ~= + set_abstract_object.contents_heading( + "Index", + attrib, + obj_cite_number, + ["book_index"], + to!string(lev), + lev_markup_number, + lev_collapsed_number + ); + bookindex_section["seg"] ~= + set_abstract_object.contents_heading( + "Index", + attrib, + obj_cite_number, + ["book_index"], + to!string(lev), + lev_markup_number, + lev_collapsed_number + ); + ++obj_cite_number; + ++mkn; + foreach (mainkey; mainkeys) { + bi_tmp_scroll = "!{" ~ mainkey ~ "}! "; + bi_tmp_seg = "!{" ~ mainkey ~ "}! "; + foreach (ref_; bookindex_unordered_hashes[mainkey]["_a"]) { auto go = replaceAll(ref_, rgx.book_index_go, "$1"); bi_tmp_scroll ~= (" {" ~ ref_ ~ "}#" ~ go ~ ", "); bi_tmp_seg ~= (segment_object_belongs_to.empty) @@ -3570,36 +3570,73 @@ struct BookIndexReportSection { } bi_tmp_scroll ~= " \\\\\n "; bi_tmp_seg ~= " \\\\\n "; - ++skn; + bookindex_unordered_hashes[mainkey].remove("_a"); + auto subkeys = + bookindex_unordered_hashes[mainkey].byKey.array.sort().release; + foreach (subkey; subkeys) { + bi_tmp_scroll ~= subkey ~ ", "; + bi_tmp_seg ~= subkey ~ ", "; + foreach (ref_; bookindex_unordered_hashes[mainkey][subkey]) { + auto go = replaceAll(ref_, rgx.book_index_go, "$1"); + bi_tmp_scroll ~= (" {" ~ ref_ ~ "}#" ~ go ~ ", "); + bi_tmp_seg ~= (segment_object_belongs_to.empty) + ? (" {" ~ ref_ ~ "}#" ~ go ~ ", ") + : (" {" ~ ref_ ~ "}../" ~ segment_object_belongs_to ~ ".fn_suffix#" ~ go ~ ", "); + } + bi_tmp_scroll ~= " \\\\\n "; + bi_tmp_seg ~= " \\\\\n "; + ++skn; + } + bi_tmp_scroll = replaceFirst(bi_tmp_scroll, rgx.trailing_linebreak, ""); + bi_tmp_seg = replaceFirst(bi_tmp_seg, rgx.trailing_linebreak, ""); + type="para"; + attrib=""; + indent=[ + "hang_position" : "0", + "base_position" : "1", + ]; + bookindex_section["scroll"] ~= + set_abstract_object.contents_para( + type, + bi_tmp_scroll, + attrib, + obj_cite_number, + indent, + false + ); + bookindex_section["seg"] ~= + set_abstract_object.contents_para( + type, + bi_tmp_seg, + attrib, + obj_cite_number, + indent, + false + ); + ++obj_cite_number; + ++mkn; } - bi_tmp_scroll = replaceFirst(bi_tmp_scroll, rgx.trailing_linebreak, ""); - bi_tmp_seg = replaceFirst(bi_tmp_seg, rgx.trailing_linebreak, ""); - type="para"; - attrib=""; - indent=[ - "hang_position" : "0", - "base_position" : "1", - ]; + } else { // no book index, (figure out what to do here) bookindex_section["scroll"] ~= - set_abstract_object.contents_para( - type, - bi_tmp_scroll, - attrib, - obj_cite_number, - indent, - false + set_abstract_object.contents_heading( + "(skip) there is no Book Index", + "", // attrib, + 0, + [""], + "B", + 1, + 1 ); bookindex_section["seg"] ~= - set_abstract_object.contents_para( - type, - bi_tmp_seg, - attrib, - obj_cite_number, - indent, - false + set_abstract_object.contents_heading( + "(skip) there is no Book Index", + "", // attrib, + 0, + [""], + "B", + 1, + 1 ); - ++obj_cite_number; - ++mkn; } auto t = tuple(bookindex_section, obj_cite_number); return t; @@ -3707,58 +3744,81 @@ struct NotesSection { string lev, lev_markup_number, lev_collapsed_number; string attrib; string[string] indent; - attrib=""; - lev="B"; - lev_markup_number="1"; - lev_collapsed_number="1"; - the_endnotes_section["seg"] ~= - set_abstract_object.contents_heading( - "Endnotes", - attrib, - obj_cite_number, - [], - to!string(lev), - to!int(lev_markup_number), - to!int(lev_collapsed_number) - ); - the_endnotes_section["scroll"] ~= - set_abstract_object.contents_heading( - "Endnotes", - attrib, - obj_cite_number, - [], - to!string(lev), - to!int(lev_markup_number), - to!int(lev_collapsed_number) - ); - ++obj_cite_number; - ++mkn; - attrib=""; - lev="1"; - lev_markup_number="4"; - lev_collapsed_number="2"; - the_endnotes_section["seg"] ~= - set_abstract_object.contents_heading( - "Endnotes", - attrib, - obj_cite_number, - ["endnotes"], - to!string(lev), - to!int(lev_markup_number), - to!int(lev_collapsed_number) - ); - the_endnotes_section["scroll"] ~= - set_abstract_object.contents_heading( - "Endnotes", - attrib, - obj_cite_number, - ["endnotes"], - to!string(lev), - to!int(lev_markup_number), - to!int(lev_collapsed_number) - ); - ++obj_cite_number; - ++mkn; + if (endnotes_["seg"].length > 0) { + attrib=""; + lev="B"; + lev_markup_number="1"; + lev_collapsed_number="1"; + the_endnotes_section["seg"] ~= + set_abstract_object.contents_heading( + "Endnotes", + attrib, + obj_cite_number, + [], + to!string(lev), + to!int(lev_markup_number), + to!int(lev_collapsed_number) + ); + the_endnotes_section["scroll"] ~= + set_abstract_object.contents_heading( + "Endnotes", + attrib, + obj_cite_number, + [], + to!string(lev), + to!int(lev_markup_number), + to!int(lev_collapsed_number) + ); + ++obj_cite_number; + ++mkn; + attrib=""; + lev="1"; + lev_markup_number="4"; + lev_collapsed_number="2"; + the_endnotes_section["seg"] ~= + set_abstract_object.contents_heading( + "Endnotes", + attrib, + obj_cite_number, + ["endnotes"], + to!string(lev), + to!int(lev_markup_number), + to!int(lev_collapsed_number) + ); + the_endnotes_section["scroll"] ~= + set_abstract_object.contents_heading( + "Endnotes", + attrib, + obj_cite_number, + ["endnotes"], + to!string(lev), + to!int(lev_markup_number), + to!int(lev_collapsed_number) + ); + ++obj_cite_number; + ++mkn; + } else { + the_endnotes_section["seg"] ~= + set_abstract_object.contents_heading( + "(skip) there are no Endnotes", + "", // attrib, + 0, + [""], + "B", + 1, + 1 + ); + the_endnotes_section["scroll"] ~= + set_abstract_object.contents_heading( + "(skip) there are no Endnotes", + "", // attrib, + 0, + [""], + "B", + 1, + 1 + ); + } foreach (endnote; endnotes_["seg"]) { attrib=""; the_endnotes_section["seg"] ~= |