aboutsummaryrefslogtreecommitdiffhomepage
path: root/src
diff options
context:
space:
mode:
authorRalph Amissah <ralph@amissah.com>2016-11-06 11:53:45 -0500
committerRalph Amissah <ralph@amissah.com>2019-04-10 15:14:13 -0400
commit1f489efb19f023946638453b597c7226a429edd5 (patch)
tree629765657d012e1075ed4665aa4794daf2d6fce8 /src
parentcleaning (one hash key renamed) (diff)
empty sections?
Diffstat (limited to 'src')
-rw-r--r--src/sdp/ao_abstract_doc_source.d398
1 files changed, 229 insertions, 169 deletions
diff --git a/src/sdp/ao_abstract_doc_source.d b/src/sdp/ao_abstract_doc_source.d
index 2848eb9..769d93c 100644
--- a/src/sdp/ao_abstract_doc_source.d
+++ b/src/sdp/ao_abstract_doc_source.d
@@ -522,31 +522,44 @@ template SiSUdocAbstraction() {
writeln(o);
}
}
- 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
- );
auto biblio_unsorted_incomplete = biblio_arr_json.dup;
// destroy(biblio_arr_json);
auto biblio = Bibliography();
auto biblio_ordered =
biblio._bibliography_(biblio_unsorted_incomplete, bib_arr_json);
+ 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
+ );
+ }
string out_;
foreach (entry; biblio_ordered) {
out_ = format(
@@ -2849,79 +2862,66 @@ template SiSUdocAbstraction() {
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)
@@ -2930,36 +2930,73 @@ template SiSUdocAbstraction() {
}
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;
@@ -3037,58 +3074,81 @@ template SiSUdocAbstraction() {
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"] ~=