aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/sdp/ao_abstract_doc_source.d
diff options
context:
space:
mode:
authorRalph Amissah <ralph@amissah.com>2017-02-26 18:01:24 -0500
committerRalph Amissah <ralph@amissah.com>2019-04-10 15:14:14 -0400
commitb11f8f104e8c3a4ab9740d086da91aa943200e6e (patch)
tree2f898df140d855b5b9c29a17decf75c5f9896c80 /src/sdp/ao_abstract_doc_source.d
parent0.13.3 tuples, sdp & doc_abstraction (flag marked up links & endnotes) (diff)
0.13.4 includes ao bookindex segname (anchors) fix
Diffstat (limited to 'src/sdp/ao_abstract_doc_source.d')
-rw-r--r--src/sdp/ao_abstract_doc_source.d212
1 files changed, 131 insertions, 81 deletions
diff --git a/src/sdp/ao_abstract_doc_source.d b/src/sdp/ao_abstract_doc_source.d
index 14b1071..7cb68e5 100644
--- a/src/sdp/ao_abstract_doc_source.d
+++ b/src/sdp/ao_abstract_doc_source.d
@@ -59,7 +59,6 @@ template SiSUdocAbstraction() {
h_text_5, // extra level, drop
content_non_header
} // header section A-D; header text 1-4
- enum DocStructCollapsedHeading { lv0, lv1, lv2, lv3, lv4, lv5, lv6, lv7 }
/+ biblio variables +/
string biblio_tag_name, biblio_tag_entry, st;
string[] biblio_arr_json;
@@ -173,8 +172,8 @@ template SiSUdocAbstraction() {
}
}
}
- debug(dom) {
- writeln(lev, ": ", dom);
+ debug(dom_magic_numbers) {
+ writeln("marked up: ", lev, ": ", dom);
}
return dom;
}
@@ -212,8 +211,8 @@ template SiSUdocAbstraction() {
}
}
}
- debug(dom) {
- writeln(lev, ": ", dom);
+ debug(dom_magic_numbers) {
+ writeln("collapsed: ", lev, ": ", dom);
}
return dom;
}
@@ -397,7 +396,7 @@ template SiSUdocAbstraction() {
type["biblio_section"] = State.on;
type["blurb_section"] = State.off;
if (opt_action_bool["backmatter"] && opt_action_bool["section_biblio"]) {
- _biblio_block_(line, type, bib_entry, biblio_entry_str_json, biblio_arr_json); //
+ _biblio_block_(line, type, bib_entry, biblio_entry_str_json, biblio_arr_json);
debug(bibliobuild) {
writeln("- ", biblio_entry_str_json);
writeln("-> ", biblio_arr_json.length);
@@ -722,10 +721,6 @@ template SiSUdocAbstraction() {
obj_cite_number = (to!int(an_object["lev_markup_number"]) == 0)
? (ocn_emit(3))
: (obj_cite_number = ocn_emit(type["ocn_status"]));
- an_object["bookindex_nugget"] =
- ("bookindex_nugget" in an_object) ? an_object["bookindex_nugget"] : "";
- bookindex_unordered_hashes =
- bookindex_extract_hash.bookindex_nugget_hash(an_object["bookindex_nugget"], obj_cite_number);
an_object["is"] = "heading";
an_object_key="body_nugget";
auto substantive_object_and_anchor_tags_tuple =
@@ -743,6 +738,10 @@ template SiSUdocAbstraction() {
segment_anchor_tag_that_object_belongs_to = "";
segment_anchor_tag_that_object_belongs_to_uri = "";
}
+ an_object["bookindex_nugget"] =
+ ("bookindex_nugget" in an_object) ? an_object["bookindex_nugget"] : "";
+ bookindex_unordered_hashes =
+ bookindex_extract_hash.bookindex_nugget_hash(an_object["bookindex_nugget"], obj_cite_number, segment_anchor_tag_that_object_belongs_to);
/+ (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(
@@ -796,7 +795,7 @@ template SiSUdocAbstraction() {
an_object["bookindex_nugget"] =
("bookindex_nugget" in an_object) ? an_object["bookindex_nugget"] : "";
bookindex_unordered_hashes =
- bookindex_extract_hash.bookindex_nugget_hash(an_object["bookindex_nugget"], obj_cite_number);
+ bookindex_extract_hash.bookindex_nugget_hash(an_object["bookindex_nugget"], obj_cite_number, segment_anchor_tag_that_object_belongs_to);
an_object["is"] = "para";
auto comp_obj_heading =
node_construct.node_location_emitter(
@@ -998,7 +997,6 @@ template SiSUdocAbstraction() {
bi.bookindex_build_abstraction_section(
bookindex_unordered_hashes,
obj_cite_number,
- segment_anchor_tag_that_object_belongs_to,
opt_action_bool,
);
destroy(bookindex_unordered_hashes);
@@ -1046,24 +1044,28 @@ template SiSUdocAbstraction() {
comp_obj_toc.bullet = false;
if (the_endnotes_section.length > 1) {
toc_txt_ = format(
- "{ %s }%s../%s.fnSuffix",
+ "{ %s }%s%s%s",
"Endnotes",
mkup.mark_internal_site_lnk,
"endnotes", // segment_anchor_tag_that_object_belongs_to
+ ".fnSuffix",
);
toc_txt_= munge.url_links(toc_txt_);
comp_obj_toc.text = to!string(toc_txt_).strip;
+ comp_obj_toc.inline_links = true;
the_table_of_contents_section["seg"] ~= comp_obj_toc;
}
if (the_glossary_section.length > 1) {
toc_txt_ = format(
- "{ %s }%s../%s.fnSuffixs",
+ "{ %s }%s%s%s",
"Glossary",
mkup.mark_internal_site_lnk,
"glossary", // segment_anchor_tag_that_object_belongs_to
+ ".fnSuffix",
);
toc_txt_= munge.url_links(toc_txt_);
comp_obj_toc.text = to!string(toc_txt_).strip;
+ comp_obj_toc.inline_links = true;
the_table_of_contents_section["seg"] ~= comp_obj_toc;
toc_txt_ = format(
"{ %s }#%s",
@@ -1072,17 +1074,20 @@ template SiSUdocAbstraction() {
);
toc_txt_= munge.url_links(toc_txt_);
comp_obj_toc.text = to!string(toc_txt_).strip;
+ comp_obj_toc.inline_links = true;
the_table_of_contents_section["scroll"] ~= comp_obj_toc;
}
if (the_bibliography_section.length > 1){
toc_txt_ = format(
- "{ %s }%s../%s.fnSuffix",
+ "{ %s }%s%s%s",
"Bibliography",
mkup.mark_internal_site_lnk,
"bibliography", // segment_anchor_tag_that_object_belongs_to
+ ".fnSuffix",
);
toc_txt_= munge.url_links(toc_txt_);
comp_obj_toc.text = to!string(toc_txt_).strip;
+ comp_obj_toc.inline_links = true;
the_table_of_contents_section["seg"] ~= comp_obj_toc;
toc_txt_ = format(
@@ -1092,17 +1097,20 @@ template SiSUdocAbstraction() {
);
toc_txt_= munge.url_links(toc_txt_);
comp_obj_toc.text = to!string(toc_txt_).strip;
+ comp_obj_toc.inline_links = true;
the_table_of_contents_section["scroll"] ~= comp_obj_toc;
}
if (the_bookindex_section["seg"].length > 1) {
toc_txt_ = format(
- "{ %s }%s../%s.fnSuffix",
+ "{ %s }%s%s%s",
"Book Index",
mkup.mark_internal_site_lnk,
"bookindex", // segment_anchor_tag_that_object_belongs_to
+ ".fnSuffix",
);
toc_txt_= munge.url_links(toc_txt_);
comp_obj_toc.text = to!string(toc_txt_).strip;
+ comp_obj_toc.inline_links = true;
the_table_of_contents_section["seg"] ~= comp_obj_toc;
}
if (the_bookindex_section["scroll"].length > 1) {
@@ -1113,17 +1121,20 @@ template SiSUdocAbstraction() {
);
toc_txt_= munge.url_links(toc_txt_);
comp_obj_toc.text = to!string(toc_txt_).strip;
+ comp_obj_toc.inline_links = true;
the_table_of_contents_section["scroll"] ~= comp_obj_toc;
}
if (the_blurb_section.length > 1) {
toc_txt_ = format(
- "{ %s }%s../%s.fnSuffix",
+ "{ %s }%s%s%s",
"Blurb",
mkup.mark_internal_site_lnk,
"blurb", // segment_anchor_tag_that_object_belongs_to
+ ".fnSuffix",
);
toc_txt_= munge.url_links(toc_txt_);
comp_obj_toc.text = to!string(toc_txt_).strip;
+ comp_obj_toc.inline_links = true;
the_table_of_contents_section["seg"] ~= comp_obj_toc;
toc_txt_ = format(
"{ %s }#%s",
@@ -1131,6 +1142,7 @@ template SiSUdocAbstraction() {
"blurb", // _anchor_tag
);
toc_txt_= munge.url_links(toc_txt_);
+ comp_obj_toc.inline_links = true;
comp_obj_toc.text = to!string(toc_txt_).strip;
the_table_of_contents_section["scroll"] ~= comp_obj_toc;
}
@@ -2408,7 +2420,7 @@ template SiSUdocAbstraction() {
an_object["bookindex_nugget"] =
("bookindex_nugget" in an_object) ? an_object["bookindex_nugget"] : "";
bookindex_unordered_hashes =
- bookindex_extract_hash.bookindex_nugget_hash(an_object["bookindex_nugget"], obj_cite_number);
+ bookindex_extract_hash.bookindex_nugget_hash(an_object["bookindex_nugget"], obj_cite_number, segment_anchor_tag_that_object_belongs_to);
an_object["is"] = "code";
auto comp_obj_location =
node_construct.node_location_emitter(
@@ -2443,7 +2455,7 @@ template SiSUdocAbstraction() {
an_object["bookindex_nugget"] =
("bookindex_nugget" in an_object) ? an_object["bookindex_nugget"] : "";
bookindex_unordered_hashes =
- bookindex_extract_hash.bookindex_nugget_hash(an_object["bookindex_nugget"], obj_cite_number);
+ bookindex_extract_hash.bookindex_nugget_hash(an_object["bookindex_nugget"], obj_cite_number, segment_anchor_tag_that_object_belongs_to);
an_object["is"] = "verse"; // check also
auto comp_obj_location =
node_construct.node_location_emitter(
@@ -2472,7 +2484,7 @@ template SiSUdocAbstraction() {
an_object["bookindex_nugget"] =
("bookindex_nugget" in an_object) ? an_object["bookindex_nugget"] : "";
bookindex_unordered_hashes =
- bookindex_extract_hash.bookindex_nugget_hash(an_object["bookindex_nugget"], obj_cite_number);
+ bookindex_extract_hash.bookindex_nugget_hash(an_object["bookindex_nugget"], obj_cite_number, segment_anchor_tag_that_object_belongs_to);
an_object["is"] = "table";
auto comp_obj_location =
node_construct.node_location_emitter(
@@ -2509,7 +2521,7 @@ template SiSUdocAbstraction() {
an_object["bookindex_nugget"] =
("bookindex_nugget" in an_object) ? an_object["bookindex_nugget"] : "";
bookindex_unordered_hashes =
- bookindex_extract_hash.bookindex_nugget_hash(an_object["bookindex_nugget"], obj_cite_number);
+ bookindex_extract_hash.bookindex_nugget_hash(an_object["bookindex_nugget"], obj_cite_number, segment_anchor_tag_that_object_belongs_to);
an_object["is"] = "group";
auto comp_obj_location =
node_construct.node_location_emitter(
@@ -2545,7 +2557,7 @@ template SiSUdocAbstraction() {
an_object["bookindex_nugget"] =
("bookindex_nugget" in an_object) ? an_object["bookindex_nugget"] : "";
bookindex_unordered_hashes =
- bookindex_extract_hash.bookindex_nugget_hash(an_object["bookindex_nugget"], obj_cite_number);
+ bookindex_extract_hash.bookindex_nugget_hash(an_object["bookindex_nugget"], obj_cite_number, segment_anchor_tag_that_object_belongs_to);
an_object["is"] = "block";
auto comp_obj_location =
node_construct.node_location_emitter(
@@ -2582,7 +2594,7 @@ template SiSUdocAbstraction() {
an_object["bookindex_nugget"] =
("bookindex_nugget" in an_object) ? an_object["bookindex_nugget"] : "";
bookindex_unordered_hashes =
- bookindex_extract_hash.bookindex_nugget_hash(an_object["bookindex_nugget"], obj_cite_number);
+ bookindex_extract_hash.bookindex_nugget_hash(an_object["bookindex_nugget"], obj_cite_number, segment_anchor_tag_that_object_belongs_to);
an_object["is"] = "quote";
auto comp_obj_location =
node_construct.node_location_emitter(
@@ -2655,7 +2667,8 @@ template SiSUdocAbstraction() {
/+ book_index flag set +/
if (auto m = match(line, rgx.book_index_close)) {
type["book_index"] = State.off;
- if (opt_action_bool["backmatter"] && opt_action_bool["section_bookindex"]) {
+ if (opt_action_bool["backmatter"]
+ && opt_action_bool["section_bookindex"]) {
an_object["bookindex_nugget"] = book_idx_tmp ~ to!string(m.captures[1]);
debug(bookindexmatch) { // book index
writefln(
@@ -2666,7 +2679,8 @@ template SiSUdocAbstraction() {
}
book_idx_tmp = "";
} else {
- if (opt_action_bool["backmatter"] && opt_action_bool["section_bookindex"]) {
+ if (opt_action_bool["backmatter"]
+ && opt_action_bool["section_bookindex"]) {
book_idx_tmp ~= line;
}
}
@@ -3075,7 +3089,7 @@ template SiSUdocAbstraction() {
n_foot_sp_asterisk = 0;
n_foot_sp_plus = 0;
}
- string url_links(Ot)(Ot obj_txt_in) {
+ string url_links(Ot)(Ot obj_txt_in, string suffix = ".html") {
debug(asserts){
static assert(is(typeof(obj_txt_in) == string));
}
@@ -3088,7 +3102,7 @@ template SiSUdocAbstraction() {
obj_txt_in,
rgx.inline_link_naked_url,
("$1"
- ~ mkup.lnk_o ~ " $2 " ~ mkup.lnk_c
+ ~ mkup.lnk_o ~ "$2" ~ mkup.lnk_c
~ mkup.url_o ~ "$2" ~ mkup.url_c
~ "$3") // ("$1{ $2 }$2$3")
);
@@ -3103,7 +3117,7 @@ template SiSUdocAbstraction() {
replaceAll(
obj_txt_in,
rgx.inline_link_endnote_url_helper_punctuated,
- (mkup.lnk_o ~ " $1 " ~ mkup.lnk_c
+ (mkup.lnk_o ~ "$1" ~ mkup.lnk_c
~ mkup.url_o ~ "$2" ~ mkup.url_c
~ "~{ " ~ mkup.lnk_o ~ " $2 " ~ mkup.lnk_c
~ mkup.url_o ~ "$2" ~ mkup.url_c
@@ -3113,7 +3127,7 @@ template SiSUdocAbstraction() {
replaceAll(
obj_txt_in,
rgx.inline_link_endnote_url_helper,
- (mkup.lnk_o ~ " $1 " ~ mkup.lnk_c
+ (mkup.lnk_o ~ "$1" ~ mkup.lnk_c
~ mkup.url_o ~ "$2" ~ mkup.url_c
~ "~{ " ~ mkup.lnk_o ~ " $2 " ~ mkup.lnk_c
~ mkup.url_o ~ "$2" ~ mkup.url_c
@@ -3129,7 +3143,7 @@ template SiSUdocAbstraction() {
obj_txt_in,
rgx.inline_link_markup_regular,
("$1"
- ~ mkup.lnk_o ~ " $2 " ~ mkup.lnk_c
+ ~ mkup.lnk_o ~ "$2" ~ mkup.lnk_c
~ mkup.url_o ~ "$3" ~ mkup.url_c
~ "$4") // ("$1{ $2 }$3$4")
);
@@ -3142,8 +3156,8 @@ template SiSUdocAbstraction() {
static assert(is(typeof(obj_txt_in) == string));
}
/+ endnotes (regular) +/
- bool notes_reg = false;
- bool notes_star = false;
+ bool flg_notes_reg = false;
+ bool flg_notes_star = false;
obj_txt_in =
replaceAll(
obj_txt_in,
@@ -3164,7 +3178,7 @@ template SiSUdocAbstraction() {
stage_reset_note_numbers = false;
foreach(n; m) {
if (match(to!string(n.hit), rgx.inline_al_delimiter_open_symbol_star)) {
- notes_star = true;
+ flg_notes_star = true;
++n_foot_sp_asterisk;
asterisks_ = "*";
n_foot=n_foot_sp_asterisk;
@@ -3175,7 +3189,7 @@ template SiSUdocAbstraction() {
(mkup.en_a_o ~ replicate(asterisks_, n_foot_sp_asterisk) ~ " ")
) ~ "\n");
} else if (match(to!string(n.hit), rgx.inline_al_delimiter_open_regular)) {
- notes_reg = true;
+ flg_notes_reg = true;
++n_foot_reg;
n_foot=n_foot_reg;
obj_txt_out ~=
@@ -3194,8 +3208,8 @@ template SiSUdocAbstraction() {
}
auto t = tuple(
obj_txt_out,
- notes_reg,
- notes_star,
+ flg_notes_reg,
+ flg_notes_star,
);
return t;
}
@@ -3416,7 +3430,7 @@ template SiSUdocAbstraction() {
obj_txt["munge"]=_make_segment_anchor_tags_if_none_provided(obj_txt["munge"], obj_["lev"]);
if (auto m = match(obj_txt["munge"], rgx.heading_anchor_tag)) {
anchor_tag = m.captures[1];
- anchor_tags_ ~=anchor_tag;
+ anchor_tags_ ~= anchor_tag;
} else if (obj_["lev"] == "1") {
writeln("heading anchor tag missing: ", obj_txt["munge"]);
}
@@ -3532,6 +3546,7 @@ template SiSUdocAbstraction() {
comp_obj_toc.indent_base = indent["base_position"];
comp_obj_toc.bullet = false;
comp_obj_toc.text = to!string(toc_txt_).strip;
+ comp_obj_toc.inline_links = true;
the_table_of_contents_section["scroll"] ~= comp_obj_toc;
} else {
indent=[
@@ -3548,6 +3563,7 @@ template SiSUdocAbstraction() {
comp_obj_toc.indent_base = indent["base_position"];
comp_obj_toc.bullet = false;
comp_obj_toc.text = "Table of Contents";
+ comp_obj_toc.inline_links = true;
the_table_of_contents_section["scroll"] ~= comp_obj_toc;
}
comp_obj_toc = comp_obj_toc.init;
@@ -3557,17 +3573,19 @@ template SiSUdocAbstraction() {
comp_obj_toc.ocn = 0;
comp_obj_toc.obj_cite_number = "";
comp_obj_toc.bullet = false;
+ comp_obj_toc.inline_links = true;
switch (to!int(obj_["lev_markup_number"])) {
case 0:
indent=[
"hang_position" : 0,
"base_position" : 0,
];
- toc_txt_ = "{ Table of Contents }" ~ mkup.mark_internal_site_lnk ~ "../toc.fnSuffix";
+ toc_txt_ = "{ Table of Contents }" ~ mkup.mark_internal_site_lnk ~ "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"];
comp_obj_toc.text = to!string(toc_txt_).strip;
+ comp_obj_toc.inline_links = true;
the_table_of_contents_section["seg"] ~= comp_obj_toc;
break;
case 1: .. case 3:
@@ -3583,14 +3601,16 @@ template SiSUdocAbstraction() {
comp_obj_toc.indent_hang = indent["hang_position"];
comp_obj_toc.indent_base = indent["base_position"];
comp_obj_toc.text = to!string(toc_txt_).strip;
+ comp_obj_toc.inline_links = true;
the_table_of_contents_section["seg"] ~= comp_obj_toc;
break;
case 4:
toc_txt_ = format(
- "{ %s }%s../%s.fnSuffix",
+ "{ %s }%s%s%s",
heading_toc_,
mkup.mark_internal_site_lnk,
segment_anchor_tag_that_object_belongs_to,
+ ".fnSuffix",
);
lev4_subtoc[segment_anchor_tag_that_object_belongs_to] = [];
toc_txt_= munge.url_links(toc_txt_);
@@ -3601,14 +3621,16 @@ template SiSUdocAbstraction() {
comp_obj_toc.indent_hang = indent["hang_position"];
comp_obj_toc.indent_base = indent["base_position"];
comp_obj_toc.text = to!string(toc_txt_).strip;
+ comp_obj_toc.inline_links = true;
the_table_of_contents_section["seg"] ~= comp_obj_toc;
break;
case 5: .. case 7:
toc_txt_ = format(
- "{ %s }%s../%s.fnSuffix#%s",
+ "{ %s }%s%s%s#%s",
heading_toc_,
mkup.mark_internal_site_lnk,
segment_anchor_tag_that_object_belongs_to,
+ ".fnSuffix",
_anchor_tag,
);
subtoc_txt_ = format(
@@ -3625,6 +3647,7 @@ template SiSUdocAbstraction() {
comp_obj_toc.indent_hang = indent["hang_position"];
comp_obj_toc.indent_base = indent["base_position"];
comp_obj_toc.text = to!string(toc_txt_).strip;
+ comp_obj_toc.inline_links = true;
the_table_of_contents_section["seg"] ~= comp_obj_toc;
break;
default:
@@ -4092,9 +4115,10 @@ template SiSUdocAbstraction() {
string[][string][string] bi;
string[][string][string] hash_nugget;
string[] bi_main_terms_split_arr;
- string[][string][string] bookindex_nugget_hash(BI,N)(
+ string[][string][string] bookindex_nugget_hash(BI,N,S)(
BI bookindex_section,
- N obj_cite_number
+ N obj_cite_number,
+ S segment_anchor_tag,
)
in {
debug(asserts){
@@ -4105,7 +4129,7 @@ template SiSUdocAbstraction() {
if (!bookindex_section.empty) {
writeln(
"* [bookindex] ",
- "[", to!string(obj_cite_number), "] ", bookindex_section
+ "[", to!string(obj_cite_number), ": ", segment_anchor_tag, "] ", bookindex_section
);
}
}
@@ -4125,10 +4149,12 @@ template SiSUdocAbstraction() {
main_term = strip(m.captures[1]);
obj_cite_number_offset = to!int(m.captures[2]);
obj_cite_number_endpoint=(obj_cite_number + obj_cite_number_offset);
- obj_cite_numbers ~= (to!string(obj_cite_number) ~ "-" ~ to!string(obj_cite_number_endpoint));
+ obj_cite_numbers ~= (to!string(obj_cite_number) ~ "-" ~ to!string(obj_cite_number_endpoint)
+ ~ ":" ~ segment_anchor_tag);
} else {
main_term = strip(bi_main_term_and_rest[0]);
- obj_cite_numbers ~= to!string(obj_cite_number);
+ obj_cite_numbers ~= to!string(obj_cite_number)
+ ~ ":" ~ segment_anchor_tag;
}
bi[main_term]["_a"] ~= obj_cite_numbers;
obj_cite_numbers=null;
@@ -4143,10 +4169,12 @@ template SiSUdocAbstraction() {
sub_term = strip(m.captures[1]);
obj_cite_number_offset = to!int(m.captures[2]);
obj_cite_number_endpoint=(obj_cite_number + obj_cite_number_offset);
- obj_cite_numbers ~= (to!string(obj_cite_number) ~ " - " ~ to!string(obj_cite_number_endpoint));
+ obj_cite_numbers ~= (to!string(obj_cite_number) ~ " - " ~ to!string(obj_cite_number_endpoint)
+ ~ ":" ~ segment_anchor_tag);
} else {
sub_term = strip(sub_terms_bits);
- obj_cite_numbers ~= to!string(obj_cite_number);
+ obj_cite_numbers ~= to!string(obj_cite_number)
+ ~ ":" ~ segment_anchor_tag;
}
if (!empty(sub_term)) {
bi[main_term][sub_term] ~= obj_cite_numbers;
@@ -4173,13 +4201,13 @@ template SiSUdocAbstraction() {
auto mainkeys=
bookindex_unordered_hashes.byKey.array.sort().release;
foreach (mainkey; mainkeys) {
- debug(bookindex) {
+ debug(bookindex1) {
writeln(mainkey);
}
auto subkeys=
bookindex_unordered_hashes[mainkey].byKey.array.sort().release;
foreach (subkey; subkeys) {
- debug(bookindex) {
+ debug(bookindex1) {
writeln(" ", subkey);
writeln(" ", to!string(
bookindex_unordered_hashes[mainkey][subkey]
@@ -4224,16 +4252,14 @@ template SiSUdocAbstraction() {
++mkn;
}
}
- auto bookindex_build_abstraction_section(BI,N,Ta,B)(
+ auto bookindex_build_abstraction_section(BI,N,B)(
BI bookindex_unordered_hashes,
N obj_cite_number,
- Ta segment_anchor_tag_that_object_belongs_to,
B opt_action_bool,
) {
debug(asserts){
static assert(is(typeof(bookindex_unordered_hashes) == string[][string][string]));
static assert(is(typeof(obj_cite_number) == int));
- static assert(is(typeof(segment_anchor_tag_that_object_belongs_to) == string));
static assert(is(typeof(opt_action_bool) == bool[string]));
}
mixin SiSUnode;
@@ -4251,7 +4277,8 @@ template SiSUdocAbstraction() {
auto node_para_int_ = node_metadata_para_int;
auto node_para_str_ = node_metadata_para_str;
if ((mainkeys.length > 0)
- && (opt_action_bool["backmatter"] && opt_action_bool["section_bookindex"])) {
+ && (opt_action_bool["backmatter"]
+ && opt_action_bool["section_bookindex"])) {
string bi_tmp_seg, bi_tmp_scroll;
string[] bi_tmp_tags;
comp_obj_heading_ = comp_obj_heading_.init;
@@ -4266,6 +4293,7 @@ template SiSUdocAbstraction() {
comp_obj_heading_.heading_lev_collapsed = 1;
comp_obj_heading_.parent_ocn = 1;
comp_obj_heading_.parent_lev_markup = 0;
+ comp_obj_heading.inline_links = true;
bookindex_section["scroll"] ~= comp_obj_heading_;
bookindex_section["seg"] ~= comp_obj_heading_;
++obj_cite_number;
@@ -4283,6 +4311,7 @@ template SiSUdocAbstraction() {
comp_obj_heading_.heading_lev_collapsed = 2;
comp_obj_heading_.parent_ocn = 1;
comp_obj_heading_.parent_lev_markup = 0;
+ comp_obj_heading.inline_links = false;
comp_obj_heading_.anchor_tags = ["bookindex"];
bookindex_section["scroll"] ~= comp_obj_heading_;
bookindex_section["seg"] ~= comp_obj_heading_;
@@ -4297,15 +4326,33 @@ template SiSUdocAbstraction() {
buffer.clear();
bi_tmp_tags ~= translate(mainkey, transTable);
bi_tmp_seg = "!{" ~ mainkey ~ "}! ";
+ auto bkidx_lnk_seg(string locs) {
+ string markup = "";
+ if (auto m = matchFirst(locs, rgx.book_index_go_seg)) {
+ markup =
+ munge.url_links("{ " ~ m["link"] ~ " }"
+ ~ mkup.mark_internal_site_lnk ~ m["seg"] ~ ".fnSuffix"
+ ~ "#" ~ m["ocn"] ~ ", ");
+ } else {
+ writeln(__LINE__, ": ", locs);
+ }
+ return markup;
+ }
+ auto bkidx_lnk_scroll(string locs) {
+ string markup = "";
+ if (auto m = matchFirst(locs, rgx.book_index_go)) {
+ markup =
+ munge.url_links("{ " ~ m["link"] ~ " }"
+ ~ mkup.mark_internal_site_lnk
+ ~ "#" ~ m["ocn"] ~ ", ");
+ } else {
+ writeln(__LINE__, ": ", locs);
+ }
+ return markup;
+ }
foreach (ref_; bookindex_unordered_hashes[mainkey]["_a"]) {
- auto go = replaceAll(ref_, rgx.book_index_go, "$1");
- 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_ ~ "}"
- ~ mkup.mark_internal_site_lnk ~ "../"
- ~ segment_anchor_tag_that_object_belongs_to
- ~ ".fnSuffix#" ~ go ~ ", ");
+ bi_tmp_scroll ~= bkidx_lnk_scroll(ref_);
+ bi_tmp_seg ~= bkidx_lnk_seg(ref_);
}
bi_tmp_scroll ~= " \\\\\n ";
bi_tmp_seg ~= " \\\\\n ";
@@ -4318,21 +4365,15 @@ template SiSUdocAbstraction() {
bi_tmp_tags ~= translate(subkey, transTable);
bi_tmp_seg ~= subkey ~ ", ";
foreach (ref_; bookindex_unordered_hashes[mainkey][subkey]) {
- auto go = replaceAll(ref_, rgx.book_index_go, "$1");
- 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_ ~ "}"
- ~ mkup.mark_internal_site_lnk ~ "../"
- ~ segment_anchor_tag_that_object_belongs_to
- ~ ".fnSuffix#" ~ go ~ ", ");
+ bi_tmp_scroll ~= bkidx_lnk_scroll(ref_);
+ bi_tmp_seg ~= bkidx_lnk_seg(ref_);
}
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, "");
+ bi_tmp_scroll = replaceFirst(bi_tmp_scroll, rgx.trailing_linebreak, "");
+ bi_tmp_seg = replaceFirst(bi_tmp_seg, rgx.trailing_linebreak, "");
comp_obj_para = comp_obj_para.init;
comp_obj_para.use = "backmatter";
comp_obj_para.is_of = "para";
@@ -4344,6 +4385,7 @@ template SiSUdocAbstraction() {
comp_obj_para.indent_hang = 0;
comp_obj_para.indent_base = 1;
comp_obj_para.bullet = false;
+ comp_obj_para.inline_links = true;
bookindex_section["scroll"] ~= comp_obj_para;
comp_obj_para.text = to!string(bi_tmp_seg).strip;
bookindex_section["seg"] ~= comp_obj_para;
@@ -4379,9 +4421,6 @@ template SiSUdocAbstraction() {
int cntr,
)
in {
- // endnotes/ footnotes for
- // doc objects other than paragraphs & headings
- // various forms of grouped text
assert((contents_am[cntr].is_a == "para")
|| (contents_am[cntr].is_a == "heading")
|| (contents_am[cntr].is_a == "group"));
@@ -4405,20 +4444,27 @@ template SiSUdocAbstraction() {
) {
debug(endnotes_build) {
writeln(
- "{^{", m.captures[1], ".}^}" ~ mkup.mark_internal_site_lnk ~ "../", segment_anchor_tag_that_object_belongs_to, ".fnSuffix#noteref_\n ", m.captures[1], " ",
+ "{^{", m.captures[1], ".}^}"
+ ~ mkup.mark_internal_site_lnk,
+ 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["notes"] ~= (segment_anchor_tag_that_object_belongs_to.empty)
? (munge.url_links(
- "{^{" ~ m.captures[1] ~ ".}^}#noteref_" ~
- m.captures[1]) ~ " " ~ m.captures[2] ~ "』"
+ "{^{" ~ m.captures[1] ~ ".}^}#noteref_"
+ ~ m.captures[1]) ~ " "
+ ~ m.captures[2] ~ "』"
)
: (munge.url_links(
- "{^{" ~ m.captures[1] ~ ".}^}" ~ mkup.mark_internal_site_lnk ~ "../" ~
- segment_anchor_tag_that_object_belongs_to ~ ".fnSuffix#noteref_" ~
- m.captures[1]) ~ " " ~ m.captures[2] ~ "』"
+ "{^{" ~ m.captures[1] ~ ".}^}"
+ ~ mkup.mark_internal_site_lnk
+ ~ segment_anchor_tag_that_object_belongs_to
+ ~ ".fnSuffix#noteref_"
+ ~ m.captures[1]) ~ " "
+ ~ m.captures[2] ~ "』"
);
}
return object_notes;
@@ -4517,6 +4563,7 @@ template SiSUdocAbstraction() {
string notenumber = to!string(m.captures[1]);
string anchor_tag = "note_" ~ notenumber;
comp_obj_endnote_.anchor_tags ~= [ endnotes_["anchor"][i] ];
+ comp_obj_endnote_.inline_links = true;
comp_obj_endnote_.text = endnote.strip;
the_endnotes_section ~= comp_obj_endnote_;
}
@@ -4816,7 +4863,7 @@ template SiSUdocAbstraction() {
_comp_obj_heading_ = _comp_obj_heading_.init;
_comp_obj_heading_.use = "body";
_comp_obj_heading_.is_of = "para";
- _comp_obj_heading_.is_a = "heading"; // = is_; // check whether needed, constant???
+ _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);
@@ -4830,6 +4877,9 @@ template SiSUdocAbstraction() {
_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_.inline_notes_reg = flag_notes_reg;
+ _comp_obj_heading_.inline_notes_star = flag_notes_star;
+ _comp_obj_heading_.inline_links = flag_links;
debug(node) {
if (match(lev_markup_number, rgx.levels_numbered_headings)) {
writeln("* ", to!string(_node));