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 --- src/doc_reform/meta/metadoc_from_src.d | 213 +++++++++++++++++---------------- 1 file changed, 109 insertions(+), 104 deletions(-) (limited to 'src/doc_reform/meta/metadoc_from_src.d') 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"]; -- cgit v1.2.3