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.d149
1 files changed, 103 insertions, 46 deletions
diff --git a/src/sdp/ao_abstract_doc_source.d b/src/sdp/ao_abstract_doc_source.d
index f7eca53..f231af6 100644
--- a/src/sdp/ao_abstract_doc_source.d
+++ b/src/sdp/ao_abstract_doc_source.d
@@ -346,6 +346,7 @@ template SiSUdocAbstraction() {
auto bookindex_extract_hash = BookIndexNuggetHash();
string[][string] lev4_subtoc;
string[] html_segnames=["toc"];
+ int cnt1 = 1; int cnt2 = 1; int cnt3 = 1;
/+ abstraction init ↑ +/
/+ ↓ loop markup document/text line by line +/
srcDocLoop:
@@ -435,6 +436,7 @@ template SiSUdocAbstraction() {
comp_obj_heading_.text = "Glossary";
comp_obj_heading_.ocn = 0;
comp_obj_heading_.obj_cite_number = "";
+ comp_obj_heading_.segment_anchor_tag = "_part_glossary";
comp_obj_heading_.marked_up_level = "B";
comp_obj_heading_.heading_lev_markup = 1;
comp_obj_heading_.heading_lev_collapsed = 1;
@@ -503,6 +505,7 @@ template SiSUdocAbstraction() {
comp_obj_heading_.text = "Blurb";
comp_obj_heading_.ocn = 0;
comp_obj_heading_.obj_cite_number = "";
+ comp_obj_heading_.segment_anchor_tag = "_part_blurb";
comp_obj_heading_.marked_up_level = "B";
comp_obj_heading_.heading_lev_markup = 1;
comp_obj_heading_.heading_lev_collapsed = 1;
@@ -744,8 +747,28 @@ template SiSUdocAbstraction() {
segment_anchor_tag_that_object_belongs_to = anchor_tag_;
segment_anchor_tag_that_object_belongs_to_uri = anchor_tag_ ~ ".fnSuffix#" ~ obj_cite_number.to!string;
} else if (an_object["lev_markup_number"].to!int < 4) {
- segment_anchor_tag_that_object_belongs_to = "";
- segment_anchor_tag_that_object_belongs_to_uri = "";
+ string segn;
+ switch (an_object["lev_markup_number"].to!int) {
+ case 0:
+ segn = "_the_title";
+ goto default;
+ case 1:
+ segn = "_part_" ~ cnt1.to!string;
+ ++cnt1;
+ goto default;
+ case 2:
+ segn = "_part_" ~ cnt1.to!string ~ "_" ~ cnt2.to!string;
+ ++cnt2;
+ goto default;
+ case 3:
+ segn = "_part_" ~ cnt1.to!string ~ "_" ~ cnt2.to!string ~ "_" ~ cnt3.to!string;
+ ++cnt3;
+ goto default;
+ default:
+ segment_anchor_tag_that_object_belongs_to = segn;
+ segment_anchor_tag_that_object_belongs_to_uri = segn ~ ".fnSuffix";
+ break;
+ }
}
an_object["bookindex_nugget"] =
("bookindex_nugget" in an_object) ? an_object["bookindex_nugget"] : "";
@@ -949,6 +972,7 @@ template SiSUdocAbstraction() {
comp_obj_heading_.text = "Bibliography";
comp_obj_heading_.ocn = 0;
comp_obj_heading_.obj_cite_number = "";
+ comp_obj_heading_.segment_anchor_tag = "_part_bibliography";
comp_obj_heading_.marked_up_level = "B";
comp_obj_heading_.heading_lev_markup = 1;
comp_obj_heading_.heading_lev_collapsed = 1;
@@ -1264,11 +1288,15 @@ template SiSUdocAbstraction() {
}
return images_;
}
+ string[] segnames_0_4;
foreach (ref obj; the_document_head_section) {
if (obj.is_a == "heading") {
debug(dom) {
writeln(obj.text);
}
+ if (obj.heading_lev_markup <= 4) {
+ segnames_0_4 ~= obj.segment_anchor_tag;
+ }
if ((opt_action_bool["html"])
|| (opt_action_bool["html_scroll"])
|| (opt_action_bool["html_seg"])
@@ -1286,9 +1314,12 @@ template SiSUdocAbstraction() {
dom_collapsed_buffer = dom_collapsed.dup;
foreach (ref obj; the_table_of_contents_section["scroll"]) {
if (obj.is_a == "heading") {
- 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 (obj.heading_lev_markup <= 4) {
+ segnames_0_4 ~= obj.segment_anchor_tag;
+ 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"])
@@ -1309,9 +1340,12 @@ template SiSUdocAbstraction() {
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 (obj.heading_lev_markup <= 4) {
+ segnames_0_4 ~= obj.segment_anchor_tag;
+ 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"])
@@ -1333,13 +1367,16 @@ template SiSUdocAbstraction() {
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];
+ if (obj.heading_lev_markup <= 4) {
+ segnames_0_4 ~= obj.segment_anchor_tag;
+ 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]);
}
- assert(obj.segment_anchor_tag == html_segnames[obj.ptr_html_segnames]);
}
if ((opt_action_bool["html"])
|| (opt_action_bool["html_scroll"])
@@ -1368,12 +1405,15 @@ template SiSUdocAbstraction() {
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];
+ if (obj.heading_lev_markup <= 4) {
+ segnames_0_4 ~= obj.segment_anchor_tag;
+ 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]);
}
- assert(obj.segment_anchor_tag == html_segnames[obj.ptr_html_segnames]);
}
if ((opt_action_bool["html"])
|| (opt_action_bool["html_scroll"])
@@ -1395,12 +1435,15 @@ template SiSUdocAbstraction() {
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];
+ if (obj.heading_lev_markup <= 4) {
+ segnames_0_4 ~= obj.segment_anchor_tag;
+ 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]);
}
- assert(obj.segment_anchor_tag == html_segnames[obj.ptr_html_segnames]);
}
if ((opt_action_bool["html"])
|| (opt_action_bool["html_scroll"])
@@ -1422,12 +1465,15 @@ template SiSUdocAbstraction() {
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];
+ if (obj.heading_lev_markup <= 4) {
+ segnames_0_4 ~= obj.segment_anchor_tag;
+ 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]);
}
- assert(obj.segment_anchor_tag == html_segnames[obj.ptr_html_segnames]);
}
if ((opt_action_bool["html"])
|| (opt_action_bool["html_scroll"])
@@ -1450,12 +1496,15 @@ template SiSUdocAbstraction() {
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];
+ if (obj.heading_lev_markup <= 4) {
+ segnames_0_4 ~= obj.segment_anchor_tag;
+ 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]);
}
- assert(obj.segment_anchor_tag == html_segnames[obj.ptr_html_segnames]);
}
if ((opt_action_bool["html"])
|| (opt_action_bool["html_scroll"])
@@ -1476,12 +1525,15 @@ template SiSUdocAbstraction() {
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];
+ if (obj.heading_lev_markup <= 4) {
+ segnames_0_4 ~= obj.segment_anchor_tag;
+ 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]);
}
- assert(obj.segment_anchor_tag == html_segnames[obj.ptr_html_segnames]);
}
if ((opt_action_bool["html"])
|| (opt_action_bool["html_scroll"])
@@ -1503,12 +1555,15 @@ template SiSUdocAbstraction() {
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];
+ if (obj.heading_lev_markup <= 4) {
+ segnames_0_4 ~= obj.segment_anchor_tag;
+ 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]);
}
- assert(obj.segment_anchor_tag == html_segnames[obj.ptr_html_segnames]);
}
if ((opt_action_bool["html"])
|| (opt_action_bool["html_scroll"])
@@ -1621,6 +1676,7 @@ template SiSUdocAbstraction() {
document_the,
docSectKeysSeq!()(document_section_keys_sequenced),
segnames,
+ segnames_0_4,
images,
);
return t;
@@ -2633,7 +2689,6 @@ template SiSUdocAbstraction() {
auto substantive_obj_misc_tuple =
obj_im.obj_inline_markup_and_anchor_tags_and_misc(an_object, an_object_key, dochead_make_aa);
an_object["substantive"] = substantive_obj_misc_tuple[sObj.content];
- anchor_tags = substantive_obj_misc_tuple[sObj.anchor_tags];
comp_obj_block = comp_obj_block.init;
comp_obj_block.use = "body";
comp_obj_block.is_of = "block";
@@ -2675,7 +2730,7 @@ template SiSUdocAbstraction() {
comp_obj_poem_ocn.is_a = "poem";
comp_obj_poem_ocn.ocn = obj_cite_number;
comp_obj_poem_ocn.obj_cite_number = (obj_cite_number_poem["start"], obj_cite_number_poem["end"]);
- comp_obj_poem_ocn.text = ""; // an_object["substantive"];
+ comp_obj_poem_ocn.text = "";
the_document_body_section ~= comp_obj_poem_ocn;
type["blocks"] = TriState.off;
type["poem"] = TriState.off;
@@ -4631,6 +4686,7 @@ template SiSUdocAbstraction() {
comp_obj_heading_.text = "Book Index";
comp_obj_heading_.ocn = 0;
comp_obj_heading_.obj_cite_number = "";
+ comp_obj_heading_.segment_anchor_tag = "_part_book_index";
comp_obj_heading_.marked_up_level = "B";
comp_obj_heading_.heading_lev_markup = 1;
comp_obj_heading_.heading_lev_collapsed = 1;
@@ -4852,6 +4908,7 @@ template SiSUdocAbstraction() {
comp_obj_heading_.text = "Endnotes";
comp_obj_heading_.ocn = 0;
comp_obj_heading_.obj_cite_number = "";
+ comp_obj_heading_.segment_anchor_tag = "_part_endnotes";
comp_obj_heading_.marked_up_level = "B";
comp_obj_heading_.heading_lev_markup = 1;
comp_obj_heading_.heading_lev_collapsed = 1;