From 4c50f7ab56eddd9d85a5a76eba3fbc971d338038 Mon Sep 17 00:00:00 2001 From: Ralph Amissah Date: Mon, 22 Oct 2018 17:04:58 -0400 Subject: 0.2.1 segnames, anchor tags --- org/default_misc.org | 3 +- org/doc_reform.org | 6 +- org/meta_abstraction.org | 216 +++++++++++++++++---------------- org/meta_debugs.org | 8 +- org/output_xmls.org | 50 ++++---- src/doc_reform/meta/defaults.d | 3 +- src/doc_reform/meta/doc_debugs.d | 8 +- src/doc_reform/meta/metadoc.d | 4 + src/doc_reform/meta/metadoc_from_src.d | 213 ++++++++++++++++---------------- src/doc_reform/meta/object_setter.d | 3 +- src/doc_reform/output/epub3.d | 46 +++---- src/doc_reform/output/html.d | 2 +- src/doc_reform/output/xmls.d | 2 +- views/version.txt | 2 +- 14 files changed, 294 insertions(+), 272 deletions(-) diff --git a/org/default_misc.org b/org/default_misc.org index 5d175ee..59e7320 100644 --- a/org/default_misc.org +++ b/org/default_misc.org @@ -87,7 +87,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/org/doc_reform.org b/org/doc_reform.org index e98cdc5..a04f650 100644 --- a/org/doc_reform.org +++ b/org/doc_reform.org @@ -24,7 +24,7 @@ struct Version { int minor; int patch; } -enum ver = Version(0, 2, 0); +enum ver = Version(0, 2, 1); #+END_SRC ** compilation restrictions (supported compilers) @@ -931,6 +931,10 @@ auto doc_abstraction = da[docAbst.doc_abstraction]; /+ head ~ toc ~ body ~ endno 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/org/meta_abstraction.org b/org/meta_abstraction.org index 7f200bf..ee94ebc 100644 --- a/org/meta_abstraction.org +++ b/org/meta_abstraction.org @@ -186,12 +186,11 @@ string an_object_key; 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 } @@ -429,7 +428,7 @@ auto inline_para_link_anchor(O,St,TA)(O an_object, St segment_anchor_tag_that_ob 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"]); } @@ -535,8 +534,8 @@ comp_obj_heading_.text = "Table of Conte 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; @@ -711,8 +710,8 @@ if there is a glossary section you need to: 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; @@ -729,8 +728,8 @@ if there is a glossary section you need to: 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; @@ -832,8 +831,8 @@ if there is a blurb section you need to: 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; @@ -850,8 +849,8 @@ if there is a blurb section you need to: 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; @@ -871,8 +870,8 @@ if there is a blurb section you need to: 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; @@ -1200,22 +1199,22 @@ if ((obj_type_status["heading"] == State.on) && (!(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) { @@ -1235,8 +1234,10 @@ if ((obj_type_status["heading"] == State.on) ++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; @@ -1257,7 +1258,7 @@ if ((obj_type_status["heading"] == State.on) 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++; } @@ -1282,7 +1283,7 @@ if ((obj_type_status["heading"] == State.on) ++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 @@ -1330,7 +1331,7 @@ if ((obj_type_status["heading"] == State.on) 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; @@ -1493,8 +1494,8 @@ if (biblio_ordered.length > 0) { 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; @@ -1509,8 +1510,8 @@ if (biblio_ordered.length > 0) { 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; @@ -1649,8 +1650,8 @@ if (an_object["blurb_nugget"].length == 0) { 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; @@ -2310,7 +2311,7 @@ foreach (ref obj; the_document_head_section) { 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 @@ -2346,11 +2347,10 @@ if (the_table_of_contents_section["scroll"].length > 1) { 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) +/ @@ -2375,11 +2375,11 @@ if (the_table_of_contents_section["scroll"].length > 1) { 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) @@ -2407,15 +2407,15 @@ if (the_document_body_section.length > 1) { 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) +/ @@ -2458,14 +2458,14 @@ if (the_endnotes_section.length > 1) { 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) +/ @@ -2500,14 +2500,14 @@ if (the_glossary_section.length > 1) { 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) +/ @@ -2545,14 +2545,14 @@ if (the_bibliography_section.length > 1) { 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) +/ @@ -2595,14 +2595,13 @@ if (the_bookindex_section["scroll"].length > 1) { 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) +/ @@ -2633,14 +2632,14 @@ if (the_bookindex_section["scroll"].length > 1) { } 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) +/ @@ -2681,14 +2680,14 @@ if (the_blurb_section.length > 1) { 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) +/ @@ -2827,7 +2826,9 @@ comp_obj_heading_.metainfo.is_a = "heading"; 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; @@ -3820,7 +3821,7 @@ void _poem_block_(L,O,T,C,N,CMM,Ts)( 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"]; @@ -3881,7 +3882,7 @@ void _poem_block_(L,O,T,C,N,CMM,Ts)( 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"]; @@ -3925,7 +3926,7 @@ void _poem_block_(L,O,T,C,N,CMM,Ts)( 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"]; @@ -3986,7 +3987,7 @@ void _poem_block_(L,O,T,C,N,CMM,Ts)( 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"]; @@ -4127,7 +4128,7 @@ void _table_closed_make_special_notation_table_(N,CMM)( 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"]); @@ -4209,7 +4210,7 @@ void _block_flag_line_empty_(B,N,CMM,Ts)( 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"]; @@ -4262,7 +4263,7 @@ void _block_flag_line_empty_(B,N,CMM,Ts)( 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"]; @@ -4313,7 +4314,7 @@ void _block_flag_line_empty_(B,N,CMM,Ts)( 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"]; @@ -4407,7 +4408,7 @@ void _block_flag_line_empty_(B,N,CMM,Ts)( 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"]; @@ -4455,7 +4456,7 @@ void _block_flag_line_empty_(B,N,CMM,Ts)( 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"]); @@ -5865,7 +5866,7 @@ static struct ObjInlineMarkup { 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])); @@ -5970,10 +5971,10 @@ static struct ObjInlineMarkup { "{ %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, @@ -5990,7 +5991,7 @@ static struct ObjInlineMarkup { "{ %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, ); @@ -5999,7 +6000,7 @@ static struct ObjInlineMarkup { 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 ); @@ -6610,7 +6611,7 @@ struct BookIndexNuggetHash { 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) { @@ -6621,7 +6622,7 @@ struct BookIndexNuggetHash { 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 ); } } @@ -6642,11 +6643,11 @@ struct BookIndexNuggetHash { 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; @@ -6662,11 +6663,11 @@ struct BookIndexNuggetHash { 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; @@ -6806,8 +6807,8 @@ struct BookIndexReportSection { 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; @@ -6825,8 +6826,8 @@ struct BookIndexReportSection { 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; @@ -6925,7 +6926,10 @@ struct BookIndexReportSection { 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; } #+END_SRC @@ -6954,7 +6958,7 @@ struct NotesSection { #+BEGIN_SRC d 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 { @@ -6985,13 +6989,13 @@ struct NotesSection { 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]) ~ " " @@ -7000,7 +7004,7 @@ struct NotesSection { : (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] ~ "』" @@ -7060,8 +7064,8 @@ struct NotesSection { 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; @@ -7077,8 +7081,8 @@ struct NotesSection { 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; @@ -7291,7 +7295,7 @@ struct NodeStructureMetadata { #+BEGIN_SRC d 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, @@ -7302,7 +7306,7 @@ struct NodeStructureMetadata { 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)); @@ -7331,8 +7335,8 @@ struct NodeStructureMetadata { 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"]; @@ -7379,7 +7383,7 @@ struct NodeStructureMetadata { 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)); @@ -7497,9 +7501,10 @@ struct NodeStructureMetadata { _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"]; @@ -7939,7 +7944,8 @@ struct DocObj_Pointer_ { } 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/org/meta_debugs.org b/org/meta_debugs.org index 687e1b2..b6e94d4 100644 --- a/org/meta_debugs.org +++ b/org/meta_debugs.org @@ -305,12 +305,12 @@ debug(toc_nav_dom) { writeln(markup.indent_by_spaces_provided(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; @@ -332,12 +332,12 @@ debug(toc_nav_dom) { writeln(markup.indent_by_spaces_provided(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/org/output_xmls.org b/org/output_xmls.org index 12b37a1..060a75c 100644 --- a/org/output_xmls.org +++ b/org/output_xmls.org @@ -683,7 +683,7 @@ auto nav_pre_next_svg(M,O)( 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 { @@ -1654,7 +1654,7 @@ void seg(D,M)( } 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; @@ -2077,14 +2077,14 @@ string epub3_oebps_content(D,M,P)(D doc_abstraction, M doc_matters, P parts) { 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 ); @@ -2136,7 +2136,7 @@ string epub3_oebps_toc_nav_xhtml(D,I)(D doc_abstraction, I doc_matters) { if (obj.metainfo.heading_lev_markup < 4) { toc ~= markup.indent_by_spaces_provided((n + 1), " ") ~ "
  • " ~ "\n" ~ markup.indent_by_spaces_provided((n + 2), " ") - ~ "" + ~ "" ~ _txt ~ "" ~ "\n"; } else { @@ -2145,7 +2145,7 @@ string epub3_oebps_toc_nav_xhtml(D,I)(D doc_abstraction, I doc_matters) { : ("#" ~ obj.metainfo.ocn.to!string); toc ~= markup.indent_by_spaces_provided((n + 1), " ") ~ "
  • " ~ "\n" ~ markup.indent_by_spaces_provided((n + 2), " ") - ~ "" + ~ "" ~ _txt ~ "" ~ "\n"; } @@ -2155,7 +2155,7 @@ string epub3_oebps_toc_nav_xhtml(D,I)(D doc_abstraction, I doc_matters) { if (obj.metainfo.heading_lev_markup < 4) { toc ~= markup.indent_by_spaces_provided((n + 1), " ") ~ "
  • " ~ "\n" ~ markup.indent_by_spaces_provided((n + 2), " ") - ~ "" + ~ "" ~ _txt ~ "" ~ "\n"; } else { @@ -2164,7 +2164,7 @@ string epub3_oebps_toc_nav_xhtml(D,I)(D doc_abstraction, I doc_matters) { : ("#" ~ obj.metainfo.ocn.to!string); toc ~= markup.indent_by_spaces_provided((n + 1), " ") ~ "
  • " ~ "\n" ~ markup.indent_by_spaces_provided((n + 2), " ") - ~ "" + ~ "" ~ _txt ~ "" ~ "\n"; } @@ -2247,7 +2247,7 @@ string epub2_oebps_toc_ncx(D,I)(D doc_abstraction, I doc_matters) { ¶", counter, _txt, - obj.tags.segment_anchor_tag_is, + obj.tags.segment_anchor_tag_epub, hashtag, ); break; @@ -2261,7 +2261,7 @@ string epub2_oebps_toc_ncx(D,I)(D doc_abstraction, I doc_matters) { ¶", counter, _txt, - obj.tags.segment_anchor_tag_is, + obj.tags.segment_anchor_tag_epub, hashtag, ); break; @@ -2326,16 +2326,16 @@ void outputEPub3(D,I)( 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]; @@ -2503,41 +2503,41 @@ void outputEPub3(D,I)( oepbs_content_parts["manifest_documents"] ~= format(q"¶ ¶", - 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"¶ ¶", - obj.tags.segment_anchor_tag_is, + obj.tags.segment_anchor_tag_epub, ); oepbs_content_parts["guide"] ~= format(q"¶ ¶", - 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"¶ ¶", - 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"¶ ¶", - obj.tags.segment_anchor_tag_is, + obj.tags.segment_anchor_tag_epub, obj.metainfo.object_number, ); oepbs_content_parts["guide"] ~= format(q"¶ ¶", - 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/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), ""); 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), ""); 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), " ") ~ "
  • " ~ "\n" ~ markup.indent_by_spaces_provided((n + 2), " ") - ~ "" + ~ "" ~ _txt ~ "" ~ "\n"; } else { @@ -169,7 +169,7 @@ template outputEPub3() { : ("#" ~ obj.metainfo.ocn.to!string); toc ~= markup.indent_by_spaces_provided((n + 1), " ") ~ "
  • " ~ "\n" ~ markup.indent_by_spaces_provided((n + 2), " ") - ~ "" + ~ "" ~ _txt ~ "" ~ "\n"; } @@ -179,7 +179,7 @@ template outputEPub3() { if (obj.metainfo.heading_lev_markup < 4) { toc ~= markup.indent_by_spaces_provided((n + 1), " ") ~ "
  • " ~ "\n" ~ markup.indent_by_spaces_provided((n + 2), " ") - ~ "" + ~ "" ~ _txt ~ "" ~ "\n"; } else { @@ -188,7 +188,7 @@ template outputEPub3() { : ("#" ~ obj.metainfo.ocn.to!string); toc ~= markup.indent_by_spaces_provided((n + 1), " ") ~ "
  • " ~ "\n" ~ markup.indent_by_spaces_provided((n + 2), " ") - ~ "" + ~ "" ~ _txt ~ "" ~ "\n"; } @@ -262,7 +262,7 @@ template outputEPub3() { ¶", counter, _txt, - obj.tags.segment_anchor_tag_is, + obj.tags.segment_anchor_tag_epub, hashtag, ); break; @@ -276,7 +276,7 @@ template outputEPub3() { ¶", 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"¶ ¶", - 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"¶ ¶", - obj.tags.segment_anchor_tag_is, + obj.tags.segment_anchor_tag_epub, ); oepbs_content_parts["guide"] ~= format(q"¶ ¶", - 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"¶ ¶", - 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"¶ ¶", - obj.tags.segment_anchor_tag_is, + obj.tags.segment_anchor_tag_epub, obj.metainfo.object_number, ); oepbs_content_parts["guide"] ~= format(q"¶ ¶", - 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 { diff --git a/views/version.txt b/views/version.txt index d777504..9da2490 100644 --- a/views/version.txt +++ b/views/version.txt @@ -4,7 +4,7 @@ struct Version { int minor; int patch; } -enum ver = Version(0, 2, 0); +enum ver = Version(0, 2, 1); version (Posix) { version (DigitalMars) { } else version (LDC) { -- cgit v1.2.3