aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/sdp/ao_abstract_doc_source.d
diff options
context:
space:
mode:
Diffstat (limited to 'src/sdp/ao_abstract_doc_source.d')
-rw-r--r--src/sdp/ao_abstract_doc_source.d591
1 files changed, 328 insertions, 263 deletions
diff --git a/src/sdp/ao_abstract_doc_source.d b/src/sdp/ao_abstract_doc_source.d
index c11ee4a..ec1536e 100644
--- a/src/sdp/ao_abstract_doc_source.d
+++ b/src/sdp/ao_abstract_doc_source.d
@@ -23,7 +23,9 @@ template SiSUdocAbstraction() {
string[string] an_object, processing;
string an_object_key;
string[] anchor_tags;
+ string anchor_tag_;
string segment_anchor_tag_that_object_belongs_to;
+ string segment_anchor_tag_that_object_belongs_to_uri;
auto note_section = NotesSection();
/+ enum +/
enum State { off, on }
@@ -68,6 +70,58 @@ template SiSUdocAbstraction() {
int[] dom_collapsed = [ 0, 0, 0, 0, 0, 0, 0, 0, 0,];
int[] dom_collapsed_buffer = [ 0, 0, 0, 0, 0, 0, 0, 0, 0,];
enum DomTags { none, open, close, close_and_open, open_still, }
+ void heading_ancestors(O)(
+ auto ref O obj,
+ ref string[] lv_ancestors,
+ ) {
+ switch (obj.heading_lev_markup) {
+ case 0:
+ lv_ancestors[0] = to!string(obj.text);
+ foreach(k; 1..8) { // 1 .. 7 ?
+ lv_ancestors[k] = "";
+ }
+ goto default;
+ case 1:
+ lv_ancestors[1] = to!string(obj.text);
+ foreach(k; 2..8) {
+ lv_ancestors[k] = "";
+ }
+ goto default;
+ case 2:
+ lv_ancestors[2] = to!string(obj.text);
+ foreach(k; 3..8) {
+ lv_ancestors[k] = "";
+ }
+ goto default;
+ case 3:
+ lv_ancestors[3] = to!string(obj.text);
+ foreach(k; 4..8) {
+ lv_ancestors[k] = "";
+ }
+ goto default;
+ case 4:
+ lv_ancestors[4] = to!string(obj.text);
+ foreach(k; 5..8) {
+ lv_ancestors[k] = "";
+ }
+ goto default;
+ case 5:
+ lv_ancestors[5] = to!string(obj.text);
+ foreach(k; 6..8) {
+ lv_ancestors[k] = "";
+ }
+ goto default;
+ case 6:
+ lv_ancestors[6] = to!string(obj.text);
+ lv_ancestors[7] = "";
+ goto default;
+ case 7:
+ lv_ancestors[7] = to!string(obj.text);
+ goto default;
+ default:
+ obj.heading_ancestors_text = lv_ancestors.dup;
+ }
+ }
auto dom_set_markup_tags(int[] dom, int lev) {
foreach (i; 0 .. 8) {
if (i < lev) {
@@ -197,6 +251,7 @@ template SiSUdocAbstraction() {
"start" : "",
"end" : ""
];
+ string[] lv_ancestors = [ "", "", "", "", "", "", "", "", ];
int[string] lv = [
"lv" : State.off,
"h0" : State.off,
@@ -654,9 +709,16 @@ template SiSUdocAbstraction() {
anchor_tags = substantive_object_and_anchor_tags_tuple[1];
if (to!int(an_object["lev_markup_number"]) == 4) {
segment_anchor_tag_that_object_belongs_to = anchor_tags[0];
+ segment_anchor_tag_that_object_belongs_to_uri = anchor_tags[0] ~ ".fnSuffix";
+ anchor_tag_ = anchor_tags[0];
+ } else if (to!int(an_object["lev_markup_number"]) > 4) {
+ segment_anchor_tag_that_object_belongs_to = anchor_tag_;
+ segment_anchor_tag_that_object_belongs_to_uri = anchor_tag_ ~ ".fnSuffix#" ~ to!string(obj_cite_number);
} else if (to!int(an_object["lev_markup_number"]) < 4) {
segment_anchor_tag_that_object_belongs_to = "";
+ segment_anchor_tag_that_object_belongs_to_uri = "";
}
+ /+ (incrementally build toc) table of contents here! +/
_anchor_tag=to!string(obj_cite_number);
the_table_of_contents_section = obj_im.table_of_contents_gather_headings(
an_object,
@@ -681,6 +743,7 @@ template SiSUdocAbstraction() {
obj_cite_number, // int
cntr, // int
heading_ptr, // int
+ lv_ancestors, // string[]
an_object["is"], // string
html_segnames_ptr, // int
);
@@ -801,9 +864,9 @@ template SiSUdocAbstraction() {
writefln(
"%s %s",
__LINE__,
- the_endnotes_section["seg"].length
+ the_endnotes_section.length
);
- foreach (o; the_endnotes_section["seg"]) {
+ foreach (o; the_endnotes_section) {
writeln(o);
}
}
@@ -965,9 +1028,9 @@ template SiSUdocAbstraction() {
comp_obj_toc.indent_hang = indent["hang_position"];
comp_obj_toc.indent_base = indent["base_position"];
comp_obj_toc.bullet = false;
- if (the_endnotes_section["seg"].length > 1) {
+ if (the_endnotes_section.length > 1) {
toc_txt_ = format(
- "{ %s }../%s.fn_suffix",
+ "{ %s }../%s.fnSuffix",
"Endnotes",
"endnotes", // segment_anchor_tag_that_object_belongs_to
);
@@ -975,19 +1038,9 @@ template SiSUdocAbstraction() {
comp_obj_toc.text = to!string(toc_txt_).strip;
the_table_of_contents_section["seg"] ~= comp_obj_toc;
}
- if (the_endnotes_section["scroll"].length > 1) {
- toc_txt_ = format(
- "{ %s }#%s",
- "Endnotes",
- "endnotes", // _anchor_tag
- );
- toc_txt_= munge.url_links(toc_txt_);
- comp_obj_toc.text = to!string(toc_txt_).strip;
- the_table_of_contents_section["scroll"] ~= comp_obj_toc;
- }
if (the_glossary_section.length > 1) {
toc_txt_ = format(
- "{ %s }../%s.fn_suffixs",
+ "{ %s }../%s.fnSuffixs",
"Glossary",
"glossary", // segment_anchor_tag_that_object_belongs_to
);
@@ -1005,7 +1058,7 @@ template SiSUdocAbstraction() {
}
if (the_bibliography_section.length > 1){
toc_txt_ = format(
- "{ %s }../%s.fn_suffix",
+ "{ %s }../%s.fnSuffix",
"Bibliography",
"bibliography", // segment_anchor_tag_that_object_belongs_to
);
@@ -1024,7 +1077,7 @@ template SiSUdocAbstraction() {
}
if (the_bookindex_section["seg"].length > 1) {
toc_txt_ = format(
- "{ %s }../%s.fn_suffix",
+ "{ %s }../%s.fnSuffix",
"Book Index",
"bookindex", // segment_anchor_tag_that_object_belongs_to
);
@@ -1044,7 +1097,7 @@ template SiSUdocAbstraction() {
}
if (the_blurb_section.length > 1) {
toc_txt_ = format(
- "{ %s }../%s.fn_suffix",
+ "{ %s }../%s.fnSuffix",
"Blurb",
"blurb", // segment_anchor_tag_that_object_belongs_to
);
@@ -1070,18 +1123,22 @@ template SiSUdocAbstraction() {
writeln(mkup.indent_by_spaces_provided(toc_linked_heading.indent_hang), toc_linked_heading.text);
}
}
+ debug(tocscroll) {
+ writefln(
+ "%s %s",
+ __LINE__,
+ the_table_of_contents_section["seg"].length
+ );
+ foreach (toc_linked_heading; the_table_of_contents_section["scroll"]) {
+ writeln(mkup.indent_by_spaces_provided(toc_linked_heading.indent_hang), toc_linked_heading.text);
+ }
+ }
the_document_head_section ~= the_document_body_section[0];
the_document_body_section=the_document_body_section[1..$];
- if (the_endnotes_section["scroll"].length > 1) {
+ if (the_endnotes_section.length > 1) {
html_segnames ~= "endnotes";
html_segnames_ptr = html_segnames_ptr_cntr;
- foreach (ref section; the_endnotes_section["scroll"]) {
- if (section.heading_lev_markup == 4) {
- section.ptr_html_segnames = html_segnames_ptr;
- break;
- }
- }
- foreach (ref section; the_endnotes_section["seg"]) {
+ foreach (ref section; the_endnotes_section) {
if (section.heading_lev_markup == 4) {
section.ptr_html_segnames = html_segnames_ptr;
break;
@@ -1139,227 +1196,251 @@ template SiSUdocAbstraction() {
}
html_segnames_ptr_cntr++;
}
- if ((opt_action_bool["html"])
- || (opt_action_bool["html_scroll"])
- || (opt_action_bool["html_seg"])
- || (opt_action_bool["epub"])) {
- foreach (ref obj; the_document_head_section) {
+ foreach (ref obj; the_document_head_section) {
+ if (obj.is_a == "heading") {
+ debug(dom) {
+ writeln(obj.text);
+ }
+ if ((opt_action_bool["html"])
+ || (opt_action_bool["html_scroll"])
+ || (opt_action_bool["html_seg"])
+ || (opt_action_bool["epub"])) {
+ obj.dom_markedup = dom_set_markup_tags(dom_markedup, obj.heading_lev_markup).dup;
+ obj.dom_collapsed = dom_set_collapsed_tags(dom_collapsed, obj.heading_lev_collapsed).dup;
+ }
+ heading_ancestors(obj, lv_ancestors);
+ }
+ }
+ if (the_table_of_contents_section["scroll"].length > 1) {
+ dom_markedup_buffer = dom_markedup.dup;
+ dom_collapsed_buffer = dom_collapsed.dup;
+ foreach (ref obj; the_table_of_contents_section["scroll"]) {
if (obj.is_a == "heading") {
debug(dom) {
- writeln(obj.text);
+ // writeln(obj.text);
+ }
+ if (obj.heading_lev_markup == 4) {
+ obj.segname_next = html_segnames[obj.ptr_html_segnames + 1];
+ assert(obj.segment_anchor_tag == html_segnames[obj.ptr_html_segnames]);
}
- dom_markedup = dom_set_markup_tags(dom_markedup, obj.heading_lev_markup);
- obj.dom_markedup = dom_markedup.dup;
- dom_collapsed = dom_set_collapsed_tags(dom_collapsed, obj.heading_lev_collapsed);
- obj.dom_collapsed = dom_collapsed.dup;
+ if ((opt_action_bool["html"])
+ || (opt_action_bool["html_scroll"])
+ || (opt_action_bool["html_seg"])
+ || (opt_action_bool["epub"])) {
+ obj.dom_markedup = dom_set_markup_tags(dom_markedup, obj.heading_lev_markup).dup;
+ obj.dom_collapsed = dom_set_collapsed_tags(dom_collapsed, obj.heading_lev_collapsed).dup;
+ }
+ heading_ancestors(obj, lv_ancestors);
}
}
- if (the_table_of_contents_section["scroll"].length > 1) {
- dom_markedup_buffer = dom_markedup.dup;
- dom_collapsed_buffer = dom_collapsed.dup;
- foreach (ref obj; the_table_of_contents_section["scroll"]) {
- if (obj.is_a == "heading") {
- debug(dom) {
- // writeln(obj.text);
- }
- if (obj.heading_lev_markup == 4) {
- obj.segname_next = html_segnames[obj.ptr_html_segnames + 1];
- assert(obj.segment_anchor_tag == html_segnames[obj.ptr_html_segnames]);
- }
- dom_markedup = dom_set_markup_tags(dom_markedup, obj.heading_lev_markup);
- obj.dom_markedup = dom_markedup.dup;
- dom_collapsed = dom_set_collapsed_tags(dom_collapsed, obj.heading_lev_collapsed);
- obj.dom_collapsed = dom_collapsed.dup;
+ dom_markedup = dom_markedup_buffer.dup;
+ dom_collapsed = dom_collapsed_buffer.dup;
+ foreach (ref obj; the_table_of_contents_section["seg"]) {
+ if (obj.is_a == "heading") {
+ debug(dom) {
+ writeln(obj.text);
+ }
+ if (obj.heading_lev_markup == 4) {
+ obj.segname_next = html_segnames[obj.ptr_html_segnames + 1];
+ assert(obj.segment_anchor_tag == html_segnames[obj.ptr_html_segnames]);
}
+ if ((opt_action_bool["html"])
+ || (opt_action_bool["html_scroll"])
+ || (opt_action_bool["html_seg"])
+ || (opt_action_bool["epub"])) {
+ obj.dom_markedup = dom_set_markup_tags(dom_markedup, obj.heading_lev_markup).dup;
+ obj.dom_collapsed = dom_set_collapsed_tags(dom_collapsed, obj.heading_lev_collapsed).dup;
+ }
+ heading_ancestors(obj, lv_ancestors);
}
- dom_markedup = dom_markedup_buffer.dup;
- dom_collapsed = dom_collapsed_buffer.dup;
- foreach (ref obj; the_table_of_contents_section["seg"]) {
- if (obj.is_a == "heading") {
- debug(dom) {
- writeln(obj.text);
- }
- if (obj.heading_lev_markup == 4) {
+ }
+ }
+ /+ multiple 1~ levels, loop through document body +/
+ if (the_document_body_section.length > 1) {
+ foreach (ref obj; the_document_body_section) {
+ if (obj.is_a == "heading") {
+ debug(dom) {
+ writeln(obj.text);
+ }
+ if (obj.heading_lev_markup == 4) {
+ obj.lev4_subtoc = lev4_subtoc[obj.segment_anchor_tag];
+ obj.segname_prev = html_segnames[obj.ptr_html_segnames - 1];
+ if (html_segnames.length > obj.ptr_html_segnames + 1) {
obj.segname_next = html_segnames[obj.ptr_html_segnames + 1];
- assert(obj.segment_anchor_tag == html_segnames[obj.ptr_html_segnames]);
}
- dom_markedup = dom_set_markup_tags(dom_markedup, obj.heading_lev_markup);
- obj.dom_markedup = dom_markedup.dup;
- dom_collapsed = dom_set_collapsed_tags(dom_collapsed, obj.heading_lev_collapsed);
- obj.dom_collapsed = dom_collapsed.dup;
+ assert(obj.segment_anchor_tag == html_segnames[obj.ptr_html_segnames]);
}
+ if ((opt_action_bool["html"])
+ || (opt_action_bool["html_scroll"])
+ || (opt_action_bool["html_seg"])
+ || (opt_action_bool["epub"])) {
+ obj.dom_markedup = dom_set_markup_tags(dom_markedup, obj.heading_lev_markup).dup;
+ obj.dom_collapsed = dom_set_collapsed_tags(dom_collapsed, obj.heading_lev_collapsed).dup;
+ }
+ heading_ancestors(obj, lv_ancestors);
}
}
- /+ multiple 1~ levels, loop through document body +/
- if (the_document_body_section.length > 1) {
- foreach (ref obj; the_document_body_section) {
- if (obj.is_a == "heading") {
- debug(dom) {
- writeln(obj.text);
- }
- if (obj.heading_lev_markup == 4) {
- obj.lev4_subtoc = lev4_subtoc[obj.segment_anchor_tag];
- obj.segname_prev = html_segnames[obj.ptr_html_segnames - 1];
- if (html_segnames.length > obj.ptr_html_segnames + 1) {
- obj.segname_next = html_segnames[obj.ptr_html_segnames + 1];
- }
- assert(obj.segment_anchor_tag == html_segnames[obj.ptr_html_segnames]);
+ }
+ /+ optional only one 1~ level +/
+ if (the_endnotes_section.length > 1) {
+ dom_markedup_buffer = dom_markedup.dup;
+ dom_collapsed_buffer = dom_collapsed.dup;
+ dom_markedup = dom_markedup_buffer.dup;
+ dom_collapsed = dom_collapsed_buffer.dup;
+ foreach (ref obj; the_endnotes_section) {
+ if (obj.is_a == "heading") {
+ debug(dom) {
+ writeln(obj.text);
+ }
+ if (obj.heading_lev_markup == 4) {
+ obj.segname_prev = html_segnames[obj.ptr_html_segnames - 1];
+ if (html_segnames.length > obj.ptr_html_segnames + 1) {
+ obj.segname_next = html_segnames[obj.ptr_html_segnames + 1];
}
- dom_markedup = dom_set_markup_tags(dom_markedup, obj.heading_lev_markup);
- obj.dom_markedup = dom_markedup.dup;
- dom_collapsed = dom_set_collapsed_tags(dom_collapsed, obj.heading_lev_collapsed);
- obj.dom_collapsed = dom_collapsed.dup;
+ assert(obj.segment_anchor_tag == html_segnames[obj.ptr_html_segnames]);
}
+ if ((opt_action_bool["html"])
+ || (opt_action_bool["html_scroll"])
+ || (opt_action_bool["html_seg"])
+ || (opt_action_bool["epub"])) {
+ obj.dom_markedup = dom_set_markup_tags(dom_markedup, obj.heading_lev_markup).dup;
+ obj.dom_collapsed = dom_set_collapsed_tags(dom_collapsed, obj.heading_lev_collapsed).dup;
+ }
+ heading_ancestors(obj, lv_ancestors);
}
}
- /+ optional only one 1~ level +/
- if (the_endnotes_section["scroll"].length > 1) {
- dom_markedup_buffer = dom_markedup.dup;
- dom_collapsed_buffer = dom_collapsed.dup;
- foreach (ref obj; the_endnotes_section["scroll"]) {
- if (obj.is_a == "heading") {
- debug(dom) {
- }
- if (obj.heading_lev_markup == 4) {
- obj.segname_prev = html_segnames[obj.ptr_html_segnames - 1];
- if (html_segnames.length > obj.ptr_html_segnames + 1) {
- obj.segname_next = html_segnames[obj.ptr_html_segnames + 1];
- }
- assert(obj.segment_anchor_tag == html_segnames[obj.ptr_html_segnames]);
- }
- dom_markedup = dom_set_markup_tags(dom_markedup, obj.heading_lev_markup);
- obj.dom_markedup = dom_markedup.dup;
- dom_collapsed = dom_set_collapsed_tags(dom_collapsed, obj.heading_lev_collapsed);
- obj.dom_collapsed = dom_collapsed.dup;
+ }
+ /+ optional only one 1~ level +/
+ if (the_glossary_section.length > 1) {
+ foreach (ref obj; the_glossary_section) {
+ if (obj.is_a == "heading") {
+ debug(dom) {
+ writeln(obj.text);
}
- }
- dom_markedup = dom_markedup_buffer.dup;
- dom_collapsed = dom_collapsed_buffer.dup;
- foreach (ref obj; the_endnotes_section["seg"]) {
- if (obj.is_a == "heading") {
- debug(dom) {
- writeln(obj.text);
- }
- if (obj.heading_lev_markup == 4) {
- obj.segname_prev = html_segnames[obj.ptr_html_segnames - 1];
- if (html_segnames.length > obj.ptr_html_segnames + 1) {
- obj.segname_next = html_segnames[obj.ptr_html_segnames + 1];
- }
- assert(obj.segment_anchor_tag == html_segnames[obj.ptr_html_segnames]);
+ if (obj.heading_lev_markup == 4) {
+ obj.segname_prev = html_segnames[obj.ptr_html_segnames - 1];
+ if (html_segnames.length > obj.ptr_html_segnames + 1) {
+ obj.segname_next = html_segnames[obj.ptr_html_segnames + 1];
}
- dom_markedup = dom_set_markup_tags(dom_markedup, obj.heading_lev_markup);
- obj.dom_markedup = dom_markedup.dup;
- dom_collapsed = dom_set_collapsed_tags(dom_collapsed, obj.heading_lev_collapsed);
- obj.dom_collapsed = dom_collapsed.dup;
+ assert(obj.segment_anchor_tag == html_segnames[obj.ptr_html_segnames]);
+ }
+ if ((opt_action_bool["html"])
+ || (opt_action_bool["html_scroll"])
+ || (opt_action_bool["html_seg"])
+ || (opt_action_bool["epub"])) {
+ obj.dom_markedup = dom_set_markup_tags(dom_markedup, obj.heading_lev_markup).dup;
+ obj.dom_collapsed = dom_set_collapsed_tags(dom_collapsed, obj.heading_lev_collapsed).dup;
}
+ heading_ancestors(obj, lv_ancestors);
}
}
- /+ optional only one 1~ level +/
- if (the_glossary_section.length > 1) {
- foreach (ref obj; the_glossary_section) {
- if (obj.is_a == "heading") {
- debug(dom) {
- writeln(obj.text);
- }
- if (obj.heading_lev_markup == 4) {
- obj.segname_prev = html_segnames[obj.ptr_html_segnames - 1];
- if (html_segnames.length > obj.ptr_html_segnames + 1) {
- obj.segname_next = html_segnames[obj.ptr_html_segnames + 1];
- }
- assert(obj.segment_anchor_tag == html_segnames[obj.ptr_html_segnames]);
+ }
+ /+ optional only one 1~ level +/
+ if (the_bibliography_section.length > 1) {
+ foreach (ref obj; the_bibliography_section) {
+ if (obj.is_a == "heading") {
+ debug(dom) {
+ writeln(obj.text);
+ }
+ if (obj.heading_lev_markup == 4) {
+ obj.segname_prev = html_segnames[obj.ptr_html_segnames - 1];
+ if (html_segnames.length > obj.ptr_html_segnames + 1) {
+ obj.segname_next = html_segnames[obj.ptr_html_segnames + 1];
}
- dom_markedup = dom_set_markup_tags(dom_markedup, obj.heading_lev_markup);
- obj.dom_markedup = dom_markedup.dup;
- dom_collapsed = dom_set_collapsed_tags(dom_collapsed, obj.heading_lev_collapsed);
- obj.dom_collapsed = dom_collapsed.dup;
+ assert(obj.segment_anchor_tag == html_segnames[obj.ptr_html_segnames]);
+ }
+ if ((opt_action_bool["html"])
+ || (opt_action_bool["html_scroll"])
+ || (opt_action_bool["html_seg"])
+ || (opt_action_bool["epub"])) {
+ obj.dom_markedup = dom_set_markup_tags(dom_markedup, obj.heading_lev_markup).dup;
+ obj.dom_collapsed = dom_set_collapsed_tags(dom_collapsed, obj.heading_lev_collapsed).dup;
}
+ heading_ancestors(obj, lv_ancestors);
}
}
- /+ optional only one 1~ level +/
- if (the_bibliography_section.length > 1) {
- foreach (ref obj; the_bibliography_section) {
- if (obj.is_a == "heading") {
- debug(dom) {
- writeln(obj.text);
- }
- if (obj.heading_lev_markup == 4) {
- obj.segname_prev = html_segnames[obj.ptr_html_segnames - 1];
- if (html_segnames.length > obj.ptr_html_segnames + 1) {
- obj.segname_next = html_segnames[obj.ptr_html_segnames + 1];
- }
- assert(obj.segment_anchor_tag == html_segnames[obj.ptr_html_segnames]);
+ }
+ /+ optional only one 1~ level +/
+ if (the_bookindex_section["scroll"].length > 1) {
+ dom_markedup_buffer = dom_markedup.dup;
+ dom_collapsed_buffer = dom_collapsed.dup;
+ foreach (ref obj; the_bookindex_section["scroll"]) {
+ if (obj.is_a == "heading") {
+ debug(dom) {
+ // writeln(obj.text);
+ }
+ if (obj.heading_lev_markup == 4) {
+ obj.segname_prev = html_segnames[obj.ptr_html_segnames - 1];
+ if (html_segnames.length > obj.ptr_html_segnames + 1) {
+ obj.segname_next = html_segnames[obj.ptr_html_segnames + 1];
}
- dom_markedup = dom_set_markup_tags(dom_markedup, obj.heading_lev_markup);
- obj.dom_markedup = dom_markedup.dup;
- dom_collapsed = dom_set_collapsed_tags(dom_collapsed, obj.heading_lev_collapsed);
- obj.dom_collapsed = dom_collapsed.dup;
+ assert(obj.segment_anchor_tag == html_segnames[obj.ptr_html_segnames]);
+ }
+ if ((opt_action_bool["html"])
+ || (opt_action_bool["html_scroll"])
+ || (opt_action_bool["html_seg"])
+ || (opt_action_bool["epub"])) {
+ obj.dom_markedup = dom_set_markup_tags(dom_markedup, obj.heading_lev_markup).dup;
+ obj.dom_collapsed = dom_set_collapsed_tags(dom_collapsed, obj.heading_lev_collapsed).dup;
}
+ heading_ancestors(obj, lv_ancestors);
}
}
- /+ optional only one 1~ level +/
- if (the_bookindex_section["scroll"].length > 1) {
- dom_markedup_buffer = dom_markedup.dup;
- dom_collapsed_buffer = dom_collapsed.dup;
- foreach (ref obj; the_bookindex_section["scroll"]) {
- if (obj.is_a == "heading") {
- debug(dom) {
- // writeln(obj.text);
- }
- if (obj.heading_lev_markup == 4) {
- obj.segname_prev = html_segnames[obj.ptr_html_segnames - 1];
- if (html_segnames.length > obj.ptr_html_segnames + 1) {
- obj.segname_next = html_segnames[obj.ptr_html_segnames + 1];
- }
- assert(obj.segment_anchor_tag == html_segnames[obj.ptr_html_segnames]);
- }
- dom_markedup = dom_set_markup_tags(dom_markedup, obj.heading_lev_markup);
- obj.dom_markedup = dom_markedup.dup;
- dom_collapsed = dom_set_collapsed_tags(dom_collapsed, obj.heading_lev_collapsed);
- obj.dom_collapsed = dom_collapsed.dup;
+ dom_markedup = dom_markedup_buffer.dup;
+ dom_collapsed = dom_collapsed_buffer.dup;
+ foreach (ref obj; the_bookindex_section["seg"]) {
+ if (obj.is_a == "heading") {
+ debug(dom) {
+ writeln(obj.text);
}
- }
- dom_markedup = dom_markedup_buffer.dup;
- dom_collapsed = dom_collapsed_buffer.dup;
- foreach (ref obj; the_bookindex_section["seg"]) {
- if (obj.is_a == "heading") {
- debug(dom) {
- writeln(obj.text);
- }
- if (obj.heading_lev_markup == 4) {
- obj.segname_prev = html_segnames[obj.ptr_html_segnames - 1];
- if (html_segnames.length > obj.ptr_html_segnames + 1) {
- obj.segname_next = html_segnames[obj.ptr_html_segnames + 1];
- }
- assert(obj.segment_anchor_tag == html_segnames[obj.ptr_html_segnames]);
+ if (obj.heading_lev_markup == 4) {
+ obj.segname_prev = html_segnames[obj.ptr_html_segnames - 1];
+ if (html_segnames.length > obj.ptr_html_segnames + 1) {
+ obj.segname_next = html_segnames[obj.ptr_html_segnames + 1];
}
- dom_markedup = dom_set_markup_tags(dom_markedup, obj.heading_lev_markup);
- obj.dom_markedup = dom_markedup.dup;
- dom_collapsed = dom_set_collapsed_tags(dom_collapsed, obj.heading_lev_collapsed);
- obj.dom_collapsed = dom_collapsed.dup;
+ assert(obj.segment_anchor_tag == html_segnames[obj.ptr_html_segnames]);
}
+ if ((opt_action_bool["html"])
+ || (opt_action_bool["html_scroll"])
+ || (opt_action_bool["html_seg"])
+ || (opt_action_bool["epub"])) {
+ obj.dom_markedup = dom_set_markup_tags(dom_markedup, obj.heading_lev_markup).dup;
+ obj.dom_collapsed = dom_set_collapsed_tags(dom_collapsed, obj.heading_lev_collapsed).dup;
+ }
+ heading_ancestors(obj, lv_ancestors);
}
}
- /+ optional only one 1~ level +/
- if (the_blurb_section.length > 1) {
- foreach (ref obj; the_blurb_section) {
- if (obj.is_a == "heading") {
- debug(dom) {
- writeln(obj.text);
- }
- if (obj.heading_lev_markup == 4) {
- obj.segname_prev = html_segnames[obj.ptr_html_segnames - 1];
- if (html_segnames.length > obj.ptr_html_segnames + 1) {
- obj.segname_next = html_segnames[obj.ptr_html_segnames + 1];
- }
- assert(obj.segment_anchor_tag == html_segnames[obj.ptr_html_segnames]);
+ }
+ /+ optional only one 1~ level +/
+ if (the_blurb_section.length > 1) {
+ foreach (ref obj; the_blurb_section) {
+ if (obj.is_a == "heading") {
+ debug(dom) {
+ writeln(obj.text);
+ }
+ if (obj.heading_lev_markup == 4) {
+ obj.segname_prev = html_segnames[obj.ptr_html_segnames - 1];
+ if (html_segnames.length > obj.ptr_html_segnames + 1) {
+ obj.segname_next = html_segnames[obj.ptr_html_segnames + 1];
}
- dom_markedup = dom_set_markup_tags(dom_markedup, obj.heading_lev_markup);
- obj.dom_markedup = dom_markedup.dup;
- dom_collapsed = dom_set_collapsed_tags(dom_collapsed, obj.heading_lev_collapsed);
- obj.dom_collapsed = dom_collapsed.dup;
+ assert(obj.segment_anchor_tag == html_segnames[obj.ptr_html_segnames]);
+ }
+ if ((opt_action_bool["html"])
+ || (opt_action_bool["html_scroll"])
+ || (opt_action_bool["html_seg"])
+ || (opt_action_bool["epub"])) {
+ obj.dom_markedup = dom_set_markup_tags(dom_markedup, obj.heading_lev_markup).dup;
+ obj.dom_collapsed = dom_set_collapsed_tags(dom_collapsed, obj.heading_lev_collapsed).dup;
}
+ heading_ancestors(obj, lv_ancestors);
}
}
+ /+ TODO
+ - note create/insert heading object sole purpose eof close all open tags
+ sort out:
+ - obj.dom_markedup = dom_markedup;
+ - obj.dom_collapsed = dom_collapsed;
+ +/
dom_markedup = dom_set_markup_tags(dom_markedup, 0);
dom_collapsed = dom_set_collapsed_tags(dom_collapsed, 0);
comp_obj_heading_ = comp_obj_heading_.init;
@@ -1386,8 +1467,7 @@ template SiSUdocAbstraction() {
/+ substantive/body: +/
"body": the_document_body_section,
/+ backmatter: +/
- "endnotes_seg": the_endnotes_section["seg"],
- "endnotes_scroll": the_endnotes_section["scroll"],
+ "endnotes": the_endnotes_section,
"glossary": the_glossary_section,
"bibliography": the_bibliography_section,
"bookindex_scroll": the_bookindex_section["scroll"],
@@ -3112,7 +3192,7 @@ template SiSUdocAbstraction() {
"hang_position" : 0,
"base_position" : 0,
];
- toc_txt_ = "{ Table of Contents }../toc.fn_suffix";
+ toc_txt_ = "{ Table of Contents }../toc.fnSuffix";
toc_txt_= munge.url_links(toc_txt_);
comp_obj_toc.indent_hang = indent["hang_position"];
comp_obj_toc.indent_base = indent["base_position"];
@@ -3136,7 +3216,7 @@ template SiSUdocAbstraction() {
break;
case 4:
toc_txt_ = format(
- "{ %s }../%s.fn_suffix",
+ "{ %s }../%s.fnSuffix",
heading_toc_,
segment_anchor_tag_that_object_belongs_to,
);
@@ -3153,12 +3233,12 @@ template SiSUdocAbstraction() {
break;
case 5: .. case 7:
toc_txt_ = format(
- "{ %s }../%s.fn_suffix#%s",
+ "{ %s }../%s.fnSuffix#%s",
heading_toc_,
segment_anchor_tag_that_object_belongs_to,
_anchor_tag,
);
- subtoc_txt_ = format( // 5 .. 7
+ subtoc_txt_ = format(
"{ %s }#%s",
heading_toc_,
_anchor_tag,
@@ -3772,7 +3852,7 @@ template SiSUdocAbstraction() {
bi_tmp_scroll ~= munge.url_links(" {" ~ ref_ ~ "}#" ~ go ~ ", ");
bi_tmp_seg ~= (segment_anchor_tag_that_object_belongs_to.empty)
? munge.url_links(" {" ~ ref_ ~ "}#" ~ go ~ ", ")
- : munge.url_links(" {" ~ ref_ ~ "}../" ~ segment_anchor_tag_that_object_belongs_to ~ ".fn_suffix#" ~ go ~ ", ");
+ : munge.url_links(" {" ~ ref_ ~ "}../" ~ segment_anchor_tag_that_object_belongs_to ~ ".fnSuffix#" ~ go ~ ", ");
}
bi_tmp_scroll ~= " \\\\\n ";
bi_tmp_seg ~= " \\\\\n ";
@@ -3789,7 +3869,7 @@ template SiSUdocAbstraction() {
bi_tmp_scroll ~= munge.url_links(" {" ~ ref_ ~ "}#" ~ go ~ ", ");
bi_tmp_seg ~= (segment_anchor_tag_that_object_belongs_to.empty)
? munge.url_links(" {" ~ ref_ ~ "}#" ~ go ~ ", ")
- : munge.url_links(" {" ~ ref_ ~ "}../" ~ segment_anchor_tag_that_object_belongs_to ~ ".fn_suffix#" ~ go ~ ", ");
+ : munge.url_links(" {" ~ ref_ ~ "}../" ~ segment_anchor_tag_that_object_belongs_to ~ ".fnSuffix#" ~ go ~ ", ");
}
bi_tmp_scroll ~= " \\\\\n ";
bi_tmp_seg ~= " \\\\\n ";
@@ -3867,25 +3947,21 @@ template SiSUdocAbstraction() {
) {
debug(endnotes_build) {
writeln(
- "{^{", m.captures[1], ".}^}../", segment_anchor_tag_that_object_belongs_to, ".fn_suffix#noteref_\n ", m.captures[1], " ",
+ "{^{", m.captures[1], ".}^}../", segment_anchor_tag_that_object_belongs_to, ".fnSuffix#noteref_\n ", m.captures[1], " ",
m.captures[2]); // sometimes need segment name (segmented html & epub)
}
// TODO NEXT you need anchor for segments at this point ->
object_notes["anchor"] ~= "#note_" ~ m.captures[1] ~ "』";
- object_notes["seg"] ~= (segment_anchor_tag_that_object_belongs_to.empty)
+ object_notes["notes"] ~= (segment_anchor_tag_that_object_belongs_to.empty)
? (munge.url_links(
"{^{" ~ m.captures[1] ~ ".}^}#noteref_" ~
m.captures[1]) ~ " " ~ m.captures[2] ~ "』"
)
: (munge.url_links(
- "{^{" ~ m.captures[1] ~ ".}^}../" ~ segment_anchor_tag_that_object_belongs_to ~ ".fn_suffix#noteref_" ~
+ "{^{" ~ m.captures[1] ~ ".}^}../" ~
+ segment_anchor_tag_that_object_belongs_to ~ ".fnSuffix#noteref_" ~
m.captures[1]) ~ " " ~ m.captures[2] ~ "』"
);
- object_notes["scroll"] ~=
- munge.url_links(
- "{^{" ~ m.captures[1] ~ ".}^}#noteref_" ~
- m.captures[1]
- ) ~ " " ~ m.captures[2] ~ "』";
}
return object_notes;
}
@@ -3895,12 +3971,10 @@ template SiSUdocAbstraction() {
body {
string[][string] endnotes_;
if (object_notes.length > 1) {
- endnotes_["seg"] = (split(object_notes["seg"], rgx.break_string))[0..$-1];
- endnotes_["scroll"] = (split(object_notes["scroll"], rgx.break_string))[0..$-1];
+ endnotes_["notes"] = (split(object_notes["notes"], rgx.break_string))[0..$-1];
endnotes_["anchor"] = (split(object_notes["anchor"], rgx.break_string))[0..$-1];
} else {
- endnotes_["seg"] = [];
- endnotes_["scroll"] = [];
+ endnotes_["notes"] = [];
endnotes_["anchor"] = [];
}
return endnotes_;
@@ -3913,14 +3987,14 @@ template SiSUdocAbstraction() {
}
body {
mixin SiSUnode;
- ObjGenericComposite[][string] the_endnotes_section;
+ ObjGenericComposite[] the_endnotes_section;
auto endnotes_ = gathered_notes();
string type_is;
string lev, lev_markup_number, lev_collapsed_number;
string attrib;
int[string] indent;
ObjGenericComposite comp_obj_heading_;
- if ((endnotes_["seg"].length > 0)
+ if ((endnotes_["notes"].length > 0)
&& (opt_action_bool["backmatter"] && opt_action_bool["section_endnotes"])) {
comp_obj_heading_ = comp_obj_heading_.init;
comp_obj_heading_.use = "backmatter";
@@ -3934,8 +4008,7 @@ template SiSUdocAbstraction() {
comp_obj_heading_.heading_lev_collapsed = 1;
comp_obj_heading_.parent_ocn = 1;
comp_obj_heading_.parent_lev_markup = 0;
- the_endnotes_section["seg"] ~= comp_obj_heading_;
- the_endnotes_section["scroll"] ~= comp_obj_heading_;
+ the_endnotes_section ~= comp_obj_heading_;
++obj_cite_number;
++mkn;
comp_obj_heading_ = comp_obj_heading_.init;
@@ -3952,8 +4025,7 @@ template SiSUdocAbstraction() {
comp_obj_heading_.parent_ocn = 1;
comp_obj_heading_.parent_lev_markup = 0;
comp_obj_heading_.anchor_tags = ["endnotes"];
- the_endnotes_section["seg"] ~= comp_obj_heading_;
- the_endnotes_section["scroll"] ~= comp_obj_heading_;
+ the_endnotes_section ~= comp_obj_heading_;
++obj_cite_number;
++mkn;
} else {
@@ -3969,8 +4041,7 @@ template SiSUdocAbstraction() {
comp_obj_heading_.heading_lev_collapsed = 1;
comp_obj_heading_.parent_ocn = 1;
comp_obj_heading_.parent_lev_markup = 0;
- the_endnotes_section["seg"] ~= comp_obj_heading_;
- the_endnotes_section["scroll"] ~= comp_obj_heading_;
+ the_endnotes_section ~= comp_obj_heading_;
}
if (opt_action_bool["backmatter"] && opt_action_bool["section_endnotes"]) {
ObjGenericComposite comp_obj_endnote_;
@@ -3983,21 +4054,13 @@ template SiSUdocAbstraction() {
comp_obj_endnote_.indent_hang = 0;
comp_obj_endnote_.indent_base = 0;
comp_obj_endnote_.bullet = false;
- foreach (i, endnote; endnotes_["seg"]) {
- auto m = (matchFirst(endnote, rgx.note_ref));
- string notenumber = to!string(m.captures[1]);
- string anchor_tag = "note_" ~ notenumber;
- comp_obj_endnote_.anchor_tags ~= [ endnotes_["anchor"][i] ]; // fix
- comp_obj_endnote_.text = endnote.strip;
- the_endnotes_section["seg"] ~= comp_obj_endnote_;
- }
- foreach (i, endnote; endnotes_["scroll"]) {
+ foreach (i, endnote; endnotes_["notes"]) {
auto m = (matchFirst(endnote, rgx.note_ref));
string notenumber = to!string(m.captures[1]);
string anchor_tag = "note_" ~ notenumber;
comp_obj_endnote_.anchor_tags ~= [ endnotes_["anchor"][i] ]; // fix
comp_obj_endnote_.text = endnote.strip;
- the_endnotes_section["scroll"] ~= comp_obj_endnote_;
+ the_endnotes_section ~= comp_obj_endnote_;
}
}
auto t = tuple(the_endnotes_section, obj_cite_number);
@@ -4150,6 +4213,7 @@ template SiSUdocAbstraction() {
int obj_cite_number_,
int cntr_,
int ptr_,
+ string[] lv_ancestors,
string is_,
int html_segnames_ptr,
)
@@ -4251,22 +4315,23 @@ template SiSUdocAbstraction() {
break;
}
ObjGenericComposite _comp_obj_heading_;
- _comp_obj_heading_ = _comp_obj_heading_.init;
- _comp_obj_heading_.use = "body";
- _comp_obj_heading_.is_of = "para";
- _comp_obj_heading_.is_a = "heading";
- _comp_obj_heading_.text = to!string(_text).strip;
- _comp_obj_heading_.ocn = obj_cite_number_;
- _comp_obj_heading_.obj_cite_number = (obj_cite_number==0) ? "" : to!string(obj_cite_number);
- _comp_obj_heading_.segment_anchor_tag = to!string(segment_anchor_tag);
- _comp_obj_heading_.marked_up_level = lev;
- _comp_obj_heading_.heading_lev_markup = (!(lev_markup_number.empty) ? to!int(lev_markup_number) : 0);
- _comp_obj_heading_.heading_lev_collapsed = (!(lev_collapsed_number.empty) ? to!int(lev_collapsed_number) : 0);
- _comp_obj_heading_.parent_ocn = p_["obj_cite_number"];
- _comp_obj_heading_.parent_lev_markup = p_["lev_markup_number"];
- _comp_obj_heading_.ptr_doc_object = cntr_;
- _comp_obj_heading_.ptr_html_segnames = ((lev_markup_number == "4") ? html_segnames_ptr : 0);
- _comp_obj_heading_.ptr_heading = ptr_;
+ _comp_obj_heading_ = _comp_obj_heading_.init;
+ _comp_obj_heading_.use = "body";
+ _comp_obj_heading_.is_of = "para";
+ _comp_obj_heading_.is_a = "heading"; // _node_heading_.is_a = is_; // check whether needed, constant???
+ _comp_obj_heading_.text = to!string(_text).strip;
+ _comp_obj_heading_.ocn = obj_cite_number_;
+ _comp_obj_heading_.obj_cite_number = (obj_cite_number==0) ? "" : to!string(obj_cite_number);
+ _comp_obj_heading_.segment_anchor_tag = to!string(segment_anchor_tag);
+ _comp_obj_heading_.marked_up_level = lev;
+ _comp_obj_heading_.heading_lev_markup = (!(lev_markup_number.empty) ? to!int(lev_markup_number) : 0);
+ _comp_obj_heading_.heading_lev_collapsed = (!(lev_collapsed_number.empty) ? to!int(lev_collapsed_number) : 0);
+ _comp_obj_heading_.parent_ocn = p_["obj_cite_number"];
+ _comp_obj_heading_.parent_lev_markup = p_["lev_markup_number"];
+ _comp_obj_heading_.heading_ancestors_text = lv_ancestors;
+ _comp_obj_heading_.ptr_doc_object = cntr_;
+ _comp_obj_heading_.ptr_html_segnames = ((lev_markup_number == "4") ? html_segnames_ptr : 0);
+ _comp_obj_heading_.ptr_heading = ptr_;
debug(node) {
if (match(lev_markup_number, rgx.levels_numbered_headings)) {
writeln("* ", to!string(_node));