diff options
author | Ralph Amissah <ralph.amissah@gmail.com> | 2018-10-22 17:04:58 -0400 |
---|---|---|
committer | Ralph Amissah <ralph.amissah@gmail.com> | 2019-04-10 15:14:15 -0400 |
commit | 4c50f7ab56eddd9d85a5a76eba3fbc971d338038 (patch) | |
tree | 93e24b1aeaae63f7e7f44105ae5622dd1af8cf0e /src/doc_reform | |
parent | org headings & tags, minor (diff) |
0.2.1 segnames, anchor tagsdoc-reform_v0.2.1
Diffstat (limited to 'src/doc_reform')
-rw-r--r-- | src/doc_reform/meta/defaults.d | 3 | ||||
-rw-r--r-- | src/doc_reform/meta/doc_debugs.d | 8 | ||||
-rw-r--r-- | src/doc_reform/meta/metadoc.d | 4 | ||||
-rw-r--r-- | src/doc_reform/meta/metadoc_from_src.d | 213 | ||||
-rw-r--r-- | src/doc_reform/meta/object_setter.d | 3 | ||||
-rw-r--r-- | src/doc_reform/output/epub3.d | 46 | ||||
-rw-r--r-- | src/doc_reform/output/html.d | 2 | ||||
-rw-r--r-- | src/doc_reform/output/xmls.d | 2 |
8 files changed, 146 insertions, 135 deletions
diff --git a/src/doc_reform/meta/defaults.d b/src/doc_reform/meta/defaults.d index 69ab7ba..fd13b44 100644 --- a/src/doc_reform/meta/defaults.d +++ b/src/doc_reform/meta/defaults.d @@ -48,7 +48,8 @@ template DocReformNode() { "is" : "", "ocn" : "", "marked_up_lev" : "", - "segment_anchor_tag" : "", + "segment_anchor_tag_html" : "", + "segment_anchor_tag_epub" : "", "attrib" : "", ]; return _node; diff --git a/src/doc_reform/meta/doc_debugs.d b/src/doc_reform/meta/doc_debugs.d index 9f26edc..ae3ab98 100644 --- a/src/doc_reform/meta/doc_debugs.d +++ b/src/doc_reform/meta/doc_debugs.d @@ -116,12 +116,12 @@ template DocReformDebugs() { writeln(markup.indent_by_spaces_provided(k), "</", k, ">"); writeln(markup.indent_by_spaces_provided(k), "<", k, ">", obj.text, - " file: ", obj.segment_anchor_tag, ".xhtml#", obj.ocn); + " file: ", obj.segment_anchor_tag_html, ".xhtml#", obj.ocn); break; case DomTags.open : writeln(markup.indent_by_spaces_provided(k), "<", k, ">", obj.text, - " file: ", obj.segment_anchor_tag, ".xhtml#", obj.ocn); + " file: ", obj.segment_anchor_tag_html, ".xhtml#", obj.ocn); break; default : break; @@ -143,12 +143,12 @@ template DocReformDebugs() { writeln(markup.indent_by_spaces_provided(k), "</", k, ">"); writeln(markup.indent_by_spaces_provided(k), "<", k, ">", obj.text, - " file: ", obj.segment_anchor_tag, ".xhtml#", obj.ocn); + " file: ", obj.segment_anchor_tag_html, ".xhtml#", obj.ocn); break; case DomTags.open : writeln(markup.indent_by_spaces_provided(k), "<", k, ">", obj.text, - " file: ", obj.segment_anchor_tag, ".xhtml#", obj.ocn); + " file: ", obj.segment_anchor_tag_html, ".xhtml#", obj.ocn); break; default : break; diff --git a/src/doc_reform/meta/metadoc.d b/src/doc_reform/meta/metadoc.d index 13502b3..e164f36 100644 --- a/src/doc_reform/meta/metadoc.d +++ b/src/doc_reform/meta/metadoc.d @@ -85,6 +85,10 @@ template DocReformAbstraction() { 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]; + debug(segnames) { + writeln("segnames lv4: ", _doc_html_segnames); + writeln("segnames lv0 to 4: ", _doc_epub_segnames_0_4); + } auto _doc_tag_assoc = da[docAbst.tag_assoc]; auto _images = da[docAbst.images]; debug(steps) { diff --git a/src/doc_reform/meta/metadoc_from_src.d b/src/doc_reform/meta/metadoc_from_src.d index 69db575..68f4433 100644 --- a/src/doc_reform/meta/metadoc_from_src.d +++ b/src/doc_reform/meta/metadoc_from_src.d @@ -31,12 +31,11 @@ template DocReformDocAbstraction() { string[] anchor_tags; string anchor_tag; string anchor_tag_; - string segment_anchor_tag_that_object_belongs_to; + string[string] segment_anchor_tag_that_object_belongs_to; string lev_anchor_tag; string[][string] tag_assoc_html; string[][string] tag_assoc_lv0_to_lv3_html; string[][string] tag_assoc_lv0_to_lv3_epub; - string segment_anchor_tag_that_object_belongs_to_uri; /+ enum +/ enum State { off, on } enum TriState { off, on, closing } @@ -244,7 +243,7 @@ template DocReformDocAbstraction() { static auto rgx = Rgx(); if (auto m = an_object["substantive"].match(rgx.inline_link_anchor)) { if (m.captures[1] !in tag_assoc_html) { - tag_assoc_html[(m.captures[1])] = [segment_anchor_tag_that_object_belongs_to]; + tag_assoc_html[(m.captures[1])] = [segment_anchor_tag_that_object_belongs_to["html"]]; } else { writeln("a tag named already exists, check text line\n ", an_object["substantive"]); } @@ -351,8 +350,8 @@ template DocReformDocAbstraction() { comp_obj_heading_.metainfo.ocn = 0; 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_.tags.segment_anchor_tag_html = "toc"; + comp_obj_heading_.tags.segment_anchor_tag_epub = comp_obj_heading_.tags.segment_anchor_tag_html; comp_obj_heading_.metainfo.heading_lev_markup = 4; comp_obj_heading_.metainfo.heading_lev_collapsed = 1; comp_obj_heading_.metainfo.parent_ocn = 1; @@ -491,8 +490,8 @@ template DocReformDocAbstraction() { comp_obj_heading_.metainfo.ocn = 0; 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_.tags.segment_anchor_tag_html = "_part_glossary"; + comp_obj_heading_.tags.segment_anchor_tag_epub = comp_obj_heading_.tags.segment_anchor_tag_html; comp_obj_heading_.metainfo.heading_lev_markup = 1; comp_obj_heading_.metainfo.heading_lev_collapsed = 1; comp_obj_heading_.metainfo.parent_ocn = 1; @@ -509,8 +508,8 @@ template DocReformDocAbstraction() { comp_obj_heading_.metainfo.ocn = 0; 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_.tags.segment_anchor_tag_html = "glossary"; + comp_obj_heading_.tags.segment_anchor_tag_epub = comp_obj_heading_.tags.segment_anchor_tag_html; comp_obj_heading_.metainfo.heading_lev_markup = 4; comp_obj_heading_.metainfo.heading_lev_collapsed = 2; comp_obj_heading_.metainfo.parent_ocn = 1; @@ -599,8 +598,8 @@ template DocReformDocAbstraction() { comp_obj_heading_.metainfo.ocn = 0; 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_.tags.segment_anchor_tag_html = "_part_blurb"; + comp_obj_heading_.tags.segment_anchor_tag_epub = comp_obj_heading_.tags.segment_anchor_tag_html; comp_obj_heading_.metainfo.heading_lev_markup = 1; comp_obj_heading_.metainfo.heading_lev_collapsed = 1; comp_obj_heading_.metainfo.parent_ocn = 1; @@ -617,8 +616,8 @@ template DocReformDocAbstraction() { comp_obj_heading_.metainfo.ocn = 0; 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_.tags.segment_anchor_tag_html = "blurb"; + comp_obj_heading_.tags.segment_anchor_tag_epub = comp_obj_heading_.tags.segment_anchor_tag_html; comp_obj_heading_.metainfo.heading_lev_markup = 4; comp_obj_heading_.metainfo.heading_lev_collapsed = 2; comp_obj_heading_.metainfo.parent_ocn = 1; @@ -638,8 +637,8 @@ template DocReformDocAbstraction() { comp_obj_heading_.metainfo.ocn = 0; 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_.tags.segment_anchor_tag_html = "blurb"; + comp_obj_heading_.tags.segment_anchor_tag_epub = comp_obj_heading_.tags.segment_anchor_tag_html; 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; @@ -871,22 +870,22 @@ template DocReformDocAbstraction() { && (!(anchor_tag.empty) || (tag_assoc_lv0_to_lv3_html.length > 1)) ) { - segment_anchor_tag_that_object_belongs_to = anchor_tag; + segment_anchor_tag_that_object_belongs_to["html"] = anchor_tag; lev_anchor_tag = anchor_tag; - tag_assoc_html[anchor_tag] = [segment_anchor_tag_that_object_belongs_to]; + tag_assoc_html[anchor_tag] = [segment_anchor_tag_that_object_belongs_to["html"]]; if (tag_assoc_lv0_to_lv3_html.length > 1) { /+ names used for html markup segments 1 to 4 (rather than epub which has separate segments for A to D) +/ foreach (lv0_to_lv3_html_tag; tag_assoc_lv0_to_lv3_html) { - tag_assoc_html[lv0_to_lv3_html_tag[0]] = [segment_anchor_tag_that_object_belongs_to]; + tag_assoc_html[lv0_to_lv3_html_tag[0]] = [segment_anchor_tag_that_object_belongs_to["html"]]; } } - segment_anchor_tag_that_object_belongs_to_uri = anchor_tag ~ ".fnSuffix"; + segment_anchor_tag_that_object_belongs_to["html_uri"] = anchor_tag ~ ".fnSuffix"; anchor_tag_ = anchor_tag; tag_assoc_lv0_to_lv3_html = tag_assoc_lv0_to_lv3_html.init; } else if (an_object["lev_markup_number"].to!int > 4) { - segment_anchor_tag_that_object_belongs_to = anchor_tag_; + segment_anchor_tag_that_object_belongs_to["html"] = anchor_tag_; lev_anchor_tag = anchor_tag; - tag_assoc_html[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; + tag_assoc_html[anchor_tag] = [segment_anchor_tag_that_object_belongs_to["html"]]; + segment_anchor_tag_that_object_belongs_to["html_uri"] = anchor_tag_ ~ ".fnSuffix#" ~ obj_cite_digits.on.to!string; } else if (an_object["lev_markup_number"].to!int < 4) { string segn; switch (an_object["lev_markup_number"].to!int) { @@ -906,8 +905,10 @@ template DocReformDocAbstraction() { ++cnt3; goto default; default: - segment_anchor_tag_that_object_belongs_to = segn; - segment_anchor_tag_that_object_belongs_to_uri = segn ~ ".fnSuffix"; + segment_anchor_tag_that_object_belongs_to["html"] = segn; + segment_anchor_tag_that_object_belongs_to["html_uri"] = segn ~ ".fnSuffix"; + segment_anchor_tag_that_object_belongs_to["epub"] = segn; + segment_anchor_tag_that_object_belongs_to["epub_uri"] = segn ~ ".fnSuffix"; tag_assoc_lv0_to_lv3_html[segn] = [""]; tag_assoc_lv0_to_lv3_epub[segn] = ["segn"]; break; @@ -928,7 +929,7 @@ template DocReformDocAbstraction() { the_table_of_contents_section, ); if (an_object["lev_markup_number"] == "4") { - html_segnames ~= segment_anchor_tag_that_object_belongs_to; + html_segnames ~= segment_anchor_tag_that_object_belongs_to["html"]; html_segnames_ptr = html_segnames_ptr_cntr; html_segnames_ptr_cntr++; } @@ -953,7 +954,7 @@ template DocReformDocAbstraction() { ++heading_ptr; debug(segments) { writeln(an_object["lev_markup_number"]); - writeln(segment_anchor_tag_that_object_belongs_to); + writeln(segment_anchor_tag_that_object_belongs_to["html"]); } the_document_body_section ~= comp_obj_heading; debug(objectrelated1) { // check @@ -995,7 +996,7 @@ template DocReformDocAbstraction() { 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_is = segment_anchor_tag_that_object_belongs_to; + comp_obj_para.tags.segment_anchor_tag_is = segment_anchor_tag_that_object_belongs_to["html"]; 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; @@ -1122,8 +1123,8 @@ template DocReformDocAbstraction() { comp_obj_heading_.metainfo.ocn = 0; 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_.tags.segment_anchor_tag_html = "_part_bibliography"; + comp_obj_heading_.tags.segment_anchor_tag_epub = comp_obj_heading_.tags.segment_anchor_tag_html; comp_obj_heading_.metainfo.heading_lev_markup = 1; comp_obj_heading_.metainfo.heading_lev_collapsed = 1; comp_obj_heading_.metainfo.parent_ocn = 1; @@ -1138,8 +1139,8 @@ template DocReformDocAbstraction() { comp_obj_heading_.metainfo.ocn = 0; 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_.tags.segment_anchor_tag_html = "bibliography"; + comp_obj_heading_.tags.segment_anchor_tag_epub = comp_obj_heading_.tags.segment_anchor_tag_html; comp_obj_heading_.metainfo.heading_lev_markup = 4; comp_obj_heading_.metainfo.heading_lev_collapsed = 2; comp_obj_heading_.metainfo.parent_ocn = 1; @@ -1224,8 +1225,8 @@ template DocReformDocAbstraction() { comp_obj_heading_.metainfo.ocn = 0; 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_.tags.segment_anchor_tag_html = ""; + comp_obj_heading_.tags.segment_anchor_tag_epub = ""; comp_obj_heading_.metainfo.heading_lev_markup = 1; comp_obj_heading_.metainfo.heading_lev_collapsed = 1; comp_obj_heading_.metainfo.parent_ocn = 1; @@ -1743,7 +1744,7 @@ template DocReformDocAbstraction() { writeln(obj.text); } if (obj.metainfo.heading_lev_markup <= 4) { - segnames_lv0_to_4 ~= obj.tags.segment_anchor_tag; + segnames_lv0_to_4 ~= obj.tags.segment_anchor_tag_epub; } if (obj.metainfo.heading_lev_markup == 0) { /+ TODO second hit (of two) with same assertion failure, check, fix and reinstate @@ -1773,11 +1774,10 @@ 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_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], - obj.tags.segment_anchor_tag ~ "!=" ~ html_segnames[obj.ptr.html_segnames]); + assert(obj.tags.segment_anchor_tag_html == html_segnames[obj.ptr.html_segnames], + obj.tags.segment_anchor_tag_html ~ "!=" ~ html_segnames[obj.ptr.html_segnames]); } } /+ dom structure (marked up & collapsed) +/ @@ -1802,11 +1802,11 @@ template DocReformDocAbstraction() { writeln(obj.text); } if (obj.metainfo.heading_lev_markup <= 4) { - segnames_lv0_to_4 ~= obj.tags.segment_anchor_tag; + segnames_lv0_to_4 ~= obj.tags.segment_anchor_tag_epub; 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], - obj.tags.segment_anchor_tag ~ "!=" ~ html_segnames[obj.ptr.html_segnames]); + assert(obj.tags.segment_anchor_tag_html == html_segnames[obj.ptr.html_segnames], + obj.tags.segment_anchor_tag_html ~ "!=" ~ html_segnames[obj.ptr.html_segnames]); } } if ((opt_action.html) @@ -1828,15 +1828,15 @@ template DocReformDocAbstraction() { writeln(obj.text); } if (obj.metainfo.heading_lev_markup <= 4) { - segnames_lv0_to_4 ~= obj.tags.segment_anchor_tag; + segnames_lv0_to_4 ~= obj.tags.segment_anchor_tag_epub; if (obj.metainfo.heading_lev_markup == 4) { - obj.tags.lev4_subtoc = lev4_subtoc[obj.tags.segment_anchor_tag]; + obj.tags.lev4_subtoc = lev4_subtoc[obj.tags.segment_anchor_tag_html]; obj.tags.segname_prev = html_segnames[obj.ptr.html_segnames - 1]; if (html_segnames.length > obj.ptr.html_segnames + 1) { obj.tags.segname_next = html_segnames[obj.ptr.html_segnames + 1]; } - assert(obj.tags.segment_anchor_tag == html_segnames[obj.ptr.html_segnames], - obj.tags.segment_anchor_tag ~ "!=" ~ html_segnames[obj.ptr.html_segnames]); + assert(obj.tags.segment_anchor_tag_html == html_segnames[obj.ptr.html_segnames], + obj.tags.segment_anchor_tag_html ~ "!=" ~ html_segnames[obj.ptr.html_segnames]); } } /+ dom structure (marked up & collapsed) +/ @@ -1871,14 +1871,14 @@ template DocReformDocAbstraction() { obj_cite_digits = ocn_emit(OCNstatus.on); obj.metainfo.ocn = obj_cite_digits.digit; if (obj.metainfo.heading_lev_markup <= 4) { - segnames_lv0_to_4 ~= obj.tags.segment_anchor_tag; + segnames_lv0_to_4 ~= obj.tags.segment_anchor_tag_epub; 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) { obj.tags.segname_next = html_segnames[obj.ptr.html_segnames + 1]; } - assert(obj.tags.segment_anchor_tag == html_segnames[obj.ptr.html_segnames], - obj.tags.segment_anchor_tag ~ "!=" ~ html_segnames[obj.ptr.html_segnames]); + assert(obj.tags.segment_anchor_tag_html == html_segnames[obj.ptr.html_segnames], + obj.tags.segment_anchor_tag_html ~ "!=" ~ html_segnames[obj.ptr.html_segnames]); } } /+ dom structure (marked up & collapsed) +/ @@ -1905,14 +1905,14 @@ template DocReformDocAbstraction() { obj_cite_digits = ocn_emit(OCNstatus.on); obj.metainfo.ocn = obj_cite_digits.digit; if (obj.metainfo.heading_lev_markup <= 4) { - segnames_lv0_to_4 ~= obj.tags.segment_anchor_tag; + segnames_lv0_to_4 ~= obj.tags.segment_anchor_tag_epub; 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) { obj.tags.segname_next = html_segnames[obj.ptr.html_segnames + 1]; } - assert(obj.tags.segment_anchor_tag == html_segnames[obj.ptr.html_segnames], - obj.tags.segment_anchor_tag ~ "!=" ~ html_segnames[obj.ptr.html_segnames]); + assert(obj.tags.segment_anchor_tag_html == html_segnames[obj.ptr.html_segnames], + obj.tags.segment_anchor_tag_html ~ "!=" ~ html_segnames[obj.ptr.html_segnames]); } } /+ dom structure (marked up & collapsed) +/ @@ -1942,14 +1942,14 @@ template DocReformDocAbstraction() { obj_cite_digits = ocn_emit(OCNstatus.on); obj.metainfo.ocn = obj_cite_digits.digit; if (obj.metainfo.heading_lev_markup <= 4) { - segnames_lv0_to_4 ~= obj.tags.segment_anchor_tag; + segnames_lv0_to_4 ~= obj.tags.segment_anchor_tag_epub; 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) { obj.tags.segname_next = html_segnames[obj.ptr.html_segnames + 1]; } - assert(obj.tags.segment_anchor_tag == html_segnames[obj.ptr.html_segnames], - obj.tags.segment_anchor_tag ~ "!=" ~ html_segnames[obj.ptr.html_segnames]); + assert(obj.tags.segment_anchor_tag_html == html_segnames[obj.ptr.html_segnames], + obj.tags.segment_anchor_tag_html ~ "!=" ~ html_segnames[obj.ptr.html_segnames]); } } /+ dom structure (marked up & collapsed) +/ @@ -1984,14 +1984,13 @@ template DocReformDocAbstraction() { obj_cite_digits = ocn_emit(OCNstatus.on); obj.metainfo.ocn = obj_cite_digits.on; if (obj.metainfo.heading_lev_markup <= 4) { - 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) { obj.tags.segname_next = html_segnames[obj.ptr.html_segnames + 1]; } - assert(obj.tags.segment_anchor_tag == html_segnames[obj.ptr.html_segnames], - obj.tags.segment_anchor_tag ~ "!=" ~ html_segnames[obj.ptr.html_segnames]); + assert(obj.tags.segment_anchor_tag_html == html_segnames[obj.ptr.html_segnames], + obj.tags.segment_anchor_tag_html ~ "!=" ~ html_segnames[obj.ptr.html_segnames]); } } /+ dom structure (marked up & collapsed) +/ @@ -2022,14 +2021,14 @@ template DocReformDocAbstraction() { } obj.metainfo.ocn = ++ocn_; if (obj.metainfo.heading_lev_markup <= 4) { - segnames_lv0_to_4 ~= obj.tags.segment_anchor_tag; + segnames_lv0_to_4 ~= obj.tags.segment_anchor_tag_epub; 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) { obj.tags.segname_next = html_segnames[obj.ptr.html_segnames + 1]; } - assert(obj.tags.segment_anchor_tag == html_segnames[obj.ptr.html_segnames], - obj.tags.segment_anchor_tag ~ "!=" ~ html_segnames[obj.ptr.html_segnames]); + assert(obj.tags.segment_anchor_tag_html == html_segnames[obj.ptr.html_segnames], + obj.tags.segment_anchor_tag_html ~ "!=" ~ html_segnames[obj.ptr.html_segnames]); } } /+ dom structure (marked up & collapsed) +/ @@ -2064,14 +2063,14 @@ template DocReformDocAbstraction() { obj_cite_digits = ocn_emit(OCNstatus.on); obj.metainfo.ocn = obj_cite_digits.on; if (obj.metainfo.heading_lev_markup <= 4) { - segnames_lv0_to_4 ~= obj.tags.segment_anchor_tag; + segnames_lv0_to_4 ~= obj.tags.segment_anchor_tag_epub; 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) { obj.tags.segname_next = html_segnames[obj.ptr.html_segnames + 1]; } - assert(obj.tags.segment_anchor_tag == html_segnames[obj.ptr.html_segnames], - obj.tags.segment_anchor_tag ~ "!=" ~ html_segnames[obj.ptr.html_segnames]); + assert(obj.tags.segment_anchor_tag_html == html_segnames[obj.ptr.html_segnames], + obj.tags.segment_anchor_tag_html ~ "!=" ~ html_segnames[obj.ptr.html_segnames]); } } /+ dom structure (marked up & collapsed) +/ @@ -2198,7 +2197,9 @@ template DocReformDocAbstraction() { comp_obj_heading_.metainfo.ocn = 0; 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_html = ""; + comp_obj_heading_.tags.segment_anchor_tag_epub = ""; + comp_obj_heading_.tags.segment_anchor_tag_is = ""; comp_obj_heading_.metainfo.heading_lev_markup = 9; comp_obj_heading_.metainfo.heading_lev_collapsed = 9; comp_obj_heading_.metainfo.parent_ocn = 0; @@ -2819,7 +2820,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_is = segment_anchor_tag_that_object_belongs_to; + comp_obj_block.tags.segment_anchor_tag_is = segment_anchor_tag_that_object_belongs_to["html"]; 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"]; @@ -2880,7 +2881,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_is = segment_anchor_tag_that_object_belongs_to; + comp_obj_block.tags.segment_anchor_tag_is = segment_anchor_tag_that_object_belongs_to["html"]; 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"]; @@ -2924,7 +2925,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_is = segment_anchor_tag_that_object_belongs_to; + comp_obj_block.tags.segment_anchor_tag_is = segment_anchor_tag_that_object_belongs_to["html"]; 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"]; @@ -2985,7 +2986,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_is = segment_anchor_tag_that_object_belongs_to; + comp_obj_block.tags.segment_anchor_tag_is = segment_anchor_tag_that_object_belongs_to["html"]; 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"]; @@ -3283,7 +3284,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_is = segment_anchor_tag_that_object_belongs_to; + comp_obj_block.tags.segment_anchor_tag_is = segment_anchor_tag_that_object_belongs_to["html"]; 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"]); @@ -3351,7 +3352,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_is = segment_anchor_tag_that_object_belongs_to; + comp_obj_block.tags.segment_anchor_tag_is = segment_anchor_tag_that_object_belongs_to["html"]; 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"]; @@ -3398,7 +3399,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_is = segment_anchor_tag_that_object_belongs_to; + comp_obj_block.tags.segment_anchor_tag_is = segment_anchor_tag_that_object_belongs_to["html"]; 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"]; @@ -3443,7 +3444,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_is = segment_anchor_tag_that_object_belongs_to; + comp_obj_block.tags.segment_anchor_tag_is = segment_anchor_tag_that_object_belongs_to["html"]; 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"]; @@ -3525,7 +3526,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_is = segment_anchor_tag_that_object_belongs_to; + comp_obj_code.tags.segment_anchor_tag_is = segment_anchor_tag_that_object_belongs_to["html"]; 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"]; @@ -3567,7 +3568,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_is = segment_anchor_tag_that_object_belongs_to; + comp_obj_block.tags.segment_anchor_tag_is = segment_anchor_tag_that_object_belongs_to["html"]; 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"]); @@ -4744,7 +4745,7 @@ template DocReformDocAbstraction() { in { debug(asserts) { static assert(is(typeof(obj_) == string[string])); - static assert(is(typeof(segment_anchor_tag_that_object_belongs_to) == string)); + static assert(is(typeof(segment_anchor_tag_that_object_belongs_to) == string[string])); static assert(is(typeof(_anchor_tag) == string)); static assert(is(typeof(lev4_subtoc) == string[][string])); static assert(is(typeof(the_table_of_contents_section) == ObjGenericComposite[][string])); @@ -4849,10 +4850,10 @@ template DocReformDocAbstraction() { "{ %s }%s%s%s", heading_toc_, mkup.mark_internal_site_lnk, - segment_anchor_tag_that_object_belongs_to, + segment_anchor_tag_that_object_belongs_to["html"], ".fnSuffix", ); - lev4_subtoc[segment_anchor_tag_that_object_belongs_to] = []; + lev4_subtoc[segment_anchor_tag_that_object_belongs_to["html"]] = []; toc_txt_= munge.url_links(toc_txt_); indent=[ "hang_position" : obj_["lev_markup_number"].to!int, @@ -4869,7 +4870,7 @@ template DocReformDocAbstraction() { "{ %s }%s%s%s#%s", heading_toc_, mkup.mark_internal_site_lnk, - segment_anchor_tag_that_object_belongs_to, + segment_anchor_tag_that_object_belongs_to["html"], ".fnSuffix", _anchor_tag, ); @@ -4878,7 +4879,7 @@ template DocReformDocAbstraction() { heading_toc_, _anchor_tag, ); - lev4_subtoc[segment_anchor_tag_that_object_belongs_to] + lev4_subtoc[segment_anchor_tag_that_object_belongs_to["html"]] ~= munge.url_links(obj_["lev_markup_number"] ~ "~ " ~ subtoc_txt_.to!string.strip ); @@ -5363,7 +5364,7 @@ template DocReformDocAbstraction() { string[][string][string] bookindex_nugget_hash(BI,N,S)( BI bookindex_section, N obj_cite_digits, - S segment_anchor_tag, + S segment_anchor_tag_that_object_belongs_to, ) in { debug(asserts) { @@ -5374,7 +5375,7 @@ template DocReformDocAbstraction() { if (!bookindex_section.empty) { writeln( "* [bookindex] ", - "[", obj_cite_digits.on.to!string, ": ", segment_anchor_tag, "] ", bookindex_section + "[", obj_cite_digits.on.to!string, ": ", segment_anchor_tag_that_object_belongs_to["html"], "] ", bookindex_section ); } } @@ -5395,11 +5396,11 @@ template DocReformDocAbstraction() { object_number_endpoint=(obj_cite_digits.on + object_number_offset); object_numbers ~= (obj_cite_digits.on.to!string ~ "-" ~ object_number_endpoint.to!string - ~ ":" ~ segment_anchor_tag); + ~ ":" ~ segment_anchor_tag_that_object_belongs_to["html"]); } else { main_term = bi_main_term_and_rest[0].strip; object_numbers ~= obj_cite_digits.on.to!string - ~ ":" ~ segment_anchor_tag; + ~ ":" ~ segment_anchor_tag_that_object_belongs_to["html"]; } bi[main_term]["_a"] ~= object_numbers; object_numbers=null; @@ -5415,11 +5416,11 @@ template DocReformDocAbstraction() { object_number_endpoint=(obj_cite_digits.on + object_number_offset); object_numbers ~= (obj_cite_digits.on.to!string ~ " - " ~ object_number_endpoint.to!string - ~ ":" ~ segment_anchor_tag); + ~ ":" ~ segment_anchor_tag_that_object_belongs_to["html"]); } else { sub_term = sub_terms_bits.strip; object_numbers ~= obj_cite_digits.on.to!string - ~ ":" ~ segment_anchor_tag; + ~ ":" ~ segment_anchor_tag_that_object_belongs_to["html"]; } if (!empty(sub_term)) { bi[main_term][sub_term] ~= object_numbers; @@ -5534,8 +5535,8 @@ template DocReformDocAbstraction() { comp_obj_heading_.metainfo.ocn = 0; 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_.tags.segment_anchor_tag_html = "_part_book_index"; + comp_obj_heading_.tags.segment_anchor_tag_epub = comp_obj_heading_.tags.segment_anchor_tag_html; comp_obj_heading_.metainfo.heading_lev_markup = 1; comp_obj_heading_.metainfo.heading_lev_collapsed = 1; comp_obj_heading_.metainfo.parent_ocn = 1; @@ -5553,8 +5554,8 @@ template DocReformDocAbstraction() { comp_obj_heading_.metainfo.ocn = 0; 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_.tags.segment_anchor_tag_html = "bookindex"; + comp_obj_heading_.tags.segment_anchor_tag_epub = comp_obj_heading_.tags.segment_anchor_tag_html; comp_obj_heading_.metainfo.heading_lev_markup = 4; comp_obj_heading_.metainfo.heading_lev_collapsed = 2; comp_obj_heading_.metainfo.parent_ocn = 1; @@ -5653,7 +5654,10 @@ template DocReformDocAbstraction() { bookindex_section["scroll"] ~= comp_obj_heading_; bookindex_section["seg"] ~= comp_obj_heading_; } - auto t = tuple(bookindex_section, obj_cite_digits); + auto t = tuple( + bookindex_section, + obj_cite_digits + ); return t; } } @@ -5665,7 +5669,7 @@ template DocReformDocAbstraction() { static auto rgx = Rgx(); private auto gather_notes_for_endnote_section( ObjGenericComposite[] contents_am, - string segment_anchor_tag_that_object_belongs_to, + string[string] segment_anchor_tag_that_object_belongs_to, int cntr, ) in { @@ -5696,13 +5700,13 @@ template DocReformDocAbstraction() { writeln( "{^{", m.captures[1], ".}^}" ~ mkup.mark_internal_site_lnk, - segment_anchor_tag_that_object_belongs_to, + segment_anchor_tag_that_object_belongs_to["html"], ".fnSuffix#noteref_\n ", m.captures[1], " ", m.captures[2]); // sometimes need segment name (segmented html & epub) } // 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) + object_notes["notes"] ~= (segment_anchor_tag_that_object_belongs_to["html"].empty) ? (munge.url_links( "{^{" ~ m.captures[1] ~ ".}^}#noteref_" ~ m.captures[1]) ~ " " @@ -5711,7 +5715,7 @@ template DocReformDocAbstraction() { : (munge.url_links( "{^{" ~ m.captures[1] ~ ".}^}" ~ mkup.mark_internal_site_lnk - ~ segment_anchor_tag_that_object_belongs_to + ~ segment_anchor_tag_that_object_belongs_to["html"] ~ ".fnSuffix#noteref_" ~ m.captures[1]) ~ " " ~ m.captures[2] ~ "』" @@ -5759,8 +5763,8 @@ template DocReformDocAbstraction() { comp_obj_heading_.metainfo.ocn = 0; 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_.tags.segment_anchor_tag_html = "_part_endnotes"; + comp_obj_heading_.tags.segment_anchor_tag_epub = comp_obj_heading_.tags.segment_anchor_tag_html; comp_obj_heading_.metainfo.heading_lev_markup = 1; comp_obj_heading_.metainfo.heading_lev_collapsed = 1; comp_obj_heading_.metainfo.parent_ocn = 1; @@ -5776,8 +5780,8 @@ template DocReformDocAbstraction() { comp_obj_heading_.metainfo.ocn = 0; 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_.tags.segment_anchor_tag_html = "endnotes"; + comp_obj_heading_.tags.segment_anchor_tag_epub = comp_obj_heading_.tags.segment_anchor_tag_html; comp_obj_heading_.metainfo.heading_lev_markup = 4; comp_obj_heading_.metainfo.heading_lev_collapsed = 2; comp_obj_heading_.metainfo.parent_ocn = 1; @@ -5936,7 +5940,7 @@ template DocReformDocAbstraction() { static auto rgx = Rgx(); ObjGenericComposite node_location_emitter(Lv,Tg,La,Ta,N,C,P,I)( Lv lev_markup_number, - Tg segment_anchor_tag, + Tg segment_anchor_tag_that_object_belongs_to, La lev_anchor_tag, Ta tag_assoc_html, N obj_cite_digits, @@ -5947,7 +5951,7 @@ template DocReformDocAbstraction() { in { debug(asserts) { static assert(is(typeof(lev_markup_number) == string)); - static assert(is(typeof(segment_anchor_tag) == string)); + static assert(is(typeof(segment_anchor_tag_that_object_belongs_to) == string[string])); static assert(is(typeof(obj_cite_digits.on) == int)); static assert(is(typeof(cntr_) == int)); static assert(is(typeof(ptr_) == int)); @@ -5976,8 +5980,8 @@ template DocReformDocAbstraction() { comp_obj_location = comp_obj_location.init; 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.segment_anchor_tag_html = segment_anchor_tag_that_object_belongs_to["html"]; + comp_obj_location.tags.segment_anchor_tag_epub = segment_anchor_tag_that_object_belongs_to["epub"]; 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"]; @@ -6018,7 +6022,7 @@ template DocReformDocAbstraction() { 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(segment_anchor_tag_that_object_belongs_to) == string[string])); static assert(is(typeof(obj_cite_digits.on) == int)); static assert(is(typeof(cntr_) == int)); static assert(is(typeof(ptr_) == int)); @@ -6136,9 +6140,10 @@ 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_that_object_belongs_to; + _comp_obj_heading_.tags.segment_anchor_tag_html = segment_anchor_tag_that_object_belongs_to["html"]; + _comp_obj_heading_.tags.segment_anchor_tag_epub = _comp_obj_heading_.tags.segment_anchor_tag_html; _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_.tags.segment_anchor_tag_is = segment_anchor_tag_that_object_belongs_to["html"]; _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 ee2dc78..ebff33b 100644 --- a/src/doc_reform/meta/object_setter.d +++ b/src/doc_reform/meta/object_setter.d @@ -104,7 +104,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_html = ""; + string segment_anchor_tag_epub = ""; string segment_anchor_tag_is = ""; string heading_lev_anchor_tag = ""; string segname_prev = ""; diff --git a/src/doc_reform/output/epub3.d b/src/doc_reform/output/epub3.d index 18d9e03..1bcf13d 100644 --- a/src/doc_reform/output/epub3.d +++ b/src/doc_reform/output/epub3.d @@ -109,14 +109,14 @@ template outputEPub3() { writefln( "%s~ [%s.xhtml] %s", obj.marked_up_level, - obj.tags.segment_anchor_tag, + obj.tags.segment_anchor_tag_epub, obj.text ); } else if (obj.metainfo.heading_lev_markup > 4) { writefln( "%s~ [%s.xhtml#%s] %s", obj.marked_up_level, - obj.tags.segment_anchor_tag, + obj.tags.segment_anchor_tag_epub, obj.metainfo.object_number, obj.text ); @@ -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_is ~ ".xhtml" ~ "\">" + ~ "<a href=\"" ~ obj.tags.segment_anchor_tag_epub ~ ".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_is ~ ".xhtml" ~ hashtag ~ "\">" + ~ "<a href=\"" ~ obj.tags.segment_anchor_tag_epub ~ ".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_is ~ ".xhtml" ~ "\">" + ~ "<a href=\"" ~ obj.tags.segment_anchor_tag_epub ~ ".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_is ~ ".xhtml" ~ hashtag ~ "\">" + ~ "<a href=\"" ~ obj.tags.segment_anchor_tag_epub ~ ".xhtml" ~ hashtag ~ "\">" ~ _txt ~ "</a>" ~ "\n"; } @@ -262,7 +262,7 @@ template outputEPub3() { <content src="%s.xhtml%s" />¶", counter, _txt, - obj.tags.segment_anchor_tag_is, + obj.tags.segment_anchor_tag_epub, hashtag, ); break; @@ -276,7 +276,7 @@ template outputEPub3() { <content src="%s.xhtml%s" />¶", counter, _txt, - obj.tags.segment_anchor_tag_is, + obj.tags.segment_anchor_tag_epub, hashtag, ); break; @@ -335,16 +335,16 @@ template outputEPub3() { top_level_headings[3] = ""; goto default; default: - doc_parts_ ~= obj.tags.segment_anchor_tag; - doc_epub3[obj.tags.segment_anchor_tag] ~= xhtml_format.epub3_seg_head(doc_matters); + doc_parts_ ~= obj.tags.segment_anchor_tag_epub; + doc_epub3[obj.tags.segment_anchor_tag_epub] ~= xhtml_format.epub3_seg_head(doc_matters); auto t = xhtml_format.heading_seg(doc_matters, obj, _txt, suffix, "epub"); - doc_epub3[obj.tags.segment_anchor_tag] ~= t[0]; - doc_epub3_endnotes[obj.tags.segment_anchor_tag] ~= t[1]; + doc_epub3[obj.tags.segment_anchor_tag_epub] ~= t[0]; + doc_epub3_endnotes[obj.tags.segment_anchor_tag_epub] ~= t[1]; break; } break; case 4: - segment_filename = obj.tags.segment_anchor_tag; + segment_filename = obj.tags.segment_anchor_tag_epub; doc_epub3[segment_filename] ~= xhtml_format.epub3_seg_head(doc_matters); auto t = xhtml_format.heading_seg(doc_matters, obj, _txt, suffix, "epub"); doc_epub3[segment_filename] ~= t[0]; @@ -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_is, - obj.tags.segment_anchor_tag_is, + obj.tags.segment_anchor_tag_epub, + obj.tags.segment_anchor_tag_epub, ); oepbs_content_parts["spine"] ~= format(q"¶ <itemref idref="%s.xhtml" linear="yes" /> ¶", - obj.tags.segment_anchor_tag_is, + obj.tags.segment_anchor_tag_epub, ); oepbs_content_parts["guide"] ~= format(q"¶ <reference type="%s" href="%s" /> ¶", - obj.tags.segment_anchor_tag_is, - obj.tags.segment_anchor_tag_is, + obj.tags.segment_anchor_tag_epub, + obj.tags.segment_anchor_tag_epub, ); } 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_is, + obj.tags.segment_anchor_tag_epub, obj.metainfo.object_number, - obj.tags.segment_anchor_tag_is, + obj.tags.segment_anchor_tag_epub, obj.metainfo.object_number, ); oepbs_content_parts["spine"] ~= format(q"¶ <itemref idref="%s.xhtml#%s" linear="yes" /> ¶", - obj.tags.segment_anchor_tag_is, + obj.tags.segment_anchor_tag_epub, obj.metainfo.object_number, ); oepbs_content_parts["guide"] ~= format(q"¶ <reference type="%s#%s" href="%s#%s" /> ¶", - obj.tags.segment_anchor_tag_is, + obj.tags.segment_anchor_tag_epub, obj.metainfo.object_number, - obj.tags.segment_anchor_tag_is, + obj.tags.segment_anchor_tag_epub, obj.metainfo.object_number, ); } diff --git a/src/doc_reform/output/html.d b/src/doc_reform/output/html.d index bad29db..3424dc9 100644 --- a/src/doc_reform/output/html.d +++ b/src/doc_reform/output/html.d @@ -232,7 +232,7 @@ template outputHTML() { } break; case 4: - segment_filename = obj.tags.segment_anchor_tag; + segment_filename = obj.tags.segment_anchor_tag_epub; doc_html[segment_filename] ~= xhtml_format.html_head(doc_matters, "seg"); auto navigation_bar = xhtml_format.nav_pre_next_svg(doc_matters, obj); doc_html[segment_filename] ~= navigation_bar.toc_pre_next; diff --git a/src/doc_reform/output/xmls.d b/src/doc_reform/output/xmls.d index 571c1af..bc93271 100644 --- a/src/doc_reform/output/xmls.d +++ b/src/doc_reform/output/xmls.d @@ -529,7 +529,7 @@ template outputXHTMLs() { const O obj, ) { string prev, next, toc; - if (obj.tags.segment_anchor_tag == "toc") { + if (obj.tags.segment_anchor_tag_epub == "toc") { toc = ""; prev = ""; } else { |