aboutsummaryrefslogtreecommitdiffhomepage
path: root/src
diff options
context:
space:
mode:
authorRalph Amissah <ralph.amissah@gmail.com>2018-10-07 12:12:33 -0400
committerRalph Amissah <ralph.amissah@gmail.com>2019-04-10 15:14:15 -0400
commit60f70c541879cccfd379c7f75ed6aff62e793caf (patch)
tree0914c4410eabe2794d901bc95c2c14363724eebb /src
parentoutput xmls, work on internal links (diff)
xmls segmented heading inline links
Diffstat (limited to 'src')
-rw-r--r--src/doc_reform/meta/metadoc.d8
-rw-r--r--src/doc_reform/meta/metadoc_from_src.d198
-rw-r--r--src/doc_reform/meta/object_setter.d2
-rw-r--r--src/doc_reform/output/epub3.d32
-rw-r--r--src/doc_reform/output/xmls.d60
5 files changed, 191 insertions, 109 deletions
diff --git a/src/doc_reform/meta/metadoc.d b/src/doc_reform/meta/metadoc.d
index 071b166..13502b3 100644
--- a/src/doc_reform/meta/metadoc.d
+++ b/src/doc_reform/meta/metadoc.d
@@ -26,7 +26,7 @@ template DocReformAbstraction() {
mixin outputHub;
enum headBody { header, body_content, insert_file_list, image_list }
enum makeMeta { make, meta }
- enum docAbst { doc_abstraction, section_keys, segnames, segnames_0_4, images }
+ enum docAbst { doc_abstraction, section_keys, segnames, segnames_0_4, tag_assoc, images }
static auto rgx = Rgx();
auto DocReformAbstraction(E,O,M)(
E _env,
@@ -80,11 +80,12 @@ template DocReformAbstraction() {
true,
);
static assert(!isTypeTuple!(da));
- static assert(da.length==5);
+ static assert(da.length==6);
auto doc_abstraction = da[docAbst.doc_abstraction]; /+ head ~ toc ~ body ~ endnotes_seg ~ glossary ~ bibliography ~ bookindex ~ blurb; +/
auto _document_section_keys_sequenced = da[docAbst.section_keys];
string[] _doc_html_segnames = da[docAbst.segnames];
string[] _doc_epub_segnames_0_4 = da[docAbst.segnames_0_4];
+ auto _doc_tag_assoc = da[docAbst.tag_assoc];
auto _images = da[docAbst.images];
debug(steps) {
writeln("- step3 complete");
@@ -159,6 +160,9 @@ template DocReformAbstraction() {
string[] segnames_lv_0_to_4() {
return _doc_epub_segnames_0_4;
}
+ auto tag_associations() {
+ return _doc_tag_assoc;
+ }
}
return XML_();
}
diff --git a/src/doc_reform/meta/metadoc_from_src.d b/src/doc_reform/meta/metadoc_from_src.d
index 7643a42..6d04725 100644
--- a/src/doc_reform/meta/metadoc_from_src.d
+++ b/src/doc_reform/meta/metadoc_from_src.d
@@ -29,8 +29,11 @@ template DocReformDocAbstraction() {
string[string] an_object, processing;
string an_object_key;
string[] anchor_tags;
+ string anchor_tag;
string anchor_tag_;
string segment_anchor_tag_that_object_belongs_to;
+ string lev_anchor_tag;
+ string[][string] tag_assoc;
string segment_anchor_tag_that_object_belongs_to_uri;
/+ enum +/
enum State { off, on }
@@ -234,7 +237,7 @@ template DocReformDocAbstraction() {
/+ node +/
ObjGenericComposite comp_obj_heading, comp_obj_location, comp_obj_block, comp_obj_code, comp_obj_poem_ocn, comp_obj_comment;
auto node_construct = NodeStructureMetadata();
- enum sObj { content, anchor_tags, notes_reg, notes_star, links, image_no_dimensions }
+ enum sObj { content, anchor_tag, notes_reg, notes_star, links, image_no_dimensions }
/+ ↓ abstract marked up document +/
auto DocReformDocAbstraction(Src,CMM,Opt,Mfst)(
Src markup_sourcefile_content,
@@ -336,6 +339,7 @@ template DocReformDocAbstraction() {
comp_obj_heading_.metainfo.object_number_off = "";
comp_obj_heading_.metainfo.object_number_type = 0;
comp_obj_heading_.tags.segment_anchor_tag = "toc";
+ comp_obj_heading_.tags.segment_anchor_tag_is = comp_obj_heading_.tags.segment_anchor_tag;
comp_obj_heading_.metainfo.heading_lev_markup = 4;
comp_obj_heading_.metainfo.heading_lev_collapsed = 1;
comp_obj_heading_.metainfo.parent_ocn = 1;
@@ -475,6 +479,7 @@ template DocReformDocAbstraction() {
comp_obj_heading_.metainfo.object_number_off = "";
comp_obj_heading_.metainfo.object_number_type = 0;
comp_obj_heading_.tags.segment_anchor_tag = "_part_glossary";
+ comp_obj_heading_.tags.segment_anchor_tag_is = comp_obj_heading_.tags.segment_anchor_tag;
comp_obj_heading_.metainfo.heading_lev_markup = 1;
comp_obj_heading_.metainfo.heading_lev_collapsed = 1;
comp_obj_heading_.metainfo.parent_ocn = 1;
@@ -492,6 +497,7 @@ template DocReformDocAbstraction() {
comp_obj_heading_.metainfo.object_number_off = "";
comp_obj_heading_.metainfo.object_number_type = 0;
comp_obj_heading_.tags.segment_anchor_tag = "glossary";
+ comp_obj_heading_.tags.segment_anchor_tag_is = comp_obj_heading_.tags.segment_anchor_tag;
comp_obj_heading_.metainfo.heading_lev_markup = 4;
comp_obj_heading_.metainfo.heading_lev_collapsed = 2;
comp_obj_heading_.metainfo.parent_ocn = 1;
@@ -581,6 +587,7 @@ template DocReformDocAbstraction() {
comp_obj_heading_.metainfo.object_number_off = "";
comp_obj_heading_.metainfo.object_number_type = 0;
comp_obj_heading_.tags.segment_anchor_tag = "_part_blurb";
+ comp_obj_heading_.tags.segment_anchor_tag_is = comp_obj_heading_.tags.segment_anchor_tag;
comp_obj_heading_.metainfo.heading_lev_markup = 1;
comp_obj_heading_.metainfo.heading_lev_collapsed = 1;
comp_obj_heading_.metainfo.parent_ocn = 1;
@@ -598,6 +605,7 @@ template DocReformDocAbstraction() {
comp_obj_heading_.metainfo.object_number_off = "";
comp_obj_heading_.metainfo.object_number_type = 0;
comp_obj_heading_.tags.segment_anchor_tag = "blurb";
+ comp_obj_heading_.tags.segment_anchor_tag_is = comp_obj_heading_.tags.segment_anchor_tag;
comp_obj_heading_.metainfo.heading_lev_markup = 4;
comp_obj_heading_.metainfo.heading_lev_collapsed = 2;
comp_obj_heading_.metainfo.parent_ocn = 1;
@@ -618,6 +626,7 @@ template DocReformDocAbstraction() {
comp_obj_heading_.metainfo.object_number_off = "";
comp_obj_heading_.metainfo.object_number_type = 0;
comp_obj_heading_.tags.segment_anchor_tag = "blurb";
+ comp_obj_heading_.tags.segment_anchor_tag_is = comp_obj_heading_.tags.segment_anchor_tag;
comp_obj_heading_.metainfo.heading_lev_markup = an_object["lev_markup_number"].to!int; // make int, remove need to conv
comp_obj_heading_.metainfo.heading_lev_collapsed = an_object["lev_collapsed_number"].to!int; // make int, remove need to conv
comp_obj_heading_.metainfo.parent_ocn = 1;
@@ -837,7 +846,7 @@ template DocReformDocAbstraction() {
auto substantive_object_and_anchor_tags_tuple
= obj_im.obj_inline_markup_and_anchor_tags_and_misc(an_object, an_object_key, conf_make_meta, _new_doc);
an_object["substantive"] = substantive_object_and_anchor_tags_tuple[sObj.content];
- anchor_tags = substantive_object_and_anchor_tags_tuple[sObj.anchor_tags];
+ anchor_tag = substantive_object_and_anchor_tags_tuple[sObj.anchor_tag];
if (_new_doc) {
cnt1 = 1;
cnt2 = 1;
@@ -846,13 +855,17 @@ template DocReformDocAbstraction() {
}
if (
an_object["lev_markup_number"].to!int == 4
- && anchor_tags.length > 0
+ && !(anchor_tag.empty)
) {
- 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];
+ segment_anchor_tag_that_object_belongs_to = anchor_tag;
+ lev_anchor_tag = anchor_tag;
+ tag_assoc[anchor_tag] = [segment_anchor_tag_that_object_belongs_to];
+ segment_anchor_tag_that_object_belongs_to_uri = anchor_tag ~ ".fnSuffix";
+ anchor_tag_ = anchor_tag;
} else if (an_object["lev_markup_number"].to!int > 4) {
segment_anchor_tag_that_object_belongs_to = anchor_tag_;
+ lev_anchor_tag = anchor_tag;
+ tag_assoc[anchor_tag] = [segment_anchor_tag_that_object_belongs_to];
segment_anchor_tag_that_object_belongs_to_uri = anchor_tag_ ~ ".fnSuffix#" ~ obj_cite_digits.on.to!string;
} else if (an_object["lev_markup_number"].to!int < 4) {
string segn;
@@ -883,7 +896,7 @@ template DocReformDocAbstraction() {
bookindex_unordered_hashes
= bookindex_extract_hash.bookindex_nugget_hash(an_object["bookindex_nugget"], obj_cite_digits, segment_anchor_tag_that_object_belongs_to);
/+ (incrementally build toc) table of contents here! +/
- _anchor_tag=to!string(obj_cite_digits.on);
+ _anchor_tag=obj_cite_digits.on.to!string;
the_table_of_contents_section = obj_im.table_of_contents_gather_headings(
an_object,
conf_make_meta,
@@ -903,6 +916,8 @@ template DocReformDocAbstraction() {
an_object["lev_markup_number"], // string
an_object["lev_collapsed_number"], // string
segment_anchor_tag_that_object_belongs_to, // string
+ lev_anchor_tag, // string
+ tag_assoc,
obj_cite_digits, // OCNset
cntr, // int
heading_ptr, // int
@@ -940,6 +955,8 @@ template DocReformDocAbstraction() {
= node_construct.node_location_emitter(
content_non_header,
segment_anchor_tag_that_object_belongs_to,
+ lev_anchor_tag,
+ tag_assoc,
obj_cite_digits,
cntr,
heading_ptr-1,
@@ -948,14 +965,14 @@ template DocReformDocAbstraction() {
auto substantive_obj_misc_tuple
= obj_im.obj_inline_markup_and_anchor_tags_and_misc(an_object, an_object_key, conf_make_meta, false);
an_object["substantive"] = substantive_obj_misc_tuple[sObj.content];
- anchor_tags = substantive_obj_misc_tuple[sObj.anchor_tags];
+ anchor_tag = substantive_obj_misc_tuple[sObj.anchor_tag];
comp_obj_para = comp_obj_para.init;
comp_obj_para.metainfo.is_of_part = "body";
comp_obj_para.metainfo.is_of_section = "body";
comp_obj_para.metainfo.is_of_type = "para";
comp_obj_para.metainfo.is_a = "para";
comp_obj_para.text = an_object["substantive"].to!string.strip;
- comp_obj_para.tags.segment_anchor_tag = segment_anchor_tag_that_object_belongs_to.to!string; // TODO
+ comp_obj_para.tags.segment_anchor_tag_is = segment_anchor_tag_that_object_belongs_to;
comp_obj_para.metainfo.ocn = obj_cite_digits.digit;
comp_obj_para.metainfo.object_number_off = (obj_cite_digits.off==0) ? "" : obj_cite_digits.off.to!string;
comp_obj_para.metainfo.o_n_book_index = obj_cite_digits.bkidx;
@@ -963,7 +980,7 @@ template DocReformDocAbstraction() {
comp_obj_para.attrib.indent_hang = indent["hang_position"];
comp_obj_para.attrib.indent_base = indent["base_position"];
comp_obj_para.attrib.bullet = bullet;
- comp_obj_para.tags.anchor_tags = anchor_tags;
+ comp_obj_para.tags.anchor_tags = [anchor_tag];
comp_obj_para.has.inline_notes_reg = substantive_obj_misc_tuple[sObj.notes_reg];
comp_obj_para.has.inline_notes_star = substantive_obj_misc_tuple[sObj.notes_star];
comp_obj_para.has.inline_links = substantive_obj_misc_tuple[sObj.links];
@@ -1083,6 +1100,7 @@ template DocReformDocAbstraction() {
comp_obj_heading_.metainfo.object_number_off = "";
comp_obj_heading_.metainfo.object_number_type = 0;
comp_obj_heading_.tags.segment_anchor_tag = "_part_bibliography";
+ comp_obj_heading_.tags.segment_anchor_tag_is = comp_obj_heading_.tags.segment_anchor_tag;
comp_obj_heading_.metainfo.heading_lev_markup = 1;
comp_obj_heading_.metainfo.heading_lev_collapsed = 1;
comp_obj_heading_.metainfo.parent_ocn = 1;
@@ -1098,6 +1116,7 @@ template DocReformDocAbstraction() {
comp_obj_heading_.metainfo.object_number_off = "";
comp_obj_heading_.metainfo.object_number_type = 0;
comp_obj_heading_.tags.segment_anchor_tag = "bibliography";
+ comp_obj_heading_.tags.segment_anchor_tag_is = comp_obj_heading_.tags.segment_anchor_tag;
comp_obj_heading_.metainfo.heading_lev_markup = 4;
comp_obj_heading_.metainfo.heading_lev_collapsed = 2;
comp_obj_heading_.metainfo.parent_ocn = 1;
@@ -1148,7 +1167,7 @@ template DocReformDocAbstraction() {
comp_obj_para.attrib.indent_hang = 0;
comp_obj_para.attrib.indent_base = 1;
comp_obj_para.attrib.bullet = bullet;
- comp_obj_para.tags.anchor_tags = anchor_tags;
+ comp_obj_para.tags.anchor_tags = [anchor_tag];
the_bibliography_section ~= comp_obj_para;
}
debug(bibliosection) {
@@ -1183,6 +1202,7 @@ template DocReformDocAbstraction() {
comp_obj_para.metainfo.object_number_off = "";
comp_obj_para.metainfo.object_number_type = 0;
comp_obj_heading_.tags.segment_anchor_tag = "";
+ comp_obj_heading_.tags.segment_anchor_tag_is = comp_obj_heading_.tags.segment_anchor_tag;
comp_obj_heading_.metainfo.heading_lev_markup = 1;
comp_obj_heading_.metainfo.heading_lev_collapsed = 1;
comp_obj_heading_.metainfo.parent_ocn = 1;
@@ -1214,7 +1234,7 @@ template DocReformDocAbstraction() {
"{ %s }%s%s%s",
"Endnotes",
mkup.mark_internal_site_lnk,
- "endnotes", // segment_anchor_tag_that_object_belongs_to
+ "endnotes",
".fnSuffix",
);
toc_txt_= munge.url_links(toc_txt_);
@@ -1227,7 +1247,7 @@ template DocReformDocAbstraction() {
"{ %s }%s%s%s",
"Glossary",
mkup.mark_internal_site_lnk,
- "glossary", // segment_anchor_tag_that_object_belongs_to
+ "glossary",
".fnSuffix",
);
toc_txt_= munge.url_links(toc_txt_);
@@ -1249,7 +1269,7 @@ template DocReformDocAbstraction() {
"{ %s }%s%s%s",
"Bibliography",
mkup.mark_internal_site_lnk,
- "bibliography", // segment_anchor_tag_that_object_belongs_to
+ "bibliography",
".fnSuffix",
);
toc_txt_= munge.url_links(toc_txt_);
@@ -1272,7 +1292,7 @@ template DocReformDocAbstraction() {
"{ %s }%s%s%s",
"Book Index",
mkup.mark_internal_site_lnk,
- "bookindex", // segment_anchor_tag_that_object_belongs_to
+ "bookindex",
".fnSuffix",
);
toc_txt_= munge.url_links(toc_txt_);
@@ -1296,7 +1316,7 @@ template DocReformDocAbstraction() {
"{ %s }%s%s%s",
"Blurb",
mkup.mark_internal_site_lnk,
- "blurb", // segment_anchor_tag_that_object_belongs_to
+ "blurb",
".fnSuffix",
);
toc_txt_= munge.url_links(toc_txt_);
@@ -1659,7 +1679,7 @@ template DocReformDocAbstraction() {
}
return images_;
}
- string[] segnames_0_4;
+ string[] segnames_lv0_to_4;
auto _image_dimensions(M,O)(M manifest_matter, O obj) {
if (obj.has.contains_image_without_dimensions) {
import std.math;
@@ -1700,7 +1720,7 @@ template DocReformDocAbstraction() {
writeln(obj.text);
}
if (obj.metainfo.heading_lev_markup <= 4) {
- segnames_0_4 ~= obj.tags.segment_anchor_tag;
+ segnames_lv0_to_4 ~= obj.tags.segment_anchor_tag;
}
if (obj.metainfo.heading_lev_markup == 0) {
/+ TODO second hit (of two) with same assertion failure, check, fix and reinstate
@@ -1730,7 +1750,7 @@ template DocReformDocAbstraction() {
foreach (ref obj; the_table_of_contents_section["scroll"]) {
if (obj.metainfo.is_a == "heading") {
if (obj.metainfo.heading_lev_markup <= 4) {
- segnames_0_4 ~= obj.tags.segment_anchor_tag;
+ segnames_lv0_to_4 ~= obj.tags.segment_anchor_tag;
if (obj.metainfo.heading_lev_markup == 4) {
obj.tags.segname_next = html_segnames[obj.ptr.html_segnames + 1];
assert(obj.tags.segment_anchor_tag == html_segnames[obj.ptr.html_segnames],
@@ -1759,7 +1779,7 @@ template DocReformDocAbstraction() {
writeln(obj.text);
}
if (obj.metainfo.heading_lev_markup <= 4) {
- segnames_0_4 ~= obj.tags.segment_anchor_tag;
+ segnames_lv0_to_4 ~= obj.tags.segment_anchor_tag;
if (obj.metainfo.heading_lev_markup == 4) {
obj.tags.segname_next = html_segnames[obj.ptr.html_segnames + 1];
assert(obj.tags.segment_anchor_tag == html_segnames[obj.ptr.html_segnames],
@@ -1785,7 +1805,7 @@ template DocReformDocAbstraction() {
writeln(obj.text);
}
if (obj.metainfo.heading_lev_markup <= 4) {
- segnames_0_4 ~= obj.tags.segment_anchor_tag;
+ segnames_lv0_to_4 ~= obj.tags.segment_anchor_tag;
if (obj.metainfo.heading_lev_markup == 4) {
obj.tags.lev4_subtoc = lev4_subtoc[obj.tags.segment_anchor_tag];
obj.tags.segname_prev = html_segnames[obj.ptr.html_segnames - 1];
@@ -1828,7 +1848,7 @@ template DocReformDocAbstraction() {
obj_cite_digits = ocn_emit(OCNstatus.on);
obj.metainfo.ocn = obj_cite_digits.digit;
if (obj.metainfo.heading_lev_markup <= 4) {
- segnames_0_4 ~= obj.tags.segment_anchor_tag;
+ segnames_lv0_to_4 ~= obj.tags.segment_anchor_tag;
if (obj.metainfo.heading_lev_markup == 4) {
obj.tags.segname_prev = html_segnames[obj.ptr.html_segnames - 1];
if (html_segnames.length > obj.ptr.html_segnames + 1) {
@@ -1862,7 +1882,7 @@ template DocReformDocAbstraction() {
obj_cite_digits = ocn_emit(OCNstatus.on);
obj.metainfo.ocn = obj_cite_digits.digit;
if (obj.metainfo.heading_lev_markup <= 4) {
- segnames_0_4 ~= obj.tags.segment_anchor_tag;
+ segnames_lv0_to_4 ~= obj.tags.segment_anchor_tag;
if (obj.metainfo.heading_lev_markup == 4) {
obj.tags.segname_prev = html_segnames[obj.ptr.html_segnames - 1];
if (html_segnames.length > obj.ptr.html_segnames + 1) {
@@ -1899,7 +1919,7 @@ template DocReformDocAbstraction() {
obj_cite_digits = ocn_emit(OCNstatus.on);
obj.metainfo.ocn = obj_cite_digits.digit;
if (obj.metainfo.heading_lev_markup <= 4) {
- segnames_0_4 ~= obj.tags.segment_anchor_tag;
+ segnames_lv0_to_4 ~= obj.tags.segment_anchor_tag;
if (obj.metainfo.heading_lev_markup == 4) {
obj.tags.segname_prev = html_segnames[obj.ptr.html_segnames - 1];
if (html_segnames.length > obj.ptr.html_segnames + 1) {
@@ -1941,7 +1961,7 @@ template DocReformDocAbstraction() {
obj_cite_digits = ocn_emit(OCNstatus.on);
obj.metainfo.ocn = obj_cite_digits.on;
if (obj.metainfo.heading_lev_markup <= 4) {
- segnames_0_4 ~= obj.tags.segment_anchor_tag;
+ segnames_lv0_to_4 ~= obj.tags.segment_anchor_tag;
if (obj.metainfo.heading_lev_markup == 4) {
obj.tags.segname_prev = html_segnames[obj.ptr.html_segnames - 1];
if (html_segnames.length > obj.ptr.html_segnames + 1) {
@@ -1979,7 +1999,7 @@ template DocReformDocAbstraction() {
}
obj.metainfo.ocn = ++ocn_;
if (obj.metainfo.heading_lev_markup <= 4) {
- segnames_0_4 ~= obj.tags.segment_anchor_tag;
+ segnames_lv0_to_4 ~= obj.tags.segment_anchor_tag;
if (obj.metainfo.heading_lev_markup == 4) {
obj.tags.segname_prev = html_segnames[obj.ptr.html_segnames - 1];
if (html_segnames.length > obj.ptr.html_segnames + 1) {
@@ -2021,7 +2041,7 @@ template DocReformDocAbstraction() {
obj_cite_digits = ocn_emit(OCNstatus.on);
obj.metainfo.ocn = obj_cite_digits.on;
if (obj.metainfo.heading_lev_markup <= 4) {
- segnames_0_4 ~= obj.tags.segment_anchor_tag;
+ segnames_lv0_to_4 ~= obj.tags.segment_anchor_tag;
if (obj.metainfo.heading_lev_markup == 4) {
obj.tags.segname_prev = html_segnames[obj.ptr.html_segnames - 1];
if (html_segnames.length > obj.ptr.html_segnames + 1) {
@@ -2221,7 +2241,7 @@ template DocReformDocAbstraction() {
document_section_keys_sequenced["scroll"] ~= "tail";
}
auto sequenced_document_keys = docSectKeysSeq!()(document_section_keys_sequenced);
- auto segnames = html_segnames.dup;
+ auto segnames_lv4 = html_segnames.dup;
destroy(the_document_head_section);
destroy(the_table_of_contents_section);
destroy(the_document_body_section);
@@ -2290,8 +2310,9 @@ template DocReformDocAbstraction() {
auto t = tuple(
document_the,
sequenced_document_keys,
- segnames,
- segnames_0_4,
+ segnames_lv4,
+ segnames_lv0_to_4,
+ tag_assoc,
images,
);
return t;
@@ -2766,7 +2787,7 @@ template DocReformDocAbstraction() {
auto substantive_obj_misc_tuple
= obj_im.obj_inline_markup_and_anchor_tags_and_misc(an_object, an_object_key, conf_make_meta, false);
an_object["substantive"] = substantive_obj_misc_tuple[sObj.content];
- anchor_tags = substantive_obj_misc_tuple[sObj.anchor_tags];
+ anchor_tag = substantive_obj_misc_tuple[sObj.anchor_tag];
comp_obj_block = comp_obj_block.init;
comp_obj_block.metainfo.is_of_part = "body";
comp_obj_block.metainfo.is_of_section = "body";
@@ -2774,7 +2795,7 @@ template DocReformDocAbstraction() {
comp_obj_block.metainfo.is_a = "verse";
comp_obj_block.metainfo.ocn = obj_cite_digits.on;
comp_obj_block.metainfo.object_number_off = (obj_cite_digits.off==0) ? "" : obj_cite_digits.off.to!string;
- comp_obj_block.tags.segment_anchor_tag = segment_anchor_tag_that_object_belongs_to.to!string; // TODO
+ comp_obj_block.tags.segment_anchor_tag_is = segment_anchor_tag_that_object_belongs_to;
comp_obj_block.metainfo.o_n_book_index = obj_cite_digits.bkidx;
comp_obj_block.metainfo.object_number_type = obj_cite_digits.type;
comp_obj_block.text = an_object["substantive"];
@@ -2816,6 +2837,8 @@ template DocReformDocAbstraction() {
auto comp_obj_location = node_construct.node_location_emitter(
content_non_header,
segment_anchor_tag_that_object_belongs_to,
+ lev_anchor_tag,
+ tag_assoc,
obj_cite_digits,
cntr,
heading_ptr-1,
@@ -2824,7 +2847,7 @@ template DocReformDocAbstraction() {
auto substantive_obj_misc_tuple
= obj_im.obj_inline_markup_and_anchor_tags_and_misc(an_object, an_object_key, conf_make_meta, false);
an_object["substantive"] = substantive_obj_misc_tuple[sObj.content];
- anchor_tags = substantive_obj_misc_tuple[sObj.anchor_tags];
+ anchor_tag = substantive_obj_misc_tuple[sObj.anchor_tag];
comp_obj_block = comp_obj_block.init;
comp_obj_block.metainfo.is_of_part = "body";
comp_obj_block.metainfo.is_of_section = "body";
@@ -2832,7 +2855,7 @@ template DocReformDocAbstraction() {
comp_obj_block.metainfo.is_a = "verse";
comp_obj_block.metainfo.ocn = obj_cite_digits.on;
comp_obj_block.metainfo.object_number_off = (obj_cite_digits.off==0) ? "" : obj_cite_digits.off.to!string;
- comp_obj_block.tags.segment_anchor_tag = segment_anchor_tag_that_object_belongs_to.to!string; // TODO
+ comp_obj_block.tags.segment_anchor_tag_is = segment_anchor_tag_that_object_belongs_to;
comp_obj_block.metainfo.o_n_book_index = obj_cite_digits.bkidx;
comp_obj_block.metainfo.object_number_type = obj_cite_digits.type;
comp_obj_block.text = an_object["substantive"];
@@ -2867,7 +2890,7 @@ template DocReformDocAbstraction() {
auto substantive_obj_misc_tuple
= obj_im.obj_inline_markup_and_anchor_tags_and_misc(an_object, an_object_key, conf_make_meta, false);
an_object["substantive"] = substantive_obj_misc_tuple[sObj.content];
- anchor_tags = substantive_obj_misc_tuple[sObj.anchor_tags];
+ anchor_tag = substantive_obj_misc_tuple[sObj.anchor_tag];
comp_obj_block = comp_obj_block.init;
comp_obj_block.metainfo.is_of_part = "body";
comp_obj_block.metainfo.is_of_section = "body";
@@ -2875,7 +2898,7 @@ template DocReformDocAbstraction() {
comp_obj_block.metainfo.is_a = "verse";
comp_obj_block.metainfo.ocn = obj_cite_digits.on;
comp_obj_block.metainfo.object_number_off = (obj_cite_digits.off==0) ? "" : obj_cite_digits.off.to!string;
- comp_obj_block.tags.segment_anchor_tag = segment_anchor_tag_that_object_belongs_to.to!string; // TODO
+ comp_obj_block.tags.segment_anchor_tag_is = segment_anchor_tag_that_object_belongs_to;
comp_obj_block.metainfo.o_n_book_index = obj_cite_digits.bkidx;
comp_obj_block.metainfo.object_number_type = obj_cite_digits.type;
comp_obj_block.text = an_object["substantive"];
@@ -2917,6 +2940,8 @@ template DocReformDocAbstraction() {
= node_construct.node_location_emitter(
content_non_header,
segment_anchor_tag_that_object_belongs_to,
+ lev_anchor_tag,
+ tag_assoc,
obj_cite_digits,
cntr,
heading_ptr-1,
@@ -2925,7 +2950,7 @@ template DocReformDocAbstraction() {
auto substantive_obj_misc_tuple
= obj_im.obj_inline_markup_and_anchor_tags_and_misc(an_object, an_object_key, conf_make_meta, false);
an_object["substantive"] = substantive_obj_misc_tuple[sObj.content];
- anchor_tags = substantive_obj_misc_tuple[sObj.anchor_tags];
+ anchor_tag = substantive_obj_misc_tuple[sObj.anchor_tag];
comp_obj_block = comp_obj_block.init;
comp_obj_block.metainfo.is_of_part = "body";
comp_obj_block.metainfo.is_of_section = "body";
@@ -2933,7 +2958,7 @@ template DocReformDocAbstraction() {
comp_obj_block.metainfo.is_a = "verse";
comp_obj_block.metainfo.ocn = obj_cite_digits.on;
comp_obj_block.metainfo.object_number_off = (obj_cite_digits.off==0) ? "" : obj_cite_digits.off.to!string;
- comp_obj_block.tags.segment_anchor_tag = segment_anchor_tag_that_object_belongs_to.to!string; // TODO
+ comp_obj_block.tags.segment_anchor_tag_is = segment_anchor_tag_that_object_belongs_to;
comp_obj_block.metainfo.o_n_book_index = obj_cite_digits.bkidx;
comp_obj_block.metainfo.object_number_type = obj_cite_digits.type;
comp_obj_block.text = an_object["substantive"];
@@ -3218,6 +3243,8 @@ template DocReformDocAbstraction() {
= node_construct.node_location_emitter(
content_non_header,
segment_anchor_tag_that_object_belongs_to,
+ lev_anchor_tag,
+ tag_assoc,
obj_cite_digits,
cntr,
heading_ptr-1,
@@ -3229,7 +3256,7 @@ template DocReformDocAbstraction() {
an_object["substantive"] = substantive_obj_misc_tuple[sObj.content];
comp_obj_block.metainfo.ocn = obj_cite_digits.on;
comp_obj_block.metainfo.object_number_off = (obj_cite_digits.off==0) ? "" : obj_cite_digits.off.to!string;
- comp_obj_block.tags.segment_anchor_tag = segment_anchor_tag_that_object_belongs_to.to!string; // TODO
+ comp_obj_block.tags.segment_anchor_tag_is = segment_anchor_tag_that_object_belongs_to;
comp_obj_block.metainfo.o_n_book_index = obj_cite_digits.bkidx;
comp_obj_block.metainfo.object_number_type = obj_cite_digits.type;
comp_obj_block = table_instructions(comp_obj_block, an_object["table_head"]);
@@ -3278,6 +3305,8 @@ template DocReformDocAbstraction() {
= node_construct.node_location_emitter(
content_non_header,
segment_anchor_tag_that_object_belongs_to,
+ lev_anchor_tag,
+ tag_assoc,
obj_cite_digits,
cntr,
heading_ptr-1,
@@ -3286,7 +3315,7 @@ template DocReformDocAbstraction() {
auto substantive_obj_misc_tuple
= obj_im.obj_inline_markup_and_anchor_tags_and_misc(an_object, an_object_key, conf_make_meta, false);
an_object["substantive"] = substantive_obj_misc_tuple[sObj.content];
- anchor_tags = substantive_obj_misc_tuple[sObj.anchor_tags];
+ anchor_tag = substantive_obj_misc_tuple[sObj.anchor_tag];
comp_obj_block = comp_obj_block.init;
comp_obj_block.metainfo.is_of_part = "body";
comp_obj_block.metainfo.is_of_section = "body";
@@ -3294,7 +3323,7 @@ template DocReformDocAbstraction() {
comp_obj_block.metainfo.is_a = "quote";
comp_obj_block.metainfo.ocn = obj_cite_digits.on;
comp_obj_block.metainfo.object_number_off = (obj_cite_digits.off==0) ? "" : obj_cite_digits.off.to!string;
- comp_obj_block.tags.segment_anchor_tag = segment_anchor_tag_that_object_belongs_to.to!string; // TODO
+ comp_obj_block.tags.segment_anchor_tag_is = segment_anchor_tag_that_object_belongs_to;
comp_obj_block.metainfo.o_n_book_index = obj_cite_digits.bkidx;
comp_obj_block.metainfo.object_number_type = obj_cite_digit_type;
comp_obj_block.text = an_object["substantive"];
@@ -3322,6 +3351,8 @@ template DocReformDocAbstraction() {
= node_construct.node_location_emitter(
content_non_header,
segment_anchor_tag_that_object_belongs_to,
+ lev_anchor_tag,
+ tag_assoc,
obj_cite_digits,
cntr,
heading_ptr-1,
@@ -3330,7 +3361,7 @@ template DocReformDocAbstraction() {
auto substantive_obj_misc_tuple
= obj_im.obj_inline_markup_and_anchor_tags_and_misc(an_object, an_object_key, conf_make_meta, false);
an_object["substantive"] = substantive_obj_misc_tuple[sObj.content];
- anchor_tags = substantive_obj_misc_tuple[sObj.anchor_tags];
+ anchor_tag = substantive_obj_misc_tuple[sObj.anchor_tag];
comp_obj_block = comp_obj_block.init;
comp_obj_block.metainfo.is_of_part = "body";
comp_obj_block.metainfo.is_of_section = "body";
@@ -3338,7 +3369,7 @@ template DocReformDocAbstraction() {
comp_obj_block.metainfo.is_a = "group";
comp_obj_block.metainfo.ocn = obj_cite_digits.on;
comp_obj_block.metainfo.object_number_off = (obj_cite_digits.off==0) ? "" : obj_cite_digits.off.to!string;
- comp_obj_block.tags.segment_anchor_tag = segment_anchor_tag_that_object_belongs_to.to!string; // TODO
+ comp_obj_block.tags.segment_anchor_tag_is = segment_anchor_tag_that_object_belongs_to;
comp_obj_block.metainfo.o_n_book_index = obj_cite_digits.bkidx;
comp_obj_block.metainfo.object_number_type = obj_cite_digits.type;
comp_obj_block.text = an_object["substantive"];
@@ -3366,6 +3397,8 @@ template DocReformDocAbstraction() {
= node_construct.node_location_emitter(
content_non_header,
segment_anchor_tag_that_object_belongs_to,
+ lev_anchor_tag,
+ tag_assoc,
obj_cite_digits,
cntr,
heading_ptr-1,
@@ -3381,7 +3414,7 @@ template DocReformDocAbstraction() {
comp_obj_block.metainfo.is_a = "block";
comp_obj_block.metainfo.ocn = obj_cite_digits.on;
comp_obj_block.metainfo.object_number_off = (obj_cite_digits.off==0) ? "" : obj_cite_digits.off.to!string;
- comp_obj_block.tags.segment_anchor_tag = segment_anchor_tag_that_object_belongs_to.to!string; // TODO
+ comp_obj_block.tags.segment_anchor_tag_is = segment_anchor_tag_that_object_belongs_to;
comp_obj_block.metainfo.o_n_book_index = obj_cite_digits.bkidx;
comp_obj_block.metainfo.object_number_type = obj_cite_digit_type;
comp_obj_block.text = an_object["substantive"];
@@ -3408,6 +3441,8 @@ template DocReformDocAbstraction() {
= node_construct.node_location_emitter(
content_non_header,
segment_anchor_tag_that_object_belongs_to,
+ lev_anchor_tag,
+ tag_assoc,
obj_cite_digits,
cntr,
heading_ptr-1,
@@ -3443,6 +3478,8 @@ template DocReformDocAbstraction() {
= node_construct.node_location_emitter(
content_non_header,
segment_anchor_tag_that_object_belongs_to,
+ lev_anchor_tag,
+ tag_assoc,
obj_cite_digits,
cntr,
heading_ptr-1,
@@ -3451,7 +3488,7 @@ template DocReformDocAbstraction() {
auto substantive_obj_misc_tuple
= obj_im.obj_inline_markup_and_anchor_tags_and_misc(an_object, an_object_key, conf_make_meta, false);
an_object["substantive"] = substantive_obj_misc_tuple[sObj.content];
- anchor_tags = substantive_obj_misc_tuple[sObj.anchor_tags];
+ anchor_tag = substantive_obj_misc_tuple[sObj.anchor_tag];
comp_obj_code = comp_obj_code.init;
comp_obj_code.metainfo.is_of_part = "body";
comp_obj_code.metainfo.is_of_section = "body";
@@ -3459,7 +3496,7 @@ template DocReformDocAbstraction() {
comp_obj_code.metainfo.is_a = "code";
comp_obj_code.metainfo.ocn = obj_cite_digits.on;
comp_obj_code.metainfo.object_number_off = (obj_cite_digits.off==0) ? "" : obj_cite_digits.off.to!string;
- comp_obj_code.tags.segment_anchor_tag = segment_anchor_tag_that_object_belongs_to.to!string;
+ comp_obj_code.tags.segment_anchor_tag_is = segment_anchor_tag_that_object_belongs_to;
comp_obj_code.metainfo.o_n_book_index = obj_cite_digits.bkidx;
comp_obj_code.metainfo.object_number_type = obj_cite_digits.type;
comp_obj_code.text = an_object["substantive"];
@@ -3488,6 +3525,8 @@ template DocReformDocAbstraction() {
= node_construct.node_location_emitter(
content_non_header,
segment_anchor_tag_that_object_belongs_to,
+ lev_anchor_tag,
+ tag_assoc,
obj_cite_digits,
cntr,
heading_ptr-1,
@@ -3499,7 +3538,7 @@ template DocReformDocAbstraction() {
comp_obj_block = comp_obj_block.init;
comp_obj_block.metainfo.ocn = obj_cite_digits.on;
comp_obj_block.metainfo.object_number_off = (obj_cite_digits.off==0) ? "" : obj_cite_digits.off.to!string;
- comp_obj_block.tags.segment_anchor_tag = segment_anchor_tag_that_object_belongs_to.to!string; // TODO
+ comp_obj_block.tags.segment_anchor_tag_is = segment_anchor_tag_that_object_belongs_to;
comp_obj_block.metainfo.o_n_book_index = obj_cite_digits.bkidx;
comp_obj_block.metainfo.object_number_type = obj_cite_digits.type;
comp_obj_block = table_instructions(comp_obj_block, an_object["table_head"]);
@@ -4345,7 +4384,7 @@ template DocReformDocAbstraction() {
n_foot=n_foot_reg;
obj_txt_out ~= n.hit.to!string.replaceFirst(
rgx.inline_al_delimiter_open_regular,
- (mkup.en_a_o ~ to!string(n_foot) ~ " ")
+ (mkup.en_a_o ~ n_foot.to!string ~ " ")
) ~ "\n";
} else {
obj_txt_out ~= n.hit.to!string ~ "\n";
@@ -4557,7 +4596,6 @@ template DocReformDocAbstraction() {
static auto rgx = Rgx();
static auto munge = ObjInlineMarkupMunge();
string[string] obj_txt;
- static string[] anchor_tags_ = [];
static string anchor_tag = "";
auto obj_inline_markup_and_anchor_tags_and_misc(O,K,CMM)(
O obj_,
@@ -4577,7 +4615,7 @@ template DocReformDocAbstraction() {
? obj_txt["munge"]
: obj_txt["munge"].strip;
if (_new_doc) {
- anchor_tags_ = [];
+ anchor_tag = "";
}
auto x = munge.init;
bool[string] obj_notes_and_links;
@@ -4594,7 +4632,6 @@ template DocReformDocAbstraction() {
obj_txt["munge"]=_make_segment_anchor_tags_if_none_provided(obj_txt["munge"], obj_["lev"], _new_doc);
if (auto m = obj_txt["munge"].match(rgx.heading_anchor_tag)) {
anchor_tag = m.captures[1];
- anchor_tags_ ~= anchor_tag;
} else if (obj_["lev"] == "1") {
writeln("heading anchor tag missing: ", obj_txt["munge"]);
}
@@ -4640,13 +4677,13 @@ template DocReformDocAbstraction() {
}
auto t = tuple(
obj_txt["munge"],
- anchor_tags_,
+ anchor_tag,
obj_notes_and_links["notes_reg"],
obj_notes_and_links["notes_star"],
obj_notes_and_links["links"],
obj_notes_and_links["image_no_dimensions"],
);
- anchor_tags_=[];
+ anchor_tag = "";
return t;
}
invariant() {
@@ -4957,7 +4994,8 @@ template DocReformDocAbstraction() {
rgx.heading_marker_missing_tag,
"$1~" ~ m.captures[1].toLower ~ "_" ~ m.captures[2] ~ " ");
if (auto n = munge_.match(rgx.heading_anchor_tag_plus_colon)) {
- auto tag_remunge_ = n.captures[2].replaceAll(rgx.heading_marker_tag_has_colon, "..");
+ auto tag_remunge_ = n.captures[2]
+ .replaceAll(rgx.heading_marker_tag_has_colon, "..");
munge_=(munge_).replaceFirst(rgx.heading_anchor_tag_plus_colon, n.captures[1] ~ tag_remunge_ ~ " ");
}
} else if (auto m = munge_.match(rgx.heading_extract_unnamed_anchor_tag)) {
@@ -5322,7 +5360,8 @@ template DocReformDocAbstraction() {
main_term = m.captures[1].strip;
object_number_offset = m.captures[2].to!int;
object_number_endpoint=(obj_cite_digits.on + object_number_offset);
- object_numbers ~= (obj_cite_digits.on.to!string ~ "-" ~ to!string(object_number_endpoint)
+ object_numbers ~= (obj_cite_digits.on.to!string
+ ~ "-" ~ object_number_endpoint.to!string
~ ":" ~ segment_anchor_tag);
} else {
main_term = bi_main_term_and_rest[0].strip;
@@ -5341,11 +5380,12 @@ template DocReformDocAbstraction() {
sub_term = m.captures[1].strip;
object_number_offset = m.captures[2].to!int;
object_number_endpoint=(obj_cite_digits.on + object_number_offset);
- object_numbers ~= (obj_cite_digits.on.to!string ~ " - " ~ to!string(object_number_endpoint)
+ object_numbers ~= (obj_cite_digits.on.to!string
+ ~ " - " ~ object_number_endpoint.to!string
~ ":" ~ segment_anchor_tag);
} else {
sub_term = sub_terms_bits.strip;
- object_numbers ~= to!string(obj_cite_digits.on)
+ object_numbers ~= obj_cite_digits.on.to!string
~ ":" ~ segment_anchor_tag;
}
if (!empty(sub_term)) {
@@ -5462,6 +5502,7 @@ template DocReformDocAbstraction() {
comp_obj_heading_.metainfo.object_number_off = "";
comp_obj_heading_.metainfo.object_number_type = 0;
comp_obj_heading_.tags.segment_anchor_tag = "_part_book_index";
+ comp_obj_heading_.tags.segment_anchor_tag_is = comp_obj_heading_.tags.segment_anchor_tag;
comp_obj_heading_.metainfo.heading_lev_markup = 1;
comp_obj_heading_.metainfo.heading_lev_collapsed = 1;
comp_obj_heading_.metainfo.parent_ocn = 1;
@@ -5480,6 +5521,7 @@ template DocReformDocAbstraction() {
comp_obj_heading_.metainfo.object_number_off = "";
comp_obj_heading_.metainfo.object_number_type = 0;
comp_obj_heading_.tags.segment_anchor_tag = "bookindex";
+ comp_obj_heading_.tags.segment_anchor_tag_is = comp_obj_heading_.tags.segment_anchor_tag;
comp_obj_heading_.metainfo.heading_lev_markup = 4;
comp_obj_heading_.metainfo.heading_lev_collapsed = 2;
comp_obj_heading_.metainfo.parent_ocn = 1;
@@ -5685,6 +5727,7 @@ template DocReformDocAbstraction() {
comp_obj_heading_.metainfo.object_number_off = "";
comp_obj_heading_.metainfo.object_number_type = 0;
comp_obj_heading_.tags.segment_anchor_tag = "_part_endnotes";
+ comp_obj_heading_.tags.segment_anchor_tag_is = comp_obj_heading_.tags.segment_anchor_tag;
comp_obj_heading_.metainfo.heading_lev_markup = 1;
comp_obj_heading_.metainfo.heading_lev_collapsed = 1;
comp_obj_heading_.metainfo.parent_ocn = 1;
@@ -5701,6 +5744,7 @@ template DocReformDocAbstraction() {
comp_obj_heading_.metainfo.object_number_off = "";
comp_obj_heading_.metainfo.object_number_type = 0;
comp_obj_heading_.tags.segment_anchor_tag = "endnotes";
+ comp_obj_heading_.tags.segment_anchor_tag_is = comp_obj_heading_.tags.segment_anchor_tag;
comp_obj_heading_.metainfo.heading_lev_markup = 4;
comp_obj_heading_.metainfo.heading_lev_collapsed = 2;
comp_obj_heading_.metainfo.parent_ocn = 1;
@@ -5857,9 +5901,11 @@ template DocReformDocAbstraction() {
int obj_cite_digit;
int[string] p_; // p_ parent_
static auto rgx = Rgx();
- ObjGenericComposite node_location_emitter(Lv,Ta,N,C,P,I)(
+ ObjGenericComposite node_location_emitter(Lv,Tg,La,Ta,N,C,P,I)(
Lv lev_markup_number,
- Ta segment_anchor_tag,
+ Tg segment_anchor_tag,
+ La lev_anchor_tag,
+ Ta tag_assoc,
N obj_cite_digits,
C cntr_,
P ptr_,
@@ -5898,6 +5944,8 @@ template DocReformDocAbstraction() {
comp_obj_location.metainfo.is_a = is_;
comp_obj_location.metainfo.ocn = obj_cite_digits.on;
comp_obj_location.tags.segment_anchor_tag = segment_anchor_tag.to!string;
+ comp_obj_location.tags.segment_anchor_tag_is = comp_obj_location.tags.segment_anchor_tag;
+ comp_obj_location.tags.heading_lev_anchor_tag = lev_anchor_tag;
comp_obj_location.metainfo.parent_ocn = p_["object_number"];
comp_obj_location.metainfo.parent_lev_markup = p_["lev_markup_number"];
debug(_node) {
@@ -5914,11 +5962,13 @@ template DocReformDocAbstraction() {
}
invariant() {
}
- ObjGenericComposite node_emitter_heading(T,Lm,Lc,Ta,N,C,P,LA,I,PSn,fNr,fNs,fL)(
+ ObjGenericComposite node_emitter_heading(T,Lm,Lc,TaB,TaL,TA,N,C,P,LA,I,PSn,fNr,fNs,fL)(
T _text,
Lm lev_markup_number,
Lc lev_collapsed_number,
- Ta segment_anchor_tag,
+ TaB segment_anchor_tag_that_object_belongs_to,
+ TaL lev_anchor_tag,
+ TA tag_assoc,
N obj_cite_digits,
C cntr_,
P ptr_,
@@ -5931,17 +5981,17 @@ template DocReformDocAbstraction() {
)
in {
debug(asserts) {
- static assert(is(typeof(_text) == string));
- static assert(is(typeof(lev) == string));
- static assert(is(typeof(lev_markup_number) == string));
- static assert(is(typeof(lev_collapsed_number) == string));
- static assert(is(typeof(segment_anchor_tag) == string));
- static assert(is(typeof(obj_cite_digits.on) == int));
- static assert(is(typeof(cntr_) == int));
- static assert(is(typeof(ptr_) == int));
- static assert(is(typeof(lv_ancestors_txt) == string[]));
- static assert(is(typeof(is_) == string));
- static assert(is(typeof(html_segnames_ptr) == int));
+ static assert(is(typeof(_text) == string));
+ static assert(is(typeof(lev) == string));
+ static assert(is(typeof(lev_markup_number) == string));
+ static assert(is(typeof(lev_collapsed_number) == string));
+ static assert(is(typeof(segment_anchor_tag_that_object_belongs_to) == string));
+ static assert(is(typeof(obj_cite_digits.on) == int));
+ static assert(is(typeof(cntr_) == int));
+ static assert(is(typeof(ptr_) == int));
+ static assert(is(typeof(lv_ancestors_txt) == string[]));
+ static assert(is(typeof(is_) == string));
+ static assert(is(typeof(html_segnames_ptr) == int));
}
assert(is_ == "heading");
assert((obj_cite_digits.on).to!int >= 0);
@@ -6053,7 +6103,9 @@ template DocReformDocAbstraction() {
_comp_obj_heading_.metainfo.ocn = obj_cite_digits.on;
_comp_obj_heading_.metainfo.object_number_off = (obj_cite_digits.off==0) ? "" : obj_cite_digits.off.to!string;
_comp_obj_heading_.metainfo.object_number_type = obj_cite_digits.type;
- _comp_obj_heading_.tags.segment_anchor_tag = segment_anchor_tag.to!string;
+ _comp_obj_heading_.tags.segment_anchor_tag = segment_anchor_tag_that_object_belongs_to;
+ _comp_obj_heading_.tags.heading_lev_anchor_tag = lev_anchor_tag;
+ _comp_obj_heading_.tags.segment_anchor_tag_is = segment_anchor_tag_that_object_belongs_to;
_comp_obj_heading_.metainfo.heading_lev_markup = (!(lev_markup_number.empty) ? lev_markup_number.to!int : 0);
_comp_obj_heading_.metainfo.heading_lev_collapsed = (!(lev_collapsed_number.empty) ? lev_collapsed_number.to!int : 0);
_comp_obj_heading_.metainfo.parent_ocn = p_["object_number"];
diff --git a/src/doc_reform/meta/object_setter.d b/src/doc_reform/meta/object_setter.d
index f481ec1..ee2dc78 100644
--- a/src/doc_reform/meta/object_setter.d
+++ b/src/doc_reform/meta/object_setter.d
@@ -105,6 +105,8 @@ template ObjectSetter() {
struct DocObj_Tags_ {
string[] heading_ancestors_text = [ "", "", "", "", "", "", "", "", ]; // TODO redundant? see markedup and collapsed ancestors DONE
string segment_anchor_tag = "";
+ string segment_anchor_tag_is = "";
+ string heading_lev_anchor_tag = "";
string segname_prev = "";
string segname_next = "";
string[] lev4_subtoc = [];
diff --git a/src/doc_reform/output/epub3.d b/src/doc_reform/output/epub3.d
index 19c7934..18d9e03 100644
--- a/src/doc_reform/output/epub3.d
+++ b/src/doc_reform/output/epub3.d
@@ -160,7 +160,7 @@ template outputEPub3() {
if (obj.metainfo.heading_lev_markup < 4) {
toc ~= markup.indent_by_spaces_provided((n + 1), " ") ~ "<li>" ~ "\n"
~ markup.indent_by_spaces_provided((n + 2), " ")
- ~ "<a href=\"" ~ obj.tags.segment_anchor_tag ~ ".xhtml" ~ "\">"
+ ~ "<a href=\"" ~ obj.tags.segment_anchor_tag_is ~ ".xhtml" ~ "\">"
~ _txt
~ "</a>" ~ "\n";
} else {
@@ -169,7 +169,7 @@ template outputEPub3() {
: ("#" ~ obj.metainfo.ocn.to!string);
toc ~= markup.indent_by_spaces_provided((n + 1), " ") ~ "<li>" ~ "\n"
~ markup.indent_by_spaces_provided((n + 2), " ")
- ~ "<a href=\"" ~ obj.tags.segment_anchor_tag ~ ".xhtml" ~ hashtag ~ "\">"
+ ~ "<a href=\"" ~ obj.tags.segment_anchor_tag_is ~ ".xhtml" ~ hashtag ~ "\">"
~ _txt
~ "</a>" ~ "\n";
}
@@ -179,7 +179,7 @@ template outputEPub3() {
if (obj.metainfo.heading_lev_markup < 4) {
toc ~= markup.indent_by_spaces_provided((n + 1), " ") ~ "<li>" ~ "\n"
~ markup.indent_by_spaces_provided((n + 2), " ")
- ~ "<a href=\"" ~ obj.tags.segment_anchor_tag ~ ".xhtml" ~ "\">"
+ ~ "<a href=\"" ~ obj.tags.segment_anchor_tag_is ~ ".xhtml" ~ "\">"
~ _txt
~ "</a>" ~ "\n";
} else {
@@ -188,7 +188,7 @@ template outputEPub3() {
: ("#" ~ obj.metainfo.ocn.to!string);
toc ~= markup.indent_by_spaces_provided((n + 1), " ") ~ "<li>" ~ "\n"
~ markup.indent_by_spaces_provided((n + 2), " ")
- ~ "<a href=\"" ~ obj.tags.segment_anchor_tag ~ ".xhtml" ~ hashtag ~ "\">"
+ ~ "<a href=\"" ~ obj.tags.segment_anchor_tag_is ~ ".xhtml" ~ hashtag ~ "\">"
~ _txt
~ "</a>" ~ "\n";
}
@@ -262,7 +262,7 @@ template outputEPub3() {
<content src="%s.xhtml%s" />¶",
counter,
_txt,
- obj.tags.segment_anchor_tag,
+ obj.tags.segment_anchor_tag_is,
hashtag,
);
break;
@@ -276,7 +276,7 @@ template outputEPub3() {
<content src="%s.xhtml%s" />¶",
counter,
_txt,
- obj.tags.segment_anchor_tag,
+ obj.tags.segment_anchor_tag_is,
hashtag,
);
break;
@@ -512,41 +512,41 @@ template outputEPub3() {
oepbs_content_parts["manifest_documents"] ~=
format(q"¶ <item id="%s.xhtml" href="%s.xhtml" media-type="application/xhtml+xml" />
¶",
- obj.tags.segment_anchor_tag,
- obj.tags.segment_anchor_tag,
+ obj.tags.segment_anchor_tag_is,
+ obj.tags.segment_anchor_tag_is,
);
oepbs_content_parts["spine"] ~=
format(q"¶ <itemref idref="%s.xhtml" linear="yes" />
¶",
- obj.tags.segment_anchor_tag,
+ obj.tags.segment_anchor_tag_is,
);
oepbs_content_parts["guide"] ~=
format(q"¶ <reference type="%s" href="%s" />
¶",
- obj.tags.segment_anchor_tag,
- obj.tags.segment_anchor_tag,
+ obj.tags.segment_anchor_tag_is,
+ obj.tags.segment_anchor_tag_is,
);
} else if (obj.metainfo.heading_lev_markup > 4) {
oepbs_content_parts["manifest_documents"] ~=
format(q"¶ <item id="%s.xhtml#%s" href="%s.xhtml#%s" media-type="application/xhtml+xml" />
¶",
- obj.tags.segment_anchor_tag,
+ obj.tags.segment_anchor_tag_is,
obj.metainfo.object_number,
- obj.tags.segment_anchor_tag,
+ obj.tags.segment_anchor_tag_is,
obj.metainfo.object_number,
);
oepbs_content_parts["spine"] ~=
format(q"¶ <itemref idref="%s.xhtml#%s" linear="yes" />
¶",
- obj.tags.segment_anchor_tag,
+ obj.tags.segment_anchor_tag_is,
obj.metainfo.object_number,
);
oepbs_content_parts["guide"] ~=
format(q"¶ <reference type="%s#%s" href="%s#%s" />
¶",
- obj.tags.segment_anchor_tag,
+ obj.tags.segment_anchor_tag_is,
obj.metainfo.object_number,
- obj.tags.segment_anchor_tag,
+ obj.tags.segment_anchor_tag_is,
obj.metainfo.object_number,
);
}
diff --git a/src/doc_reform/output/xmls.d b/src/doc_reform/output/xmls.d
index 7a1a812..47053f3 100644
--- a/src/doc_reform/output/xmls.d
+++ b/src/doc_reform/output/xmls.d
@@ -89,7 +89,8 @@ template outputXHTMLs() {
.replaceAll(rgx.inline_cite, ("<cite>$1</cite>"));
return _txt;
}
- string _xhtml_anchor_tags(const(string[]) anchor_tags) {
+ string _xhtml_anchor_tags(O)(O obj) {
+ const(string[]) anchor_tags = obj.tags.anchor_tags;
string tags="";
if (anchor_tags.length > 0) {
foreach (tag; anchor_tags) {
@@ -351,13 +352,28 @@ template outputXHTMLs() {
}
if (_xml_type == "seg" || _xml_type == "epub") {
if (auto m = _txt.match(rgx.inline_link_hash)) {
- foreach (segname; doc_matters.xml.segnames) {
- if (auto n = segname.match(m.captures[3])) {
+ if (m.captures[3] in doc_matters.xml.tag_associations) {
+ if (m.captures[3] == doc_matters.xml.tag_associations[(m.captures[3])][0]) {
_txt = _txt.replaceFirst(
rgx.inline_link_hash,
- "┥$1┝┤$3" ~ _suffix ~ "├");
- break;
+ "┥$1┝┤$3" ~ _suffix ~ "├"
+ );
+ } else {
+ _txt = _txt.replaceFirst(
+ rgx.inline_link_hash,
+ "┥$1┝┤"
+ ~ doc_matters.xml.tag_associations[(m.captures[3])][0]
+ ~ _suffix
+ ~ "#" ~ "$3"
+ ~ "├"
+ );
}
+ } else {
+ writeln(
+ "WARNING on internal document links, anchor to link not found in document, "
+ ~ "anchor: " ~ m.captures[3]
+ ~ " document: " ~ doc_matters.src.filename
+ );
}
}
}
@@ -592,7 +608,9 @@ template outputXHTMLs() {
string _txt,
string _xml_type = "html",
) {
- auto tags = _xhtml_anchor_tags(obj.tags.anchor_tags);
+ auto tags = _xhtml_anchor_tags(obj);
+ string seg_anchor_tag;
+ string heading_lev_anchor_tag;
string _horizontal_rule = "<hr />";
if ((_xml_type != "html")
|| (obj.metainfo.heading_lev_markup == 0 || obj.metainfo.heading_lev_markup > 4)) {
@@ -600,10 +618,16 @@ template outputXHTMLs() {
}
_txt = font_face(_txt);
string o;
+ seg_anchor_tag = (obj.tags.segment_anchor_tag.empty)
+ ? ""
+ : "<a name=\"" ~ obj.tags.segment_anchor_tag ~ "\"></a>";
+ heading_lev_anchor_tag = (obj.tags.heading_lev_anchor_tag.empty)
+ ? ""
+ : "<a name=\"" ~ obj.tags.heading_lev_anchor_tag ~ "\"></a>";
if (obj.metainfo.object_number.empty) {
o = format(q"¶%s
<div class="substance">
- <h%s class="%s">%s<a name="%s"></a>
+ <h%s class="%s">%s%s
%s
</h%s>
</div>¶",
@@ -611,7 +635,7 @@ template outputXHTMLs() {
obj.metainfo.heading_lev_markup,
obj.metainfo.is_a,
tags,
- obj.tags.segment_anchor_tag,
+ heading_lev_anchor_tag,
_txt,
obj.metainfo.heading_lev_markup,
);
@@ -619,7 +643,7 @@ template outputXHTMLs() {
o = format(q"¶%s
<div class="substance">
<label class="ocn"><a href="#%s" class="lnkocn">%s</a></label>
- <h%s class="%s" id="%s"><a name="%s"></a>%s<a name="%s"></a>
+ <h%s class="%s" id="%s"><a name="%s"></a>%s%s
%s
</h%s>
</div>¶",
@@ -631,7 +655,7 @@ template outputXHTMLs() {
obj.metainfo.object_number,
obj.metainfo.object_number,
tags,
- obj.tags.segment_anchor_tag,
+ heading_lev_anchor_tag,
_txt,
obj.metainfo.heading_lev_markup,
);
@@ -644,7 +668,7 @@ template outputXHTMLs() {
string _txt,
string _suffix = ".html",
) {
- auto tags = _xhtml_anchor_tags(obj.tags.anchor_tags);
+ auto tags = _xhtml_anchor_tags(obj);
_txt = inline_markup_scroll(doc_matters, obj, _txt, _suffix);
string o = heading(doc_matters, obj, _txt);
return o;
@@ -671,7 +695,7 @@ template outputXHTMLs() {
const O obj,
string _txt,
) {
- auto tags = _xhtml_anchor_tags(obj.tags.anchor_tags);
+ auto tags = _xhtml_anchor_tags(obj);
_txt = font_face(_txt);
string o;
_txt = (obj.attrib.bullet) ? ("●&#160;&#160;" ~ _txt) : _txt;
@@ -712,7 +736,7 @@ template outputXHTMLs() {
string _txt,
string _suffix = ".html",
) {
- auto tags = _xhtml_anchor_tags(obj.tags.anchor_tags);
+ auto tags = _xhtml_anchor_tags(obj);
_txt = inline_markup_scroll(doc_matters, obj, _txt, _suffix);
string o = para(doc_matters, obj, _txt);
return o;
@@ -772,7 +796,7 @@ template outputXHTMLs() {
string _txt,
string _suffix = ".html",
) {
- auto tags = _xhtml_anchor_tags(obj.tags.anchor_tags);
+ auto tags = _xhtml_anchor_tags(obj);
_txt = inline_markup_scroll(doc_matters, obj, _txt, _suffix);
string o = quote(doc_matters, obj, _txt);
return o;
@@ -833,7 +857,7 @@ template outputXHTMLs() {
string _suffix = ".html",
string _xml_type = "html",
) {
- auto tags = _xhtml_anchor_tags(obj.tags.anchor_tags);
+ auto tags = _xhtml_anchor_tags(obj);
_txt = inline_markup_scroll(doc_matters, obj, _txt, _suffix);
string o = group(doc_matters, obj, _txt);
return o;
@@ -890,7 +914,7 @@ template outputXHTMLs() {
string _suffix = ".html",
string _xml_type = "html",
) {
- auto tags = _xhtml_anchor_tags(obj.tags.anchor_tags);
+ auto tags = _xhtml_anchor_tags(obj);
_txt = inline_markup_scroll(doc_matters, obj, _txt, _suffix);
string o = block(doc_matters, obj, _txt);
return o;
@@ -947,7 +971,7 @@ template outputXHTMLs() {
string _suffix = ".html",
string _xml_type = "html",
) {
- auto tags = _xhtml_anchor_tags(obj.tags.anchor_tags);
+ auto tags = _xhtml_anchor_tags(obj);
_txt = inline_markup_scroll(doc_matters, obj, _txt, _suffix);
string o = verse(doc_matters, obj, _txt);
return o;
@@ -1008,7 +1032,7 @@ template outputXHTMLs() {
const O obj,
string _txt,
) {
- auto tags = _xhtml_anchor_tags(obj.tags.anchor_tags);
+ auto tags = _xhtml_anchor_tags(obj);
_txt = font_face(_txt);
auto t = tablarize(doc_matters, obj, _txt);
_txt = t[0];