diff options
Diffstat (limited to 'src/doc_reform/meta')
-rw-r--r-- | src/doc_reform/meta/defaults.d | 28 | ||||
-rw-r--r-- | src/doc_reform/meta/doc_debugs.d | 20 | ||||
-rw-r--r-- | src/doc_reform/meta/metadoc.d | 32 | ||||
-rw-r--r-- | src/doc_reform/meta/metadoc_from_src.d | 1262 | ||||
-rw-r--r-- | src/doc_reform/meta/metadoc_summary.d | 8 | ||||
-rw-r--r-- | src/doc_reform/meta/object_setter.d | 6 | ||||
-rw-r--r-- | src/doc_reform/meta/rgx.d | 4 |
7 files changed, 623 insertions, 737 deletions
diff --git a/src/doc_reform/meta/defaults.d b/src/doc_reform/meta/defaults.d index fd13b44..661234c 100644 --- a/src/doc_reform/meta/defaults.d +++ b/src/doc_reform/meta/defaults.d @@ -130,20 +130,20 @@ template InternalMarkup() { auto lnk_o = "┥"; auto lnk_c = "┝"; auto url_o = "┤"; auto url_c = "├"; auto mark_internal_site_lnk = "¤"; - auto nbsp = "░"; - auto br_line = "┘"; - auto br_nl = "┙"; - auto br_paragraph = "┚"; - auto br_obj = "break_obj"; - auto br_page_line = "┼"; - auto br_page = "┿"; - auto br_page_new = "╂"; - auto tc_s = "┊"; - auto tc_o = "┏"; - auto tc_c = "┚"; - auto tc_p = "┆"; - auto mono = "■"; - auto img = "☼"; + auto nbsp = "░"; + auto br_line = "┘"; + auto br_nl = "┙"; + auto br_paragraph = "┚"; + auto br_obj = "break_obj"; + auto br_page_line = "┼"; + auto br_page = "┿"; + auto br_page_new = "╂"; + auto tc_s = "┊"; + auto tc_o = "┏"; + auto tc_c = "┚"; + auto tc_p = "┆"; + auto mono = "■"; + auto img = "☼"; static string indent_by_spaces_provided(int indent, string _indent_spaces ="░░") { _indent_spaces = replicate(_indent_spaces, indent); return _indent_spaces; diff --git a/src/doc_reform/meta/doc_debugs.d b/src/doc_reform/meta/doc_debugs.d index ae3ab98..8765c06 100644 --- a/src/doc_reform/meta/doc_debugs.d +++ b/src/doc_reform/meta/doc_debugs.d @@ -74,21 +74,17 @@ template DocReformDebugs() { } } debug(section_toc) { - key="toc_seg"; + key="toc"; out_toc(contents, key); } - debug(section_toc_seg) { - key="toc_seg"; + debug(section_toc) { + key="toc"; out_toc(contents, key); } - debug(section_toc_scroll) { - key="toc_scroll"; + debug(section_toc) { + key="toc"; out_toc(contents, key); } - debug(segnames) { - writeln(__LINE__); - out_segnames(contents, doc_matters); - } debug(section_body) { key="body"; if (contents[key].length > 1) { @@ -202,11 +198,11 @@ template DocReformDebugs() { } } debug(section_bookindex) { - key="bookindex_seg"; + key="bookindex"; out_bookindex(contents, key); } - debug(section_bookindex_seg) { - key="bookindex_seg"; + debug(section_bookindex) { + key="bookindex"; out_bookindex(contents, key); } debug(section_bookindex_scroll) { diff --git a/src/doc_reform/meta/metadoc.d b/src/doc_reform/meta/metadoc.d index e164f36..4cb218e 100644 --- a/src/doc_reform/meta/metadoc.d +++ b/src/doc_reform/meta/metadoc.d @@ -40,7 +40,9 @@ template DocReformAbstraction() { _make_and_meta_struct = configParseTOMLreturnDocReformStruct!()(_make_and_meta_struct, _config_local_site_struct); /+ ↓ read file (filename with path) +/ /+ ↓ file tuple of header and content +/ - debug(steps) { + if ((_opt_action.debug_do) + || (_opt_action.very_verbose) + ) { writeln("step1 commence → (get document header & body & insert file list & if needed image list)" ); } @@ -48,7 +50,9 @@ template DocReformAbstraction() { = DocReformRawMarkupContent!()(_opt_action, _manifest.src.path_and_fn); static assert(!isTypeTuple!(_header_body_insertfilelist_imagelist)); static assert(_header_body_insertfilelist_imagelist.length==4); - debug(steps) { + if ((_opt_action.debug_do) + || (_opt_action.very_verbose) + ) { writeln("- step1 complete"); } debug(header_and_body) { @@ -57,7 +61,9 @@ template DocReformAbstraction() { writeln(_header_body_insertfilelist_imagelist.length[headBody.body_content][0]); } /+ ↓ split header into make and meta +/ - debug(steps) { + if ((_opt_action.debug_do) + || (_opt_action.very_verbose) + ) { writeln("step2 commence → (read document header - toml, return struct)"); } _make_and_meta_struct = @@ -65,11 +71,15 @@ template DocReformAbstraction() { _make_and_meta_struct, _header_body_insertfilelist_imagelist[headBody.header] ); - debug(steps) { + if ((_opt_action.debug_do) + || (_opt_action.very_verbose) + ) { writeln("- step2 complete"); } /+ ↓ document abstraction: process document, return abstraction as tuple +/ - debug(steps) { + if ((_opt_action.debug_do) + || (_opt_action.very_verbose) + ) { writeln("step3 commence → (document abstraction (da); da keys; segnames; doc_matters)"); } auto da = DocReformDocAbstraction!()( @@ -91,10 +101,14 @@ template DocReformAbstraction() { } auto _doc_tag_assoc = da[docAbst.tag_assoc]; auto _images = da[docAbst.images]; - debug(steps) { + if ((_opt_action.debug_do) + || (_opt_action.very_verbose) + ) { writeln("- step3 complete"); } - debug(steps) { + if ((_opt_action.debug_do) + || (_opt_action.very_verbose) + ) { writeln("step4 commence → (doc_matters)"); } struct DocumentMatters { @@ -175,7 +189,9 @@ template DocReformAbstraction() { } } auto doc_matters = DocumentMatters(); - debug(steps) { + if ((_opt_action.debug_do) + || (_opt_action.very_verbose) + ) { writeln("- step4 complete"); } auto t = tuple(doc_abstraction, doc_matters); diff --git a/src/doc_reform/meta/metadoc_from_src.d b/src/doc_reform/meta/metadoc_from_src.d index 68f4433..64dd6e6 100644 --- a/src/doc_reform/meta/metadoc_from_src.d +++ b/src/doc_reform/meta/metadoc_from_src.d @@ -23,7 +23,7 @@ template DocReformDocAbstraction() { mixin DocReformRgxInit; /+ ↓ abstraction struct init +/ /+ initialize +/ - ObjGenericComposite[][string] the_table_of_contents_section; + ObjGenericComposite[] the_table_of_contents_section; ObjGenericComposite[] the_document_head_section, the_document_body_section, the_bibliography_section, the_glossary_section, the_blurb_section; ObjGenericComposite[] the_dom_tail_section; string[string] an_object, processing; @@ -31,11 +31,10 @@ template DocReformDocAbstraction() { string[] anchor_tags; string anchor_tag; string anchor_tag_; - string[string] segment_anchor_tag_that_object_belongs_to; + string[string] tag_in_seg; 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[string][string] tag_assoc; + string[] lv0_to_3_tags; /+ enum +/ enum State { off, on } enum TriState { off, on, closing } @@ -239,16 +238,21 @@ template DocReformDocAbstraction() { ObjGenericComposite comp_obj_heading, comp_obj_location, comp_obj_block, comp_obj_code, comp_obj_poem_ocn, comp_obj_comment; auto node_construct = NodeStructureMetadata(); enum sObj { content, anchor_tag, notes_reg, notes_star, links, image_no_dimensions } - auto inline_para_link_anchor(O,St,TA)(O an_object, St segment_anchor_tag_that_object_belongs_to, TA tag_assoc_html) { + auto inline_para_link_anchor(O,St,TA)( + O an_object, + St tag_in_seg, + TA tag_assoc + ) { 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["html"]]; + if (m.captures[1] !in tag_assoc) { + tag_assoc[(m.captures[1])]["seg_lv4"] = tag_in_seg["seg_lv4"]; + tag_assoc[(m.captures[1])]["seg_lv1_to_4"] = tag_in_seg["seg_lv1_to_4"]; } else { writeln("a tag named already exists, check text line\n ", an_object["substantive"]); } } - return tag_assoc_html; + return tag_assoc; } /+ ↓ abstract marked up document +/ auto DocReformDocAbstraction(Src,CMM,Opt,Mfst)( @@ -350,8 +354,9 @@ 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_html = "toc"; - comp_obj_heading_.tags.segment_anchor_tag_epub = comp_obj_heading_.tags.segment_anchor_tag_html; + comp_obj_heading_.tags.segment_anchor_tag_epub = "toc"; + comp_obj_heading_.tags.anchor_tag_html = comp_obj_heading_.tags.segment_anchor_tag_epub; + comp_obj_heading_.tags.in_segment_html = comp_obj_heading_.tags.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; @@ -360,18 +365,17 @@ template DocReformDocAbstraction() { comp_obj_heading_.tags.anchor_tags = ["toc"]; comp_obj_heading_.metainfo.dom_structure_markedup_tags_status = [ 1, 1, 0, 0, 1, 0, 0, 0]; comp_obj_heading_.metainfo.dom_structure_collapsed_tags_status = [ 1, 1, 1, 0, 0, 0, 0, 0]; + tag_assoc[comp_obj_heading_.tags.anchor_tag_html]["seg_lv4"] = comp_obj_heading_.tags.in_segment_html; + tag_assoc[comp_obj_heading_.tags.segment_anchor_tag_epub]["seg_lv1_to_4"] = comp_obj_heading_.tags.segment_anchor_tag_epub; auto toc_head = comp_obj_heading_; html_segnames_ptr_cntr++; - the_table_of_contents_section = [ - "seg": [toc_head], - "scroll": [toc_head], - ]; + the_table_of_contents_section = [toc_head]; static auto mkup = InlineMarkup(); static auto munge = ObjInlineMarkupMunge(); auto note_section = NotesSection(); auto bookindex_extract_hash = BookIndexNuggetHash(); string[][string] lev4_subtoc; - string[] html_segnames=["toc"]; + string[][string] segnames = ["html": ["toc"], "epub": ["toc"]]; int cnt1 = 1; int cnt2 = 1; int cnt3 = 1; /+ abstraction init ↑ +/ enum Substitute { match, markup, } @@ -490,8 +494,9 @@ 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_html = "_part_glossary"; - comp_obj_heading_.tags.segment_anchor_tag_epub = comp_obj_heading_.tags.segment_anchor_tag_html; + comp_obj_heading_.tags.segment_anchor_tag_epub = "_part_glossary"; + comp_obj_heading_.tags.anchor_tag_html = comp_obj_heading_.tags.segment_anchor_tag_epub; + comp_obj_heading_.tags.in_segment_html = "glossary"; comp_obj_heading_.metainfo.heading_lev_markup = 1; comp_obj_heading_.metainfo.heading_lev_collapsed = 1; comp_obj_heading_.metainfo.parent_ocn = 1; @@ -499,6 +504,8 @@ template DocReformDocAbstraction() { comp_obj_heading_.metainfo.dom_structure_markedup_tags_status = [ 1, 1, 0, 0, 0, 0, 0, 0]; comp_obj_heading_.metainfo.dom_structure_collapsed_tags_status = [ 1, 1, 0, 0, 0, 0, 0, 0]; the_glossary_section ~= comp_obj_heading_; + tag_assoc[comp_obj_heading_.tags.anchor_tag_html]["seg_lv4"] = comp_obj_heading_.tags.in_segment_html; + tag_assoc[comp_obj_heading_.tags.segment_anchor_tag_epub]["seg_lv1_to_4"] = comp_obj_heading_.tags.segment_anchor_tag_epub; comp_obj_heading_ = comp_obj_heading_.init; comp_obj_heading_.metainfo.is_of_part = "backmatter"; comp_obj_heading_.metainfo.is_of_section = "glossary"; @@ -508,8 +515,9 @@ 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_html = "glossary"; - comp_obj_heading_.tags.segment_anchor_tag_epub = comp_obj_heading_.tags.segment_anchor_tag_html; + comp_obj_heading_.tags.segment_anchor_tag_epub = "glossary"; + comp_obj_heading_.tags.anchor_tag_html = comp_obj_heading_.tags.segment_anchor_tag_epub; + comp_obj_heading_.tags.in_segment_html = comp_obj_heading_.tags.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; @@ -518,6 +526,8 @@ template DocReformDocAbstraction() { comp_obj_heading_.metainfo.dom_structure_collapsed_tags_status = [ 1, 1, 1, 0, 0, 0, 0, 0]; comp_obj_heading_.tags.anchor_tags = ["glossary"]; the_glossary_section ~= comp_obj_heading_; + tag_assoc[comp_obj_heading_.tags.anchor_tag_html]["seg_lv4"] = comp_obj_heading_.tags.in_segment_html; + tag_assoc[comp_obj_heading_.tags.segment_anchor_tag_epub]["seg_lv1_to_4"] = comp_obj_heading_.tags.segment_anchor_tag_epub; } else { _para_match_(line, an_object, an_object_key, indent, bullet, obj_type_status, line_occur); comp_obj_para = comp_obj_para.init; @@ -598,8 +608,9 @@ 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_html = "_part_blurb"; - comp_obj_heading_.tags.segment_anchor_tag_epub = comp_obj_heading_.tags.segment_anchor_tag_html; + comp_obj_heading_.tags.segment_anchor_tag_epub = "_part_blurb"; + comp_obj_heading_.tags.anchor_tag_html = comp_obj_heading_.tags.segment_anchor_tag_epub; + comp_obj_heading_.tags.in_segment_html = "blurb"; comp_obj_heading_.metainfo.heading_lev_markup = 1; comp_obj_heading_.metainfo.heading_lev_collapsed = 1; comp_obj_heading_.metainfo.parent_ocn = 1; @@ -607,6 +618,8 @@ template DocReformDocAbstraction() { comp_obj_heading_.metainfo.dom_structure_markedup_tags_status = [ 1, 1, 0, 0, 0, 0, 0, 0]; comp_obj_heading_.metainfo.dom_structure_collapsed_tags_status = [ 1, 1, 0, 0, 0, 0, 0, 0]; the_blurb_section ~= comp_obj_heading_; + tag_assoc[comp_obj_heading_.tags.anchor_tag_html]["seg_lv4"] = comp_obj_heading_.tags.in_segment_html; + tag_assoc[comp_obj_heading_.tags.segment_anchor_tag_epub]["seg_lv1_to_4"] = comp_obj_heading_.tags.segment_anchor_tag_epub; comp_obj_heading_ = comp_obj_heading_.init; comp_obj_heading_.metainfo.is_of_part = "backmatter"; comp_obj_heading_.metainfo.is_of_section = "blurb"; @@ -616,8 +629,9 @@ 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_html = "blurb"; - comp_obj_heading_.tags.segment_anchor_tag_epub = comp_obj_heading_.tags.segment_anchor_tag_html; + comp_obj_heading_.tags.segment_anchor_tag_epub = "blurb"; + comp_obj_heading_.tags.anchor_tag_html = comp_obj_heading_.tags.segment_anchor_tag_epub; + comp_obj_heading_.tags.in_segment_html = comp_obj_heading_.tags.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; @@ -626,6 +640,8 @@ template DocReformDocAbstraction() { comp_obj_heading_.metainfo.dom_structure_markedup_tags_status = [ 1, 1, 0, 0, 1, 0, 0, 0]; comp_obj_heading_.metainfo.dom_structure_collapsed_tags_status = [ 1, 1, 1, 0, 0, 0, 0, 0]; the_blurb_section ~= comp_obj_heading_; + tag_assoc[comp_obj_heading_.tags.anchor_tag_html]["seg_lv4"] = comp_obj_heading_.tags.in_segment_html; + tag_assoc[comp_obj_heading_.tags.segment_anchor_tag_epub]["seg_lv1_to_4"] = comp_obj_heading_.tags.segment_anchor_tag_epub; } else if (line.matchFirst(rgx.heading) && (opt_action.backmatter && opt_action.section_blurb)) { comp_obj_heading_ = comp_obj_heading_.init; @@ -637,13 +653,16 @@ 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_html = "blurb"; - comp_obj_heading_.tags.segment_anchor_tag_epub = comp_obj_heading_.tags.segment_anchor_tag_html; + comp_obj_heading_.tags.segment_anchor_tag_epub = "blurb"; + comp_obj_heading_.tags.anchor_tag_html = comp_obj_heading_.tags.segment_anchor_tag_epub; + comp_obj_heading_.tags.in_segment_html = comp_obj_heading_.tags.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; comp_obj_heading_.metainfo.parent_lev_markup = 0; the_blurb_section ~= comp_obj_heading_; + tag_assoc[comp_obj_heading_.tags.anchor_tag_html]["seg_lv4"] = comp_obj_heading_.tags.in_segment_html; + tag_assoc[comp_obj_heading_.tags.segment_anchor_tag_epub]["seg_lv1_to_4"] = comp_obj_heading_.tags.segment_anchor_tag_epub; } else { _para_match_(line, an_object, an_object_key, indent, bullet, obj_type_status, line_occur); comp_obj_para = comp_obj_para.init; @@ -695,7 +714,7 @@ template DocReformDocAbstraction() { continue; } else if (obj_type_status["poem"] == TriState.on) { /+ within block object: poem +/ - _poem_block_(line, an_object, obj_type_status, cntr, object_number_poem, conf_make_meta, segment_anchor_tag_that_object_belongs_to); + _poem_block_(line, an_object, obj_type_status, cntr, object_number_poem, conf_make_meta, tag_in_seg); continue; } else if (obj_type_status["table"] == TriState.on) { /+ within block object: table +/ @@ -834,7 +853,7 @@ template DocReformDocAbstraction() { obj_type_status, object_number_poem, conf_make_meta, - segment_anchor_tag_that_object_belongs_to, + tag_in_seg, ); } else { /+ line.empty, post contents, empty variables: +/ @@ -847,6 +866,11 @@ template DocReformDocAbstraction() { (obj_type_status["blocks"] == State.off), "code block status: none" ); + if (_new_doc) { + tag_assoc = tag_assoc.init; + lv0_to_3_tags = lv0_to_3_tags.init; + tag_in_seg = tag_in_seg.init; + } if ((obj_type_status["heading"] == State.on) && (line_occur["heading"] > State.off)) { /+ heading object (current line empty) +/ @@ -868,27 +892,29 @@ template DocReformDocAbstraction() { if ( an_object["lev_markup_number"].to!int == 4 && (!(anchor_tag.empty) - || (tag_assoc_lv0_to_lv3_html.length > 1)) + || (lv0_to_3_tags.length > 0)) ) { - segment_anchor_tag_that_object_belongs_to["html"] = anchor_tag; + tag_in_seg["seg_lv4"] = anchor_tag; + tag_in_seg["seg_lv1_to_4"] = anchor_tag; lev_anchor_tag = anchor_tag; - 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["html"]]; + tag_assoc[anchor_tag]["seg_lv4"] = tag_in_seg["seg_lv4"]; + tag_assoc[anchor_tag]["seg_lv1_to_4"] = tag_in_seg["seg_lv1_to_4"]; + if (lv0_to_3_tags.length > 0) { /+ 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; lv0_to_3_tags) { + tag_assoc[lv0_to_lv3_html_tag]["seg_lv4"] = anchor_tag; } } - 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; + lv0_to_3_tags = lv0_to_3_tags.init; } else if (an_object["lev_markup_number"].to!int > 4) { - segment_anchor_tag_that_object_belongs_to["html"] = anchor_tag_; + tag_in_seg["seg_lv4"] = anchor_tag_; + tag_in_seg["seg_lv1_to_4"] = anchor_tag_; lev_anchor_tag = anchor_tag; - 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; + tag_assoc[anchor_tag]["seg_lv4"] = tag_in_seg["seg_lv4"]; + tag_assoc[anchor_tag]["seg_lv1_to_4"] = tag_in_seg["seg_lv1_to_4"]; } else if (an_object["lev_markup_number"].to!int < 4) { string segn; - switch (an_object["lev_markup_number"].to!int) { + switch (an_object["lev_markup_number"].to!int) { /+ names used for epub markup segments A to D +/ case 0: segn = "_the_title"; goto default; @@ -897,50 +923,51 @@ template DocReformDocAbstraction() { ++cnt1; goto default; case 2: - segn = "_part_" ~ cnt1.to!string ~ "_" ~ cnt2.to!string; + segn = "_part_" ~ cnt1.to!string ~ "_" ~ cnt2.to!string; ++cnt2; goto default; case 3: - segn = "_part_" ~ cnt1.to!string ~ "_" ~ cnt2.to!string ~ "_" ~ cnt3.to!string; + segn = "_part_" ~ cnt1.to!string ~ "_" ~ cnt2.to!string ~ "_" ~ cnt3.to!string; ++cnt3; goto default; default: - 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"]; + lv0_to_3_tags ~= obj_cite_digits.on.to!string; + lv0_to_3_tags ~= segn; + tag_in_seg["seg_lv4"] = segn; // for html segname need following lv4 not yet known + tag_in_seg["seg_lv1_to_4"] = segn; break; } } an_object["bookindex_nugget"] = ("bookindex_nugget" in an_object) ? an_object["bookindex_nugget"] : ""; bookindex_unordered_hashes - = bookindex_extract_hash.bookindex_nugget_hash(an_object["bookindex_nugget"], obj_cite_digits, segment_anchor_tag_that_object_belongs_to); + = bookindex_extract_hash.bookindex_nugget_hash(an_object["bookindex_nugget"], obj_cite_digits, tag_in_seg); /+ (incrementally build toc) table of contents here! +/ _anchor_tag=obj_cite_digits.on.to!string; the_table_of_contents_section = obj_im.table_of_contents_gather_headings( an_object, conf_make_meta, - segment_anchor_tag_that_object_belongs_to, + tag_in_seg, _anchor_tag, lev4_subtoc, the_table_of_contents_section, ); if (an_object["lev_markup_number"] == "4") { - html_segnames ~= segment_anchor_tag_that_object_belongs_to["html"]; + segnames["html"] ~= tag_in_seg["seg_lv4"]; html_segnames_ptr = html_segnames_ptr_cntr; html_segnames_ptr_cntr++; } + if (an_object["lev_markup_number"].to!int <= 4) { + segnames["epub"] ~= tag_in_seg["seg_lv1_to_4"]; + } auto comp_obj_heading = node_construct.node_emitter_heading( - an_object["substantive"], // string - an_object["lev_markup_number"], // string - an_object["lev_collapsed_number"], // string - segment_anchor_tag_that_object_belongs_to, // string - lev_anchor_tag, // string - tag_assoc_html, + an_object["substantive"], + an_object["lev_markup_number"], + an_object["lev_collapsed_number"], + tag_in_seg, + lev_anchor_tag, + tag_assoc, obj_cite_digits, // OCNset cntr, // int heading_ptr, // int @@ -954,7 +981,8 @@ template DocReformDocAbstraction() { ++heading_ptr; debug(segments) { writeln(an_object["lev_markup_number"]); - writeln(segment_anchor_tag_that_object_belongs_to["html"]); + writeln(tag_in_seg["seg_lv4"]); + writeln(tag_in_seg["seg_lv1_to_4"]); } the_document_body_section ~= comp_obj_heading; debug(objectrelated1) { // check @@ -972,14 +1000,14 @@ template DocReformDocAbstraction() { an_object["bookindex_nugget"] = ("bookindex_nugget" in an_object) ? an_object["bookindex_nugget"] : ""; bookindex_unordered_hashes - = bookindex_extract_hash.bookindex_nugget_hash(an_object["bookindex_nugget"], obj_cite_digits, segment_anchor_tag_that_object_belongs_to); + = bookindex_extract_hash.bookindex_nugget_hash(an_object["bookindex_nugget"], obj_cite_digits, tag_in_seg); an_object["is"] = "para"; auto comp_obj_heading = node_construct.node_location_emitter( content_non_header, - segment_anchor_tag_that_object_belongs_to, + tag_in_seg, lev_anchor_tag, - tag_assoc_html, + tag_assoc, obj_cite_digits, cntr, heading_ptr-1, @@ -989,14 +1017,14 @@ template DocReformDocAbstraction() { = obj_im.obj_inline_markup_and_anchor_tags_and_misc(an_object, an_object_key, conf_make_meta, false); an_object["substantive"] = substantive_obj_misc_tuple[sObj.content]; anchor_tag = substantive_obj_misc_tuple[sObj.anchor_tag]; - tag_assoc_html = inline_para_link_anchor(an_object, segment_anchor_tag_that_object_belongs_to, tag_assoc_html); comp_obj_para = comp_obj_para.init; comp_obj_para.metainfo.is_of_part = "body"; comp_obj_para.metainfo.is_of_section = "body"; comp_obj_para.metainfo.is_of_type = "para"; comp_obj_para.metainfo.is_a = "para"; comp_obj_para.text = an_object["substantive"].to!string.strip; - comp_obj_para.tags.segment_anchor_tag_is = segment_anchor_tag_that_object_belongs_to["html"]; + comp_obj_para.tags.html_segment_anchor_tag_is = tag_in_seg["seg_lv4"]; + comp_obj_para.tags.epub_segment_anchor_tag_is = tag_in_seg["seg_lv1_to_4"]; 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; @@ -1010,6 +1038,7 @@ template DocReformDocAbstraction() { comp_obj_para.has.inline_links = substantive_obj_misc_tuple[sObj.links]; comp_obj_para.has.contains_image_without_dimensions = substantive_obj_misc_tuple[sObj.image_no_dimensions]; the_document_body_section ~= comp_obj_para; + tag_assoc = inline_para_link_anchor(an_object, tag_in_seg, tag_assoc); _common_reset_(line_occur, an_object, obj_type_status); indent=[ "hang_position" : 0, @@ -1048,7 +1077,7 @@ template DocReformDocAbstraction() { )) { note_section.gather_notes_for_endnote_section( the_document_body_section, - segment_anchor_tag_that_object_belongs_to, + tag_in_seg, (i).to!int, ); } @@ -1063,7 +1092,7 @@ template DocReformDocAbstraction() { previous_count=(the_document_body_section.length -1).to!int; note_section.gather_notes_for_endnote_section( the_document_body_section, - segment_anchor_tag_that_object_belongs_to, + tag_in_seg, (the_document_body_section.length-1).to!int, ); } @@ -1089,20 +1118,20 @@ template DocReformDocAbstraction() { } } if (an_object["glossary_nugget"].length == 0) { - comp_obj_heading_ = comp_obj_heading_.init; - comp_obj_heading_.metainfo.is_of_part = "empty"; - comp_obj_heading_.metainfo.is_of_section = "empty"; - comp_obj_heading_.metainfo.is_of_type = "para"; - comp_obj_heading_.metainfo.is_a = "heading"; - comp_obj_heading_.text = "(skip) there is no Glossary section"; - comp_obj_heading_.metainfo.ocn = 0; - comp_obj_heading_.metainfo.object_number_off = ""; - comp_obj_heading_.metainfo.object_number_type = 0; - comp_obj_heading_.metainfo.heading_lev_markup = 1; - comp_obj_heading_.metainfo.heading_lev_collapsed = 1; - comp_obj_heading_.metainfo.parent_ocn = 1; - comp_obj_heading_.metainfo.parent_lev_markup = 0; - the_glossary_section ~= comp_obj_heading_; + comp_obj_heading_ = comp_obj_heading_.init; + comp_obj_heading_.metainfo.is_of_part = "empty"; + comp_obj_heading_.metainfo.is_of_section = "empty"; + comp_obj_heading_.metainfo.is_of_type = "para"; + comp_obj_heading_.metainfo.is_a = "heading"; + comp_obj_heading_.text = "(skip) there is no Glossary section"; + comp_obj_heading_.metainfo.ocn = 0; + comp_obj_heading_.metainfo.object_number_off = ""; + comp_obj_heading_.metainfo.object_number_type = 0; + comp_obj_heading_.metainfo.heading_lev_markup = 1; + comp_obj_heading_.metainfo.heading_lev_collapsed = 1; + comp_obj_heading_.metainfo.parent_ocn = 1; + comp_obj_heading_.metainfo.parent_lev_markup = 0; + the_glossary_section ~= comp_obj_heading_; } debug(glossary) { foreach (gloss; the_glossary_section) { @@ -1114,54 +1143,60 @@ template DocReformDocAbstraction() { auto biblio_ordered = biblio._bibliography_(biblio_unsorted_incomplete, bib_arr_json); if (biblio_ordered.length > 0) { - comp_obj_heading_ = comp_obj_heading_.init; - comp_obj_heading_.metainfo.is_of_part = "backmatter"; - comp_obj_heading_.metainfo.is_of_section = "bibliography"; - comp_obj_heading_.metainfo.is_of_type = "para"; - comp_obj_heading_.metainfo.is_a = "heading"; - comp_obj_heading_.text = "Bibliography"; - 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_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; - comp_obj_heading_.metainfo.parent_lev_markup = 0; - the_bibliography_section ~= comp_obj_heading_; - comp_obj_heading_ = comp_obj_heading_.init; - comp_obj_heading_.metainfo.is_of_part = "backmatter"; - comp_obj_heading_.metainfo.is_of_section = "bibliography"; - comp_obj_heading_.metainfo.is_of_type = "para"; - comp_obj_heading_.metainfo.is_a = "heading"; - comp_obj_heading_.text = "Bibliography"; - 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_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; - comp_obj_heading_.metainfo.parent_lev_markup = 0; - comp_obj_heading_.tags.anchor_tags = ["bibliography"]; - the_bibliography_section ~= comp_obj_heading_; + comp_obj_heading_ = comp_obj_heading_.init; + comp_obj_heading_.metainfo.is_of_part = "backmatter"; + comp_obj_heading_.metainfo.is_of_section = "bibliography"; + comp_obj_heading_.metainfo.is_of_type = "para"; + comp_obj_heading_.metainfo.is_a = "heading"; + comp_obj_heading_.text = "Bibliography"; + 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_epub = "_part_bibliography"; + comp_obj_heading_.tags.anchor_tag_html = comp_obj_heading_.tags.segment_anchor_tag_epub; + comp_obj_heading_.tags.in_segment_html = "bibliography"; + comp_obj_heading_.metainfo.heading_lev_markup = 1; + comp_obj_heading_.metainfo.heading_lev_collapsed = 1; + comp_obj_heading_.metainfo.parent_ocn = 1; + comp_obj_heading_.metainfo.parent_lev_markup = 0; + the_bibliography_section ~= comp_obj_heading_; + tag_assoc[comp_obj_heading_.tags.anchor_tag_html]["seg_lv4"] = comp_obj_heading_.tags.in_segment_html; + tag_assoc[comp_obj_heading_.tags.segment_anchor_tag_epub]["seg_lv1_to_4"] = comp_obj_heading_.tags.segment_anchor_tag_epub; + comp_obj_heading_ = comp_obj_heading_.init; + comp_obj_heading_.metainfo.is_of_part = "backmatter"; + comp_obj_heading_.metainfo.is_of_section = "bibliography"; + comp_obj_heading_.metainfo.is_of_type = "para"; + comp_obj_heading_.metainfo.is_a = "heading"; + comp_obj_heading_.text = "Bibliography"; + 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_epub = "bibliography"; + comp_obj_heading_.tags.anchor_tag_html = comp_obj_heading_.tags.segment_anchor_tag_epub; + comp_obj_heading_.tags.in_segment_html = comp_obj_heading_.tags.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; + comp_obj_heading_.metainfo.parent_lev_markup = 0; + comp_obj_heading_.tags.anchor_tags = ["bibliography"]; + the_bibliography_section ~= comp_obj_heading_; + tag_assoc[comp_obj_heading_.tags.anchor_tag_html]["seg_lv4"] = comp_obj_heading_.tags.in_segment_html; + tag_assoc[comp_obj_heading_.tags.segment_anchor_tag_epub]["seg_lv1_to_4"] = comp_obj_heading_.tags.segment_anchor_tag_epub; } else { - comp_obj_heading_ = comp_obj_heading_.init; - comp_obj_heading_.metainfo.is_of_part = "empty"; - comp_obj_heading_.metainfo.is_of_section = "empty"; - comp_obj_heading_.metainfo.is_of_type = "para"; - comp_obj_heading_.metainfo.is_a = "heading"; - comp_obj_heading_.text = "(skip) there is no Bibliography"; - comp_obj_heading_.metainfo.ocn = 0; - comp_obj_heading_.metainfo.object_number_off = ""; - comp_obj_heading_.metainfo.object_number_type = 0; - comp_obj_heading_.metainfo.heading_lev_markup = 1; - comp_obj_heading_.metainfo.heading_lev_collapsed = 1; - comp_obj_heading_.metainfo.parent_ocn = 1; - comp_obj_heading_.metainfo.parent_lev_markup = 0; - the_bibliography_section ~= comp_obj_heading_; + comp_obj_heading_ = comp_obj_heading_.init; + comp_obj_heading_.metainfo.is_of_part = "empty"; + comp_obj_heading_.metainfo.is_of_section = "empty"; + comp_obj_heading_.metainfo.is_of_type = "para"; + comp_obj_heading_.metainfo.is_a = "heading"; + comp_obj_heading_.text = "(skip) there is no Bibliography"; + comp_obj_heading_.metainfo.ocn = 0; + comp_obj_heading_.metainfo.object_number_off = ""; + comp_obj_heading_.metainfo.object_number_type = 0; + comp_obj_heading_.metainfo.heading_lev_markup = 1; + comp_obj_heading_.metainfo.heading_lev_collapsed = 1; + comp_obj_heading_.metainfo.parent_ocn = 1; + comp_obj_heading_.metainfo.parent_lev_markup = 0; + the_bibliography_section ~= comp_obj_heading_; } string out_; foreach (entry; biblio_ordered) { @@ -1211,7 +1246,7 @@ template DocReformDocAbstraction() { auto the_bookindex_section = bi_tuple[0]; obj_cite_digits = bi_tuple[1]; debug(bookindex) { - foreach (bi_entry; the_bookindex_section["seg"]) { + foreach (bi_entry; the_bookindex_section) { writeln(bi_entry); } } @@ -1225,8 +1260,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_html = ""; comp_obj_heading_.tags.segment_anchor_tag_epub = ""; + comp_obj_heading_.tags.anchor_tag_html = ""; + comp_obj_heading_.tags.in_segment_html = ""; comp_obj_heading_.metainfo.heading_lev_markup = 1; comp_obj_heading_.metainfo.heading_lev_collapsed = 1; comp_obj_heading_.metainfo.parent_ocn = 1; @@ -1255,30 +1291,17 @@ template DocReformDocAbstraction() { comp_obj_toc.attrib.bullet = false; if (the_endnotes_section.length > 1) { toc_txt_ = format( - "{ %s }%s%s%s", + "{ %s }#%s", "Endnotes", - mkup.mark_internal_site_lnk, "endnotes", - ".fnSuffix", ); toc_txt_= munge.url_links(toc_txt_); comp_obj_toc.text = toc_txt_.to!string.strip; comp_obj_toc.has.inline_links = true; - the_table_of_contents_section["seg"] ~= comp_obj_toc; + the_table_of_contents_section ~= comp_obj_toc; } if (the_glossary_section.length > 1) { toc_txt_ = format( - "{ %s }%s%s%s", - "Glossary", - mkup.mark_internal_site_lnk, - "glossary", - ".fnSuffix", - ); - toc_txt_= munge.url_links(toc_txt_); - comp_obj_toc.text = toc_txt_.to!string.strip; - comp_obj_toc.has.inline_links = true; - the_table_of_contents_section["seg"] ~= comp_obj_toc; - toc_txt_ = format( "{ %s }#%s", "Glossary", "glossary", @@ -1286,22 +1309,10 @@ template DocReformDocAbstraction() { toc_txt_= munge.url_links(toc_txt_); comp_obj_toc.text = toc_txt_.to!string.strip; comp_obj_toc.has.inline_links = true; - the_table_of_contents_section["scroll"] ~= comp_obj_toc; + the_table_of_contents_section ~= comp_obj_toc; } if (the_bibliography_section.length > 1){ toc_txt_ = format( - "{ %s }%s%s%s", - "Bibliography", - mkup.mark_internal_site_lnk, - "bibliography", - ".fnSuffix", - ); - toc_txt_= munge.url_links(toc_txt_); - comp_obj_toc.text = toc_txt_.to!string.strip; - comp_obj_toc.has.inline_links = true; - the_table_of_contents_section["seg"] ~= comp_obj_toc; - - toc_txt_ = format( "{ %s }#%s", "Bibliography", "bibliography", @@ -1309,22 +1320,9 @@ template DocReformDocAbstraction() { toc_txt_= munge.url_links(toc_txt_); comp_obj_toc.text = toc_txt_.to!string.strip; comp_obj_toc.has.inline_links = true; - the_table_of_contents_section["scroll"] ~= comp_obj_toc; - } - if (the_bookindex_section["seg"].length > 1) { - toc_txt_ = format( - "{ %s }%s%s%s", - "Book Index", - mkup.mark_internal_site_lnk, - "bookindex", - ".fnSuffix", - ); - toc_txt_= munge.url_links(toc_txt_); - comp_obj_toc.text = toc_txt_.to!string.strip; - comp_obj_toc.has.inline_links = true; - the_table_of_contents_section["seg"] ~= comp_obj_toc; + the_table_of_contents_section ~= comp_obj_toc; } - if (the_bookindex_section["scroll"].length > 1) { + if (the_bookindex_section.length > 1) { toc_txt_ = format( "{ %s }#%s", "Book Index", @@ -1333,21 +1331,10 @@ template DocReformDocAbstraction() { toc_txt_= munge.url_links(toc_txt_); comp_obj_toc.text = toc_txt_.to!string.strip; comp_obj_toc.has.inline_links = true; - the_table_of_contents_section["scroll"] ~= comp_obj_toc; + the_table_of_contents_section ~= comp_obj_toc; } if (the_blurb_section.length > 1) { toc_txt_ = format( - "{ %s }%s%s%s", - "Blurb", - mkup.mark_internal_site_lnk, - "blurb", - ".fnSuffix", - ); - toc_txt_= munge.url_links(toc_txt_); - comp_obj_toc.text = toc_txt_.to!string.strip; - comp_obj_toc.has.inline_links = true; - the_table_of_contents_section["seg"] ~= comp_obj_toc; - toc_txt_ = format( "{ %s }#%s", "Blurb", "blurb", @@ -1355,25 +1342,14 @@ template DocReformDocAbstraction() { toc_txt_= munge.url_links(toc_txt_); comp_obj_toc.has.inline_links = true; comp_obj_toc.text = toc_txt_.to!string.strip; - the_table_of_contents_section["scroll"] ~= comp_obj_toc; + the_table_of_contents_section ~= comp_obj_toc; } debug(toc) { writefln( "%s %s", __LINE__, - the_table_of_contents_section["seg"].length ); - foreach (toc_linked_heading; the_table_of_contents_section["seg"]) { - writeln(mkup.indent_by_spaces_provided(toc_linked_heading.attrib.indent_hang), toc_linked_heading.text); - } - } - debug(tocscroll) { - writefln( - "%s %s", - __LINE__, - the_table_of_contents_section["seg"].length - ); - foreach (toc_linked_heading; the_table_of_contents_section["scroll"]) { + foreach (toc_linked_heading; the_table_of_contents_section) { writeln(mkup.indent_by_spaces_provided(toc_linked_heading.attrib.indent_hang), toc_linked_heading.text); } } @@ -1573,7 +1549,8 @@ template DocReformDocAbstraction() { } } if (the_endnotes_section.length > 1) { - html_segnames ~= "endnotes"; + segnames["html"] ~= "endnotes"; + segnames["epub"] ~= "endnotes"; html_segnames_ptr = html_segnames_ptr_cntr; foreach (ref obj; the_endnotes_section) { if (obj.metainfo.is_a == "heading") { @@ -1587,7 +1564,8 @@ template DocReformDocAbstraction() { html_segnames_ptr_cntr++; } if (the_glossary_section.length > 1) { - html_segnames ~= "glossary"; + segnames["html"] ~= "glossary"; + segnames["epub"] ~= "glossary"; html_segnames_ptr = html_segnames_ptr_cntr; foreach (ref obj; the_glossary_section) { if (obj.metainfo.is_a == "heading") { @@ -1601,7 +1579,8 @@ template DocReformDocAbstraction() { html_segnames_ptr_cntr++; } if (the_bibliography_section.length > 1) { - html_segnames ~= "bibliography"; + segnames["html"] ~= "bibliography"; + segnames["epub"] ~= "bibliography"; html_segnames_ptr = html_segnames_ptr_cntr; foreach (ref obj; the_bibliography_section) { if (obj.metainfo.is_a == "heading") { @@ -1614,10 +1593,11 @@ template DocReformDocAbstraction() { } html_segnames_ptr_cntr++; } - if (the_bookindex_section["scroll"].length > 1) { - html_segnames ~= "bookindex"; + if (the_bookindex_section.length > 1) { + segnames["html"] ~= "bookindex"; + segnames["epub"] ~= "bookindex"; html_segnames_ptr = html_segnames_ptr_cntr; - foreach (ref obj; the_bookindex_section["scroll"]) { + foreach (ref obj; the_bookindex_section) { if (obj.metainfo.is_a == "heading") { obj.metainfo.parent_ocn = obj.metainfo.markedup_ancestors[obj.metainfo.parent_lev_markup]; } @@ -1626,16 +1606,11 @@ template DocReformDocAbstraction() { break; } } - foreach (ref obj; the_bookindex_section["seg"]) { - if (obj.metainfo.heading_lev_markup == 4) { - obj.ptr.html_segnames = html_segnames_ptr; - break; - } - } html_segnames_ptr_cntr++; } if (the_blurb_section.length > 1) { - html_segnames ~= "blurb"; + segnames["html"] ~= "blurb"; + segnames["epub"] ~= "blurb"; html_segnames_ptr = html_segnames_ptr_cntr; foreach (ref obj; the_blurb_section) { if (obj.metainfo.is_a == "heading") { @@ -1767,17 +1742,18 @@ template DocReformDocAbstraction() { obj = obj_heading_ancestors(obj, lv_ancestors_txt); } } - if (the_table_of_contents_section["scroll"].length > 1) { + if (the_table_of_contents_section.length > 1) { /+ scroll +/ dom_structure_markedup_tags_status_buffer = dom_structure_markedup_tags_status.dup; dom_structure_collapsed_tags_status_buffer = dom_structure_collapsed_tags_status.dup; - foreach (ref obj; the_table_of_contents_section["scroll"]) { + foreach (ref obj; the_table_of_contents_section) { if (obj.metainfo.is_a == "heading") { if (obj.metainfo.heading_lev_markup <= 4) { + 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 == html_segnames[obj.ptr.html_segnames], - obj.tags.segment_anchor_tag_html ~ "!=" ~ html_segnames[obj.ptr.html_segnames]); + obj.tags.segname_next = segnames["html"][obj.ptr.html_segnames + 1]; + assert(obj.tags.anchor_tag_html == segnames["html"][obj.ptr.html_segnames], + obj.tags.anchor_tag_html ~ "!=" ~ segnames["html"][obj.ptr.html_segnames]); } } /+ dom structure (marked up & collapsed) +/ @@ -1793,36 +1769,18 @@ template DocReformDocAbstraction() { obj = obj_heading_ancestors(obj, lv_ancestors_txt); } } - /+ seg +/ - dom_structure_markedup_tags_status = dom_structure_markedup_tags_status_buffer.dup; - dom_structure_collapsed_tags_status = dom_structure_collapsed_tags_status_buffer.dup; - foreach (ref obj; the_table_of_contents_section["seg"]) { - if (obj.metainfo.is_a == "heading") { - debug(dom) { - writeln(obj.text); - } - if (obj.metainfo.heading_lev_markup <= 4) { - 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 == html_segnames[obj.ptr.html_segnames], - obj.tags.segment_anchor_tag_html ~ "!=" ~ html_segnames[obj.ptr.html_segnames]); - } - } - if ((opt_action.html) - || (opt_action.html_scroll) - || (opt_action.html_seg) - || (opt_action.epub)) { - obj = obj_dom_structure_set_markup_tags(obj, dom_structure_markedup_tags_status, obj.metainfo.heading_lev_markup); - obj = obj_dom_set_collapsed_tags(obj, dom_structure_collapsed_tags_status, obj.metainfo.heading_lev_collapsed); - } - obj = obj_heading_ancestors(obj, lv_ancestors_txt); - } - } } /+ multiple 1~ levels, loop through document body +/ if (the_document_body_section.length > 1) { foreach (ref obj; the_document_body_section) { + if (!(((obj.metainfo.ocn.to!string) in tag_assoc) + && ("seg_lv4" in tag_assoc[(obj.metainfo.ocn.to!string)])) + ) { + tag_assoc[(obj.metainfo.ocn.to!string)]["seg_lv4"] + = obj.tags.html_segment_anchor_tag_is; + } + tag_assoc[(obj.metainfo.ocn.to!string)]["seg_lv1_to_4"] + = obj.tags.epub_segment_anchor_tag_is; if (obj.metainfo.is_a == "heading") { debug(dom) { writeln(obj.text); @@ -1830,13 +1788,13 @@ template DocReformDocAbstraction() { if (obj.metainfo.heading_lev_markup <= 4) { 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_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]; + obj.tags.lev4_subtoc = lev4_subtoc[obj.tags.anchor_tag_html]; + obj.tags.segname_prev = segnames["html"][obj.ptr.html_segnames - 1]; + if (segnames["html"].length > obj.ptr.html_segnames + 1) { + obj.tags.segname_next = segnames["html"][obj.ptr.html_segnames + 1]; } - 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]); + assert(obj.tags.anchor_tag_html == segnames["html"][obj.ptr.html_segnames], + obj.tags.anchor_tag_html ~ "!=" ~ segnames["html"][obj.ptr.html_segnames]); } } /+ dom structure (marked up & collapsed) +/ @@ -1859,10 +1817,10 @@ template DocReformDocAbstraction() { auto images=uniq(_images.sort()); /+ optional only one 1~ level +/ if (the_endnotes_section.length > 1) { - dom_structure_markedup_tags_status_buffer = dom_structure_markedup_tags_status.dup; + dom_structure_markedup_tags_status_buffer = dom_structure_markedup_tags_status.dup; dom_structure_collapsed_tags_status_buffer = dom_structure_collapsed_tags_status.dup; - dom_structure_markedup_tags_status = dom_structure_markedup_tags_status_buffer.dup; - dom_structure_collapsed_tags_status = dom_structure_collapsed_tags_status_buffer.dup; + dom_structure_markedup_tags_status = dom_structure_markedup_tags_status_buffer.dup; + dom_structure_collapsed_tags_status = dom_structure_collapsed_tags_status_buffer.dup; foreach (ref obj; the_endnotes_section) { if (obj.metainfo.is_a == "heading") { debug(dom) { @@ -1873,12 +1831,12 @@ template DocReformDocAbstraction() { if (obj.metainfo.heading_lev_markup <= 4) { 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]; + obj.tags.segname_prev = segnames["html"][obj.ptr.html_segnames - 1]; + if (segnames["html"].length > obj.ptr.html_segnames + 1) { + obj.tags.segname_next = segnames["html"][obj.ptr.html_segnames + 1]; } - 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]); + assert(obj.tags.anchor_tag_html == segnames["html"][obj.ptr.html_segnames], + obj.tags.anchor_tag_html ~ "!=" ~ segnames["html"][obj.ptr.html_segnames]); } } /+ dom structure (marked up & collapsed) +/ @@ -1907,12 +1865,12 @@ template DocReformDocAbstraction() { if (obj.metainfo.heading_lev_markup <= 4) { 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]; + obj.tags.segname_prev = segnames["html"][obj.ptr.html_segnames - 1]; + if (segnames["html"].length > obj.ptr.html_segnames + 1) { + obj.tags.segname_next = segnames["html"][obj.ptr.html_segnames + 1]; } - 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]); + assert(obj.tags.anchor_tag_html == segnames["html"][obj.ptr.html_segnames], + obj.tags.anchor_tag_html ~ "!=" ~ segnames["html"][obj.ptr.html_segnames]); } } /+ dom structure (marked up & collapsed) +/ @@ -1944,12 +1902,12 @@ template DocReformDocAbstraction() { if (obj.metainfo.heading_lev_markup <= 4) { 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]; + obj.tags.segname_prev = segnames["html"][obj.ptr.html_segnames - 1]; + if (segnames["html"].length > obj.ptr.html_segnames + 1) { + obj.tags.segname_next = segnames["html"][obj.ptr.html_segnames + 1]; } - 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]); + assert(obj.tags.anchor_tag_html == segnames["html"][obj.ptr.html_segnames], + obj.tags.anchor_tag_html ~ "!=" ~ segnames["html"][obj.ptr.html_segnames]); } } /+ dom structure (marked up & collapsed) +/ @@ -1973,24 +1931,27 @@ template DocReformDocAbstraction() { int ocn_ = obj_cite_digits.on; int ocn_bkidx_ = 0; int ocn_bidx_; - if (the_bookindex_section["scroll"].length > 1) { + if (the_bookindex_section.length > 1) { /+ scroll +/ dom_structure_markedup_tags_status_buffer = dom_structure_markedup_tags_status.dup; dom_structure_collapsed_tags_status_buffer = dom_structure_collapsed_tags_status.dup; - foreach (ref obj; the_bookindex_section["scroll"]) { + foreach (ref obj; the_bookindex_section) { if (obj.metainfo.is_a == "heading") { debug(dom) { } + if (obj.metainfo.heading_lev_markup <= 4) { + segnames_lv0_to_4 ~= obj.tags.segment_anchor_tag_epub; + } obj_cite_digits = ocn_emit(OCNstatus.on); obj.metainfo.ocn = obj_cite_digits.on; if (obj.metainfo.heading_lev_markup <= 4) { 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]; + obj.tags.segname_prev = segnames["html"][obj.ptr.html_segnames - 1]; + if (segnames["html"].length > obj.ptr.html_segnames + 1) { + obj.tags.segname_next = segnames["html"][obj.ptr.html_segnames + 1]; } - 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]); + assert(obj.tags.anchor_tag_html == segnames["html"][obj.ptr.html_segnames], + obj.tags.anchor_tag_html ~ "!=" ~ segnames["html"][obj.ptr.html_segnames]); } } /+ dom structure (marked up & collapsed) +/ @@ -2011,43 +1972,6 @@ template DocReformDocAbstraction() { obj.metainfo.object_number_type = OCNtype.bkidx; } } - /+ seg +/ - dom_structure_markedup_tags_status = dom_structure_markedup_tags_status_buffer.dup; - dom_structure_collapsed_tags_status = dom_structure_collapsed_tags_status_buffer.dup; - foreach (ref obj; the_bookindex_section["seg"]) { - if (obj.metainfo.is_a == "heading") { - debug(dom) { - writeln(obj.text); - } - obj.metainfo.ocn = ++ocn_; - if (obj.metainfo.heading_lev_markup <= 4) { - 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 == html_segnames[obj.ptr.html_segnames], - obj.tags.segment_anchor_tag_html ~ "!=" ~ html_segnames[obj.ptr.html_segnames]); - } - } - /+ dom structure (marked up & collapsed) +/ - if ((opt_action.html) - || (opt_action.html_scroll) - || (opt_action.html_seg) - || (opt_action.epub) - || (opt_action.sqlite_discrete) - || (opt_action.sqlite_update)) { - obj = obj_dom_structure_set_markup_tags(obj, dom_structure_markedup_tags_status, obj.metainfo.heading_lev_markup); - obj = obj_dom_set_collapsed_tags(obj, dom_structure_collapsed_tags_status, obj.metainfo.heading_lev_collapsed); - } - obj = obj_heading_ancestors(obj, lv_ancestors_txt); - } else if (obj.metainfo.is_a == "bookindex") { - ocn_bidx_ = ++ocn_bkidx_; - obj.metainfo.o_n_book_index = ocn_bidx_; // FIX need to distinguish from regular ocn - obj.metainfo.object_number_type = OCNtype.bkidx; - } - } /+ TODO assert failure, reinstate assert(obj_cite_digit_bkidx == ocn_bidx_ obj_cite_digit_bkidx ~ " == ocn_" ~ ocn_ ~ "?"); @@ -2065,12 +1989,12 @@ template DocReformDocAbstraction() { if (obj.metainfo.heading_lev_markup <= 4) { 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]; + obj.tags.segname_prev = segnames["html"][obj.ptr.html_segnames - 1]; + if (segnames["html"].length > obj.ptr.html_segnames + 1) { + obj.tags.segname_next = segnames["html"][obj.ptr.html_segnames + 1]; } - 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]); + assert(obj.tags.anchor_tag_html == segnames["html"][obj.ptr.html_segnames], + obj.tags.anchor_tag_html ~ "!=" ~ segnames["html"][obj.ptr.html_segnames]); } } /+ dom structure (marked up & collapsed) +/ @@ -2098,7 +2022,7 @@ template DocReformDocAbstraction() { the_endnotes_section ~ the_glossary_section ~ the_bibliography_section ~ - the_bookindex_section["scroll"] ~ + the_bookindex_section ~ the_blurb_section ); debug(decendants_tuple) { @@ -2160,8 +2084,8 @@ template DocReformDocAbstraction() { } } } - if (the_bookindex_section["scroll"].length > 1) { - foreach (ref obj; the_bookindex_section["scroll"]) { + if (the_bookindex_section.length > 1) { + foreach (ref obj; the_bookindex_section) { if (obj.metainfo.is_a == "heading") { foreach (pair; pairs) { if (obj.metainfo.ocn == pair[0]) { @@ -2189,21 +2113,23 @@ template DocReformDocAbstraction() { - obj.metainfo.dom_structure_markedup_tags_status = dom_structure_markedup_tags_status; - obj.metainfo.dom_structure_collapsed_tags_status = dom_structure_collapsed_tags_status; +/ - comp_obj_heading_ = comp_obj_heading_.init; - comp_obj_heading_.metainfo.is_of_part = "empty"; - comp_obj_heading_.metainfo.is_of_section = "empty"; - comp_obj_heading_.metainfo.is_of_type = "para"; - 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_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; - comp_obj_heading_.metainfo.parent_lev_markup = 0; + comp_obj_heading_ = comp_obj_heading_.init; + comp_obj_heading_.metainfo.is_of_part = "empty"; + comp_obj_heading_.metainfo.is_of_section = "empty"; + comp_obj_heading_.metainfo.is_of_type = "para"; + 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_epub = ""; + comp_obj_heading_.tags.anchor_tag_html = ""; + comp_obj_heading_.tags.in_segment_html = ""; + comp_obj_heading_.tags.html_segment_anchor_tag_is = ""; + comp_obj_heading_.tags.epub_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; + comp_obj_heading_.metainfo.parent_lev_markup = 0; comp_obj_heading_.metainfo.dom_structure_markedup_tags_status = dom_structure_markedup_tags_status.dup; comp_obj_heading_.metainfo.dom_structure_collapsed_tags_status = dom_structure_collapsed_tags_status.dup; comp_obj_heading_ = obj_dom_structure_set_markup_tags(comp_obj_heading_, dom_structure_markedup_tags_status, 0); @@ -2212,23 +2138,21 @@ template DocReformDocAbstraction() { // the_dom_tail_section ~= comp_obj_heading_; // remove tail for now, decide on later auto document_the = [ "head": the_document_head_section, - "toc_seg": the_table_of_contents_section["seg"], - "toc_scroll": the_table_of_contents_section["scroll"], + "toc": the_table_of_contents_section, /+ substantive/body: +/ "body": the_document_body_section, /+ backmatter: +/ "endnotes": the_endnotes_section, "glossary": the_glossary_section, "bibliography": the_bibliography_section, - "bookindex_scroll": the_bookindex_section["scroll"], - "bookindex_seg": the_bookindex_section["seg"], + "bookindex": the_bookindex_section, "blurb": the_blurb_section, /+ dom tail only +/ "tail": the_dom_tail_section, ]; string[][string] document_section_keys_sequenced = [ - "seg": ["head", "toc_seg", "body",], - "scroll": ["head", "toc_scroll", "body",], + "seg": ["head", "toc", "body",], + "scroll": ["head", "toc", "body",], "sql": ["head", "body",] ]; if (document_the["endnotes"].length > 1) { @@ -2245,12 +2169,10 @@ template DocReformDocAbstraction() { document_section_keys_sequenced["scroll"] ~= "bibliography"; document_section_keys_sequenced["sql"] ~= "bibliography"; } - if (document_the["bookindex_seg"].length > 1) { - document_section_keys_sequenced["seg"] ~= "bookindex_seg"; - document_section_keys_sequenced["sql"] ~= "bookindex_seg"; - } - if (document_the["bookindex_scroll"].length > 1) { - document_section_keys_sequenced["scroll"] ~= "bookindex_scroll"; + if (document_the["bookindex"].length > 1) { + document_section_keys_sequenced["seg"] ~= "bookindex"; + document_section_keys_sequenced["scroll"] ~= "bookindex"; + document_section_keys_sequenced["sql"] ~= "bookindex"; } if (document_the["blurb"].length > 1) { document_section_keys_sequenced["seg"] ~= "blurb"; @@ -2265,7 +2187,12 @@ template DocReformDocAbstraction() { document_section_keys_sequenced["scroll"] ~= "tail"; } auto sequenced_document_keys = docSectKeysSeq!()(document_section_keys_sequenced); - auto segnames_lv4 = html_segnames.dup; + auto segnames_lv4 = segnames["html"].dup; + auto segnames_lv1_to_4 = segnames["epub"].dup; + debug(segnames) { + writeln("segnames_lv4: ", segnames_lv4); + writeln("segnames_lv1_to_4: ", segnames_lv1_to_4); + } destroy(the_document_head_section); destroy(the_table_of_contents_section); destroy(the_document_body_section); @@ -2274,7 +2201,7 @@ template DocReformDocAbstraction() { destroy(the_bibliography_section); destroy(the_bookindex_section); destroy(the_blurb_section); - destroy(html_segnames); + destroy(segnames); destroy(bookindex_unordered_hashes); destroy(an_object); obj_cite_digits = ocn_emit(OCNstatus.reset); @@ -2336,7 +2263,7 @@ template DocReformDocAbstraction() { sequenced_document_keys, segnames_lv4, segnames_lv0_to_4, - tag_assoc_html, + tag_assoc, images, ); return t; @@ -2500,7 +2427,7 @@ template DocReformDocAbstraction() { line ); } - object_number_poem["start"] = obj_cite_digits.on.to!string; + object_number_poem["start"] = obj_cite_digits.on.to!string; obj_type_status["blocks"] = TriState.on; obj_type_status["verse_new"] = State.on; obj_type_status["poem"] = TriState.on; @@ -2579,7 +2506,7 @@ template DocReformDocAbstraction() { line ); } - object_number_poem["start"] = obj_cite_digits.on.to!string; + object_number_poem["start"] = obj_cite_digits.on.to!string; obj_type_status["blocks"] = TriState.on; obj_type_status["verse_new"] = State.on; obj_type_status["poem"] = TriState.on; @@ -2691,7 +2618,7 @@ template DocReformDocAbstraction() { debug(group) { writeln(line); } - an_object[an_object_key] = an_object[an_object_key].stripRight; + an_object[an_object_key] = an_object[an_object_key].stripRight; obj_type_status["blocks"] = TriState.closing; obj_type_status["group"] = TriState.closing; obj_type_status["curly_group"] = TriState.off; @@ -2706,7 +2633,7 @@ template DocReformDocAbstraction() { debug(group) { writeln(line); } - an_object[an_object_key] = an_object[an_object_key].stripRight; + an_object[an_object_key] = an_object[an_object_key].stripRight; obj_type_status["blocks"] = TriState.closing; obj_type_status["group"] = TriState.closing; obj_type_status["tic_group"] = TriState.off; @@ -2734,7 +2661,7 @@ template DocReformDocAbstraction() { debug(block) { // block (curly) close writeln(line); } - an_object[an_object_key] = an_object[an_object_key].stripRight; + an_object[an_object_key] = an_object[an_object_key].stripRight; obj_type_status["blocks"] = TriState.closing; obj_type_status["block"] = TriState.closing; obj_type_status["curly_block"] = TriState.off; @@ -2749,7 +2676,7 @@ template DocReformDocAbstraction() { debug(block) { writeln(line); } - an_object[an_object_key] = an_object[an_object_key].stripRight; + an_object[an_object_key] = an_object[an_object_key].stripRight; obj_type_status["blocks"] = TriState.closing; obj_type_status["block"] = TriState.closing; obj_type_status["tic_block"] = TriState.off; @@ -2768,7 +2695,7 @@ template DocReformDocAbstraction() { return ref C cntr, N object_number_poem, CMM conf_make_meta, - Ts segment_anchor_tag_that_object_belongs_to, + Ts tag_in_seg, ) { debug(asserts) { static assert(is(typeof(line) == char[])); @@ -2812,22 +2739,23 @@ template DocReformDocAbstraction() { = obj_im.obj_inline_markup_and_anchor_tags_and_misc(an_object, an_object_key, conf_make_meta, false); an_object["substantive"] = substantive_obj_misc_tuple[sObj.content]; anchor_tag = substantive_obj_misc_tuple[sObj.anchor_tag]; - tag_assoc_html = inline_para_link_anchor(an_object, segment_anchor_tag_that_object_belongs_to, tag_assoc_html); - comp_obj_block = comp_obj_block.init; - comp_obj_block.metainfo.is_of_part = "body"; - comp_obj_block.metainfo.is_of_section = "body"; - comp_obj_block.metainfo.is_of_type = "block"; - 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["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"]; - comp_obj_block.has.inline_notes_reg = substantive_obj_misc_tuple[sObj.notes_reg]; - comp_obj_block.has.inline_notes_star = substantive_obj_misc_tuple[sObj.notes_star]; - comp_obj_block.has.inline_links = substantive_obj_misc_tuple[sObj.links]; - the_document_body_section ~= comp_obj_block; + comp_obj_block = comp_obj_block.init; + comp_obj_block.metainfo.is_of_part = "body"; + comp_obj_block.metainfo.is_of_section = "body"; + comp_obj_block.metainfo.is_of_type = "block"; + 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.html_segment_anchor_tag_is = tag_in_seg["seg_lv4"]; + comp_obj_block.tags.epub_segment_anchor_tag_is = tag_in_seg["seg_lv1_to_4"]; + 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"]; + comp_obj_block.has.inline_notes_reg = substantive_obj_misc_tuple[sObj.notes_reg]; + comp_obj_block.has.inline_notes_star = substantive_obj_misc_tuple[sObj.notes_star]; + comp_obj_block.has.inline_links = substantive_obj_misc_tuple[sObj.links]; + the_document_body_section ~= comp_obj_block; + tag_assoc = inline_para_link_anchor(an_object, tag_in_seg, tag_assoc); } object_reset(an_object); processing.remove("verse"); @@ -2861,9 +2789,9 @@ template DocReformDocAbstraction() { an_object["is"] = "verse"; auto comp_obj_location = node_construct.node_location_emitter( content_non_header, - segment_anchor_tag_that_object_belongs_to, + tag_in_seg, lev_anchor_tag, - tag_assoc_html, + tag_assoc, obj_cite_digits, cntr, heading_ptr-1, @@ -2873,22 +2801,23 @@ template DocReformDocAbstraction() { = obj_im.obj_inline_markup_and_anchor_tags_and_misc(an_object, an_object_key, conf_make_meta, false); an_object["substantive"] = substantive_obj_misc_tuple[sObj.content]; anchor_tag = substantive_obj_misc_tuple[sObj.anchor_tag]; - tag_assoc_html = inline_para_link_anchor(an_object, segment_anchor_tag_that_object_belongs_to, tag_assoc_html); - comp_obj_block = comp_obj_block.init; - comp_obj_block.metainfo.is_of_part = "body"; - comp_obj_block.metainfo.is_of_section = "body"; - comp_obj_block.metainfo.is_of_type = "block"; - 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["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"]; - comp_obj_block.has.inline_notes_reg = substantive_obj_misc_tuple[sObj.notes_reg]; - comp_obj_block.has.inline_notes_star = substantive_obj_misc_tuple[sObj.notes_star]; - comp_obj_block.has.inline_links = substantive_obj_misc_tuple[sObj.links]; - the_document_body_section ~= comp_obj_block; + comp_obj_block = comp_obj_block.init; + comp_obj_block.metainfo.is_of_part = "body"; + comp_obj_block.metainfo.is_of_section = "body"; + comp_obj_block.metainfo.is_of_type = "block"; + 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.html_segment_anchor_tag_is = tag_in_seg["seg_lv4"]; + comp_obj_block.tags.epub_segment_anchor_tag_is = tag_in_seg["seg_lv1_to_4"]; + 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"]; + comp_obj_block.has.inline_notes_reg = substantive_obj_misc_tuple[sObj.notes_reg]; + comp_obj_block.has.inline_notes_star = substantive_obj_misc_tuple[sObj.notes_star]; + comp_obj_block.has.inline_links = substantive_obj_misc_tuple[sObj.links]; + the_document_body_section ~= comp_obj_block; + tag_assoc = inline_para_link_anchor(an_object, tag_in_seg, tag_assoc); object_reset(an_object); processing.remove("verse"); ++cntr; @@ -2912,28 +2841,29 @@ template DocReformDocAbstraction() { writeln(obj_cite_digits.on, line); } processing.remove("verse"); - an_object["is"] = "verse"; + an_object["is"] = "verse"; auto substantive_obj_misc_tuple = obj_im.obj_inline_markup_and_anchor_tags_and_misc(an_object, an_object_key, conf_make_meta, false); an_object["substantive"] = substantive_obj_misc_tuple[sObj.content]; anchor_tag = substantive_obj_misc_tuple[sObj.anchor_tag]; - tag_assoc_html = inline_para_link_anchor(an_object, segment_anchor_tag_that_object_belongs_to, tag_assoc_html); - comp_obj_block = comp_obj_block.init; - comp_obj_block.metainfo.is_of_part = "body"; - comp_obj_block.metainfo.is_of_section = "body"; - comp_obj_block.metainfo.is_of_type = "block"; - 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["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"]; - comp_obj_block.has.inline_notes_reg = substantive_obj_misc_tuple[sObj.notes_reg]; - comp_obj_block.has.inline_notes_star = substantive_obj_misc_tuple[sObj.notes_star]; - comp_obj_block.has.inline_links = substantive_obj_misc_tuple[sObj.links]; - the_document_body_section ~= comp_obj_block; - object_number_poem["end"] = obj_cite_digits.on.to!string; + comp_obj_block = comp_obj_block.init; + comp_obj_block.metainfo.is_of_part = "body"; + comp_obj_block.metainfo.is_of_section = "body"; + comp_obj_block.metainfo.is_of_type = "block"; + 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.html_segment_anchor_tag_is = tag_in_seg["seg_lv4"]; + comp_obj_block.tags.epub_segment_anchor_tag_is = tag_in_seg["seg_lv1_to_4"]; + 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"]; + comp_obj_block.has.inline_notes_reg = substantive_obj_misc_tuple[sObj.notes_reg]; + comp_obj_block.has.inline_notes_star = substantive_obj_misc_tuple[sObj.notes_star]; + comp_obj_block.has.inline_links = substantive_obj_misc_tuple[sObj.links]; + the_document_body_section ~= comp_obj_block; + tag_assoc = inline_para_link_anchor(an_object, tag_in_seg, tag_assoc); + object_number_poem["end"] = obj_cite_digits.on.to!string; object_reset(an_object); processing.remove("verse"); ++cntr; @@ -2966,9 +2896,9 @@ template DocReformDocAbstraction() { auto comp_obj_location = node_construct.node_location_emitter( content_non_header, - segment_anchor_tag_that_object_belongs_to, + tag_in_seg, lev_anchor_tag, - tag_assoc_html, + tag_assoc, obj_cite_digits, cntr, heading_ptr-1, @@ -2978,22 +2908,23 @@ template DocReformDocAbstraction() { = obj_im.obj_inline_markup_and_anchor_tags_and_misc(an_object, an_object_key, conf_make_meta, false); an_object["substantive"] = substantive_obj_misc_tuple[sObj.content]; anchor_tag = substantive_obj_misc_tuple[sObj.anchor_tag]; - tag_assoc_html = inline_para_link_anchor(an_object, segment_anchor_tag_that_object_belongs_to, tag_assoc_html); - comp_obj_block = comp_obj_block.init; - comp_obj_block.metainfo.is_of_part = "body"; - comp_obj_block.metainfo.is_of_section = "body"; - comp_obj_block.metainfo.is_of_type = "block"; - 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["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"]; - comp_obj_block.has.inline_notes_reg = substantive_obj_misc_tuple[sObj.notes_reg]; - comp_obj_block.has.inline_notes_star = substantive_obj_misc_tuple[sObj.notes_star]; - comp_obj_block.has.inline_links = substantive_obj_misc_tuple[sObj.links]; - the_document_body_section ~= comp_obj_block; + comp_obj_block = comp_obj_block.init; + comp_obj_block.metainfo.is_of_part = "body"; + comp_obj_block.metainfo.is_of_section = "body"; + comp_obj_block.metainfo.is_of_type = "block"; + 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.html_segment_anchor_tag_is = tag_in_seg["seg_lv4"]; + comp_obj_block.tags.epub_segment_anchor_tag_is = tag_in_seg["seg_lv1_to_4"]; + 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"]; + comp_obj_block.has.inline_notes_reg = substantive_obj_misc_tuple[sObj.notes_reg]; + comp_obj_block.has.inline_notes_star = substantive_obj_misc_tuple[sObj.notes_star]; + comp_obj_block.has.inline_links = substantive_obj_misc_tuple[sObj.links]; + the_document_body_section ~= comp_obj_block; + tag_assoc = inline_para_link_anchor(an_object, tag_in_seg, tag_assoc); object_reset(an_object); processing.remove("verse"); ++cntr; @@ -3270,9 +3201,9 @@ template DocReformDocAbstraction() { auto comp_obj_location = node_construct.node_location_emitter( content_non_header, - segment_anchor_tag_that_object_belongs_to, + tag_in_seg, lev_anchor_tag, - tag_assoc_html, + tag_assoc, obj_cite_digits, cntr, heading_ptr-1, @@ -3281,15 +3212,16 @@ template DocReformDocAbstraction() { an_object["is"] = "table"; auto substantive_obj_misc_tuple = obj_im.obj_inline_markup_and_anchor_tags_and_misc(an_object, "body_nugget", conf_make_meta, false); - 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["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"]); - comp_obj_block = table_substantive_munge_special(comp_obj_block, an_object["substantive"]); - the_document_body_section ~= comp_obj_block; + 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.html_segment_anchor_tag_is = tag_in_seg["seg_lv4"]; + comp_obj_block.tags.epub_segment_anchor_tag_is = tag_in_seg["seg_lv1_to_4"]; + 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"]); + comp_obj_block = table_substantive_munge_special(comp_obj_block, an_object["substantive"]); + the_document_body_section ~= comp_obj_block; object_reset(an_object); processing.remove("verse"); ++cntr; @@ -3306,7 +3238,7 @@ template DocReformDocAbstraction() { return ref int[string] obj_type_status, string[string] object_number_poem, CMM conf_make_meta, - Ts segment_anchor_tag_that_object_belongs_to, + Ts tag_in_seg, ) { assert( line.empty, @@ -3326,15 +3258,15 @@ template DocReformDocAbstraction() { = bookindex_extract_hash.bookindex_nugget_hash( an_object["bookindex_nugget"], obj_cite_digits, - segment_anchor_tag_that_object_belongs_to + tag_in_seg ); an_object["is"] = "quote"; auto comp_obj_location = node_construct.node_location_emitter( content_non_header, - segment_anchor_tag_that_object_belongs_to, + tag_in_seg, lev_anchor_tag, - tag_assoc_html, + tag_assoc, obj_cite_digits, cntr, heading_ptr-1, @@ -3344,24 +3276,25 @@ template DocReformDocAbstraction() { = obj_im.obj_inline_markup_and_anchor_tags_and_misc(an_object, an_object_key, conf_make_meta, false); an_object["substantive"] = substantive_obj_misc_tuple[sObj.content]; anchor_tag = substantive_obj_misc_tuple[sObj.anchor_tag]; - tag_assoc_html = inline_para_link_anchor(an_object, segment_anchor_tag_that_object_belongs_to, tag_assoc_html); - comp_obj_block = comp_obj_block.init; - comp_obj_block.metainfo.is_of_part = "body"; - comp_obj_block.metainfo.is_of_section = "body"; - comp_obj_block.metainfo.is_of_type = "block"; - 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["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"]; - comp_obj_block.has.inline_notes_reg = substantive_obj_misc_tuple[sObj.notes_reg]; - comp_obj_block.has.inline_notes_star = substantive_obj_misc_tuple[sObj.notes_star]; - comp_obj_block.has.inline_links = substantive_obj_misc_tuple[sObj.links]; - the_document_body_section ~= comp_obj_block; - obj_type_status["blocks"] = TriState.off; - obj_type_status["quote"] = TriState.off; + comp_obj_block = comp_obj_block.init; + comp_obj_block.metainfo.is_of_part = "body"; + comp_obj_block.metainfo.is_of_section = "body"; + comp_obj_block.metainfo.is_of_type = "block"; + 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.html_segment_anchor_tag_is = tag_in_seg["seg_lv4"]; + comp_obj_block.tags.epub_segment_anchor_tag_is = tag_in_seg["seg_lv1_to_4"]; + 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"]; + comp_obj_block.has.inline_notes_reg = substantive_obj_misc_tuple[sObj.notes_reg]; + comp_obj_block.has.inline_notes_star = substantive_obj_misc_tuple[sObj.notes_star]; + comp_obj_block.has.inline_links = substantive_obj_misc_tuple[sObj.links]; + the_document_body_section ~= comp_obj_block; + tag_assoc = inline_para_link_anchor(an_object, tag_in_seg, tag_assoc); + obj_type_status["blocks"] = TriState.off; + obj_type_status["quote"] = TriState.off; object_reset(an_object); processing.remove("verse"); ++cntr; @@ -3373,15 +3306,15 @@ template DocReformDocAbstraction() { = bookindex_extract_hash.bookindex_nugget_hash( an_object["bookindex_nugget"], obj_cite_digits, - segment_anchor_tag_that_object_belongs_to + tag_in_seg ); an_object["is"] = "group"; auto comp_obj_location = node_construct.node_location_emitter( content_non_header, - segment_anchor_tag_that_object_belongs_to, + tag_in_seg, lev_anchor_tag, - tag_assoc_html, + tag_assoc, obj_cite_digits, cntr, heading_ptr-1, @@ -3391,24 +3324,25 @@ template DocReformDocAbstraction() { = obj_im.obj_inline_markup_and_anchor_tags_and_misc(an_object, an_object_key, conf_make_meta, false); an_object["substantive"] = substantive_obj_misc_tuple[sObj.content]; anchor_tag = substantive_obj_misc_tuple[sObj.anchor_tag]; - tag_assoc_html = inline_para_link_anchor(an_object, segment_anchor_tag_that_object_belongs_to, tag_assoc_html); - comp_obj_block = comp_obj_block.init; - comp_obj_block.metainfo.is_of_part = "body"; - comp_obj_block.metainfo.is_of_section = "body"; - comp_obj_block.metainfo.is_of_type = "block"; - 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["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"]; - comp_obj_block.has.inline_notes_reg = substantive_obj_misc_tuple[sObj.notes_reg]; - comp_obj_block.has.inline_notes_star = substantive_obj_misc_tuple[sObj.notes_star]; - comp_obj_block.has.inline_links = substantive_obj_misc_tuple[sObj.links]; - the_document_body_section ~= comp_obj_block; - obj_type_status["blocks"] = TriState.off; - obj_type_status["group"] = TriState.off; + comp_obj_block = comp_obj_block.init; + comp_obj_block.metainfo.is_of_part = "body"; + comp_obj_block.metainfo.is_of_section = "body"; + comp_obj_block.metainfo.is_of_type = "block"; + 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.html_segment_anchor_tag_is = tag_in_seg["seg_lv4"]; + comp_obj_block.tags.epub_segment_anchor_tag_is = tag_in_seg["seg_lv1_to_4"]; + 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"]; + comp_obj_block.has.inline_notes_reg = substantive_obj_misc_tuple[sObj.notes_reg]; + comp_obj_block.has.inline_notes_star = substantive_obj_misc_tuple[sObj.notes_star]; + comp_obj_block.has.inline_links = substantive_obj_misc_tuple[sObj.links]; + the_document_body_section ~= comp_obj_block; + tag_assoc = inline_para_link_anchor(an_object, tag_in_seg, tag_assoc); + obj_type_status["blocks"] = TriState.off; + obj_type_status["group"] = TriState.off; object_reset(an_object); processing.remove("verse"); ++cntr; @@ -3420,15 +3354,15 @@ template DocReformDocAbstraction() { = bookindex_extract_hash.bookindex_nugget_hash( an_object["bookindex_nugget"], obj_cite_digits, - segment_anchor_tag_that_object_belongs_to + tag_in_seg ); an_object["is"] = "block"; auto comp_obj_location = node_construct.node_location_emitter( content_non_header, - segment_anchor_tag_that_object_belongs_to, + tag_in_seg, lev_anchor_tag, - tag_assoc_html, + tag_assoc, obj_cite_digits, cntr, heading_ptr-1, @@ -3436,24 +3370,26 @@ template DocReformDocAbstraction() { ); auto substantive_obj_misc_tuple = obj_im.obj_inline_markup_and_anchor_tags_and_misc(an_object, an_object_key, conf_make_meta, false); - an_object["substantive"] = substantive_obj_misc_tuple[sObj.content]; - comp_obj_block = comp_obj_block.init; - comp_obj_block.metainfo.is_of_part = "body"; - comp_obj_block.metainfo.is_of_section = "body"; - comp_obj_block.metainfo.is_of_type = "block"; - 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["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"]; - comp_obj_block.has.inline_notes_reg = substantive_obj_misc_tuple[sObj.notes_reg]; - comp_obj_block.has.inline_notes_star = substantive_obj_misc_tuple[sObj.notes_star]; - comp_obj_block.has.inline_links = substantive_obj_misc_tuple[sObj.links]; - the_document_body_section ~= comp_obj_block; - obj_type_status["blocks"] = TriState.off; - obj_type_status["block"] = TriState.off; + an_object["substantive"] = substantive_obj_misc_tuple[sObj.content]; + // anchor_tag = substantive_obj_misc_tuple[sObj.anchor_tag]; + comp_obj_block = comp_obj_block.init; + comp_obj_block.metainfo.is_of_part = "body"; + comp_obj_block.metainfo.is_of_section = "body"; + comp_obj_block.metainfo.is_of_type = "block"; + 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.html_segment_anchor_tag_is = tag_in_seg["seg_lv4"]; + comp_obj_block.tags.epub_segment_anchor_tag_is = tag_in_seg["seg_lv1_to_4"]; + 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"]; + comp_obj_block.has.inline_notes_reg = substantive_obj_misc_tuple[sObj.notes_reg]; + comp_obj_block.has.inline_notes_star = substantive_obj_misc_tuple[sObj.notes_star]; + comp_obj_block.has.inline_links = substantive_obj_misc_tuple[sObj.links]; + the_document_body_section ~= comp_obj_block; + obj_type_status["blocks"] = TriState.off; + obj_type_status["block"] = TriState.off; object_reset(an_object); processing.remove("verse"); ++cntr; @@ -3464,15 +3400,15 @@ template DocReformDocAbstraction() { = bookindex_extract_hash.bookindex_nugget_hash( an_object["bookindex_nugget"], obj_cite_digits, - segment_anchor_tag_that_object_belongs_to + tag_in_seg ); an_object["is"] = "verse"; auto comp_obj_location = node_construct.node_location_emitter( content_non_header, - segment_anchor_tag_that_object_belongs_to, + tag_in_seg, lev_anchor_tag, - tag_assoc_html, + tag_assoc, obj_cite_digits, cntr, heading_ptr-1, @@ -3501,15 +3437,15 @@ template DocReformDocAbstraction() { = bookindex_extract_hash.bookindex_nugget_hash( an_object["bookindex_nugget"], obj_cite_digits, - segment_anchor_tag_that_object_belongs_to + tag_in_seg ); an_object["is"] = "code"; auto comp_obj_location = node_construct.node_location_emitter( content_non_header, - segment_anchor_tag_that_object_belongs_to, + tag_in_seg, lev_anchor_tag, - tag_assoc_html, + tag_assoc, obj_cite_digits, cntr, heading_ptr-1, @@ -3519,23 +3455,24 @@ template DocReformDocAbstraction() { = obj_im.obj_inline_markup_and_anchor_tags_and_misc(an_object, an_object_key, conf_make_meta, false); an_object["substantive"] = substantive_obj_misc_tuple[sObj.content]; anchor_tag = substantive_obj_misc_tuple[sObj.anchor_tag]; - comp_obj_code = comp_obj_code.init; - comp_obj_code.metainfo.is_of_part = "body"; - comp_obj_code.metainfo.is_of_section = "body"; - comp_obj_code.metainfo.is_of_type = "block"; - 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["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"]; - comp_obj_code.has.inline_notes_reg = substantive_obj_misc_tuple[sObj.notes_reg]; - comp_obj_code.has.inline_notes_star = substantive_obj_misc_tuple[sObj.notes_star]; - comp_obj_code.has.inline_links = substantive_obj_misc_tuple[sObj.links]; - the_document_body_section ~= comp_obj_code; - obj_type_status["blocks"] = TriState.off; - obj_type_status["code"] = TriState.off; + comp_obj_code = comp_obj_code.init; + comp_obj_code.metainfo.is_of_part = "body"; + comp_obj_code.metainfo.is_of_section = "body"; + comp_obj_code.metainfo.is_of_type = "block"; + 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.html_segment_anchor_tag_is = tag_in_seg["seg_lv4"]; + comp_obj_code.tags.epub_segment_anchor_tag_is = tag_in_seg["seg_lv1_to_4"]; + 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"]; + comp_obj_code.has.inline_notes_reg = substantive_obj_misc_tuple[sObj.notes_reg]; + comp_obj_code.has.inline_notes_star = substantive_obj_misc_tuple[sObj.notes_star]; + comp_obj_code.has.inline_links = substantive_obj_misc_tuple[sObj.links]; + the_document_body_section ~= comp_obj_code; + obj_type_status["blocks"] = TriState.off; + obj_type_status["code"] = TriState.off; object_reset(an_object); processing.remove("verse"); ++cntr; @@ -3548,15 +3485,15 @@ template DocReformDocAbstraction() { = bookindex_extract_hash.bookindex_nugget_hash( an_object["bookindex_nugget"], obj_cite_digits, - segment_anchor_tag_that_object_belongs_to + tag_in_seg ); an_object["is"] = "table"; auto comp_obj_location = node_construct.node_location_emitter( content_non_header, - segment_anchor_tag_that_object_belongs_to, + tag_in_seg, lev_anchor_tag, - tag_assoc_html, + tag_assoc, obj_cite_digits, cntr, heading_ptr-1, @@ -3564,18 +3501,19 @@ template DocReformDocAbstraction() { ); auto substantive_obj_misc_tuple = obj_im.obj_inline_markup_and_anchor_tags_and_misc(an_object, an_object_key, conf_make_meta, false); - an_object["substantive"] = substantive_obj_misc_tuple[sObj.content]; - 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["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"]); - comp_obj_block = table_substantive_munge(comp_obj_block, an_object["substantive"]); - the_document_body_section ~= comp_obj_block; - obj_type_status["blocks"] = TriState.off; - obj_type_status["table"] = TriState.off; + an_object["substantive"] = substantive_obj_misc_tuple[sObj.content]; + 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.html_segment_anchor_tag_is = tag_in_seg["seg_lv4"]; + comp_obj_block.tags.epub_segment_anchor_tag_is = tag_in_seg["seg_lv1_to_4"]; + 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"]); + comp_obj_block = table_substantive_munge(comp_obj_block, an_object["substantive"]); + the_document_body_section ~= comp_obj_block; + obj_type_status["blocks"] = TriState.off; + obj_type_status["table"] = TriState.off; object_reset(an_object); processing.remove("verse"); ++cntr; @@ -4737,18 +4675,18 @@ template DocReformDocAbstraction() { auto table_of_contents_gather_headings(O,CMM,Ts,Ta,X,Toc)( O obj_, CMM conf_make_meta, - Ts segment_anchor_tag_that_object_belongs_to, + Ts tag_in_seg, Ta _anchor_tag, return ref X lev4_subtoc, Toc the_table_of_contents_section, ) in { debug(asserts) { - static assert(is(typeof(obj_) == string[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])); + static assert(is(typeof(obj_) == string[string])); + static assert(is(typeof(tag_in_seg) == 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[])); } } body { @@ -4784,7 +4722,7 @@ template DocReformDocAbstraction() { comp_obj_toc.attrib.bullet = false; comp_obj_toc.text = toc_txt_.to!string.strip; comp_obj_toc.has.inline_links = true; - the_table_of_contents_section["scroll"] ~= comp_obj_toc; + the_table_of_contents_section ~= comp_obj_toc; } else { indent=[ "hang_position" : 0, @@ -4803,7 +4741,7 @@ template DocReformDocAbstraction() { comp_obj_toc.attrib.bullet = false; comp_obj_toc.text = "Table of Contents"; comp_obj_toc.has.inline_links = true; - the_table_of_contents_section["scroll"] ~= comp_obj_toc; + the_table_of_contents_section ~= comp_obj_toc; } comp_obj_toc = comp_obj_toc.init; comp_obj_toc.metainfo.is_of_part = "frontmatter"; @@ -4816,83 +4754,21 @@ template DocReformDocAbstraction() { comp_obj_toc.attrib.bullet = false; comp_obj_toc.has.inline_links = true; switch (obj_["lev_markup_number"].to!int) { - case 0: - indent=[ - "hang_position" : 0, - "base_position" : 0, - ]; - toc_txt_ = "{ Table of Contents }" ~ mkup.mark_internal_site_lnk ~ "toc.fnSuffix"; - toc_txt_= munge.url_links(toc_txt_); - comp_obj_toc.attrib.indent_hang = indent["hang_position"]; - comp_obj_toc.attrib.indent_base = indent["base_position"]; - comp_obj_toc.text = toc_txt_.to!string.strip; - comp_obj_toc.has.inline_links = true; - the_table_of_contents_section["seg"] ~= comp_obj_toc; - break; - case 1: .. case 3: - indent=[ - "hang_position" : obj_["lev_markup_number"].to!int, - "base_position" : obj_["lev_markup_number"].to!int, - ]; - toc_txt_ = format( - "%s", - heading_toc_, - ); - toc_txt_= munge.url_links(toc_txt_); - comp_obj_toc.attrib.indent_hang = indent["hang_position"]; - comp_obj_toc.attrib.indent_base = indent["base_position"]; - comp_obj_toc.text = toc_txt_.to!string.strip; - comp_obj_toc.has.inline_links = true; - the_table_of_contents_section["seg"] ~= comp_obj_toc; + case 0: .. case 3: break; case 4: - toc_txt_ = format( - "{ %s }%s%s%s", - heading_toc_, - mkup.mark_internal_site_lnk, - segment_anchor_tag_that_object_belongs_to["html"], - ".fnSuffix", - ); - 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, - "base_position" : obj_["lev_markup_number"].to!int, - ]; - comp_obj_toc.attrib.indent_hang = indent["hang_position"]; - comp_obj_toc.attrib.indent_base = indent["base_position"]; - comp_obj_toc.text = toc_txt_.to!string.strip; - comp_obj_toc.has.inline_links = true; - the_table_of_contents_section["seg"] ~= comp_obj_toc; + lev4_subtoc[tag_in_seg["seg_lv4"]] = []; break; case 5: .. case 7: - toc_txt_ = format( - "{ %s }%s%s%s#%s", - heading_toc_, - mkup.mark_internal_site_lnk, - segment_anchor_tag_that_object_belongs_to["html"], - ".fnSuffix", - _anchor_tag, - ); subtoc_txt_ = format( "{ %s }#%s", heading_toc_, _anchor_tag, ); - lev4_subtoc[segment_anchor_tag_that_object_belongs_to["html"]] + lev4_subtoc[tag_in_seg["seg_lv4"]] ~= munge.url_links(obj_["lev_markup_number"] ~ "~ " ~ subtoc_txt_.to!string.strip ); - toc_txt_= munge.url_links(toc_txt_); - indent=[ - "hang_position" : obj_["lev_markup_number"].to!int, - "base_position" : obj_["lev_markup_number"].to!int, - ]; - comp_obj_toc.attrib.indent_hang = indent["hang_position"]; - comp_obj_toc.attrib.indent_base = indent["base_position"]; - comp_obj_toc.text = toc_txt_.to!string.strip; - comp_obj_toc.has.inline_links = true; - the_table_of_contents_section["seg"] ~= comp_obj_toc; break; default: break; @@ -4904,6 +4780,7 @@ template DocReformDocAbstraction() { private: static int[] heading_num = [ 0, 0, 0, 0 ]; static string heading_number_auto_composite = ""; + static string heading_number_auto_composite_segname = ""; static string _configured_auto_heading_numbering_and_segment_anchor_tags(M,O,CMM)( M munge_, O obj_, @@ -4997,6 +4874,10 @@ template DocReformDocAbstraction() { } else { heading_number_auto_composite = ""; } + heading_number_auto_composite_segname = + (heading_number_auto_composite.empty) + ? "" + : "seg_" ~ heading_number_auto_composite; debug(heading_number_auto) { writeln(heading_number_auto_composite); } @@ -5006,7 +4887,7 @@ template DocReformDocAbstraction() { .replaceFirst(rgx.heading, "$1~$2 " ~ heading_number_auto_composite ~ ". ") .replaceFirst(rgx.heading_marker_missing_tag, - "$1~" ~ heading_number_auto_composite ~ " "); + "$1~" ~ heading_number_auto_composite_segname ~ " "); } } return munge_; @@ -5364,7 +5245,7 @@ template DocReformDocAbstraction() { string[][string][string] bookindex_nugget_hash(BI,N,S)( BI bookindex_section, N obj_cite_digits, - S segment_anchor_tag_that_object_belongs_to, + S tag_in_seg, ) in { debug(asserts) { @@ -5375,7 +5256,9 @@ template DocReformDocAbstraction() { if (!bookindex_section.empty) { writeln( "* [bookindex] ", - "[", obj_cite_digits.on.to!string, ": ", segment_anchor_tag_that_object_belongs_to["html"], "] ", bookindex_section + "[", obj_cite_digits.on.to!string, ": ", tag_in_seg["seg_lv4"], "] ", bookindex_section, + " - - - ", + "[", obj_cite_digits.on.to!string, "] ", bookindex_section ); } } @@ -5395,15 +5278,13 @@ template DocReformDocAbstraction() { object_number_offset = m.captures[2].to!int; object_number_endpoint=(obj_cite_digits.on + object_number_offset); object_numbers ~= (obj_cite_digits.on.to!string - ~ "-" ~ object_number_endpoint.to!string - ~ ":" ~ segment_anchor_tag_that_object_belongs_to["html"]); + ~ "-" ~ object_number_endpoint.to!string); } else { main_term = bi_main_term_and_rest[0].strip; - object_numbers ~= obj_cite_digits.on.to!string - ~ ":" ~ segment_anchor_tag_that_object_belongs_to["html"]; + object_numbers ~= obj_cite_digits.on.to!string; } bi[main_term]["_a"] ~= object_numbers; - object_numbers=null; + object_numbers = null; if (bi_main_term_and_rest.length > 1) { auto bi_sub_terms_split_arr = bi_main_term_and_rest[1].split( @@ -5415,12 +5296,10 @@ template DocReformDocAbstraction() { object_number_offset = m.captures[2].to!int; object_number_endpoint=(obj_cite_digits.on + object_number_offset); object_numbers ~= (obj_cite_digits.on.to!string - ~ " - " ~ object_number_endpoint.to!string - ~ ":" ~ segment_anchor_tag_that_object_belongs_to["html"]); + ~ " - " ~ object_number_endpoint.to!string); } else { sub_term = sub_terms_bits.strip; - object_numbers ~= obj_cite_digits.on.to!string - ~ ":" ~ segment_anchor_tag_that_object_belongs_to["html"]; + object_numbers ~= obj_cite_digits.on.to!string; } if (!empty(sub_term)) { bi[main_term][sub_term] ~= object_numbers; @@ -5517,14 +5396,14 @@ template DocReformDocAbstraction() { int[string] indent; auto mainkeys = bookindex_unordered_hashes.byKey.array.sort().release; - ObjGenericComposite[][string] bookindex_section; + ObjGenericComposite[] bookindex_section; ObjGenericComposite comp_obj_heading_, comp_obj_para; auto node_para_int_ = node_metadata_para_int; auto node_para_str_ = node_metadata_para_str; if ((mainkeys.length > 0) && (opt_action.backmatter && opt_action.section_bookindex)) { - string bi_tmp_seg, bi_tmp_scroll; + string bi_tmp; string[] bi_tmp_tags; comp_obj_heading_ = comp_obj_heading_.init; comp_obj_heading_.metainfo.is_of_part = "backmatter"; @@ -5535,15 +5414,17 @@ 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_html = "_part_book_index"; - comp_obj_heading_.tags.segment_anchor_tag_epub = comp_obj_heading_.tags.segment_anchor_tag_html; + comp_obj_heading_.tags.segment_anchor_tag_epub = "_part_book_index"; + comp_obj_heading_.tags.anchor_tag_html = comp_obj_heading_.tags.segment_anchor_tag_epub; + comp_obj_heading_.tags.in_segment_html = "bookindex"; comp_obj_heading_.metainfo.heading_lev_markup = 1; comp_obj_heading_.metainfo.heading_lev_collapsed = 1; comp_obj_heading_.metainfo.parent_ocn = 1; comp_obj_heading_.metainfo.parent_lev_markup = 0; comp_obj_heading.has.inline_links = true; - bookindex_section["scroll"] ~= comp_obj_heading_; - bookindex_section["seg"] ~= comp_obj_heading_; + bookindex_section ~= comp_obj_heading_; + tag_assoc[comp_obj_heading_.tags.anchor_tag_html]["seg_lv4"] = comp_obj_heading_.tags.in_segment_html; + tag_assoc[comp_obj_heading_.tags.segment_anchor_tag_epub]["seg_lv1_to_4"] = comp_obj_heading_.tags.segment_anchor_tag_epub; ++mkn; comp_obj_heading_ = comp_obj_heading_.init; comp_obj_heading_.metainfo.is_of_part = "backmatter"; @@ -5554,44 +5435,32 @@ 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_html = "bookindex"; - comp_obj_heading_.tags.segment_anchor_tag_epub = comp_obj_heading_.tags.segment_anchor_tag_html; + comp_obj_heading_.tags.segment_anchor_tag_epub = "bookindex"; + comp_obj_heading_.tags.anchor_tag_html = comp_obj_heading_.tags.segment_anchor_tag_epub; + comp_obj_heading_.tags.in_segment_html = comp_obj_heading_.tags.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; comp_obj_heading_.metainfo.parent_lev_markup = 0; comp_obj_heading.has.inline_links = false; comp_obj_heading_.tags.anchor_tags = ["bookindex"]; - bookindex_section["scroll"] ~= comp_obj_heading_; - bookindex_section["seg"] ~= comp_obj_heading_; + bookindex_section ~= comp_obj_heading_; + tag_assoc[comp_obj_heading_.tags.anchor_tag_html]["seg_lv4"] = comp_obj_heading_.tags.in_segment_html; + tag_assoc[comp_obj_heading_.tags.segment_anchor_tag_epub]["seg_lv1_to_4"] = comp_obj_heading_.tags.segment_anchor_tag_epub; ++mkn; import std.array : appender; auto buffer = appender!(char[])(); string[dchar] transTable = [' ' : "_"]; foreach (mainkey; mainkeys) { bi_tmp_tags = [""]; - bi_tmp_scroll = "!{" ~ mainkey ~ "}! "; + bi_tmp = "!{" ~ mainkey ~ "}! "; buffer.clear(); bi_tmp_tags ~= translate(mainkey, transTable); - bi_tmp_seg = "!{" ~ mainkey ~ "}! "; - auto bkidx_lnk_seg(string locs) { - string markup = ""; - if (auto m = locs.matchFirst(rgx.book_index_go_seg)) { - markup - = munge.url_links("{ " ~ m["link"] ~ " }" - ~ mkup.mark_internal_site_lnk ~ m["seg"] ~ ".fnSuffix" - ~ "#" ~ m["ocn"] ~ ", "); - } else { - writeln(__LINE__, ": ", locs); - } - return markup; - } - auto bkidx_lnk_scroll(string locs) { + auto bkidx_lnk(string locs) { string markup = ""; if (auto m = locs.matchFirst(rgx.book_index_go)) { markup = munge.url_links("{ " ~ m["link"] ~ " }" - ~ mkup.mark_internal_site_lnk ~ "#" ~ m["ocn"] ~ ", "); } else { writeln(__LINE__, ": ", locs); @@ -5599,35 +5468,29 @@ template DocReformDocAbstraction() { return markup; } foreach (ref_; bookindex_unordered_hashes[mainkey]["_a"]) { - bi_tmp_scroll ~= bkidx_lnk_scroll(ref_); - bi_tmp_seg ~= bkidx_lnk_seg(ref_); + bi_tmp ~= bkidx_lnk(ref_); } - bi_tmp_scroll ~= " \\\\\n "; - bi_tmp_seg ~= " \\\\\n "; + bi_tmp ~= " \\\\\n "; bookindex_unordered_hashes[mainkey].remove("_a"); auto subkeys = bookindex_unordered_hashes[mainkey].byKey.array.sort().release; foreach (subkey; subkeys) { - bi_tmp_scroll ~= subkey ~ ", "; + bi_tmp ~= subkey ~ ", "; buffer.clear(); bi_tmp_tags ~= translate(subkey, transTable); - bi_tmp_seg ~= subkey ~ ", "; foreach (ref_; bookindex_unordered_hashes[mainkey][subkey]) { - bi_tmp_scroll ~= bkidx_lnk_scroll(ref_); - bi_tmp_seg ~= bkidx_lnk_seg(ref_); + bi_tmp ~= bkidx_lnk(ref_); } - bi_tmp_scroll ~= " \\\\\n "; - bi_tmp_seg ~= " \\\\\n "; + bi_tmp ~= " \\\\\n "; ++skn; } - bi_tmp_scroll = (bi_tmp_scroll).replaceFirst(rgx.trailing_linebreak, ""); - bi_tmp_seg = (bi_tmp_seg).replaceFirst(rgx.trailing_linebreak, ""); + bi_tmp = (bi_tmp).replaceFirst(rgx.trailing_linebreak, ""); comp_obj_para = comp_obj_para.init; comp_obj_para.metainfo.is_of_part = "backmatter"; comp_obj_para.metainfo.is_of_section = "bookindex"; comp_obj_para.metainfo.is_of_type = "para"; comp_obj_para.metainfo.is_a = "bookindex"; - comp_obj_para.text = bi_tmp_scroll.to!string.strip; + comp_obj_para.text = bi_tmp.to!string.strip; comp_obj_para.metainfo.ocn = 0; comp_obj_para.metainfo.object_number_off = ""; comp_obj_para.metainfo.object_number_type = 0; @@ -5636,9 +5499,8 @@ template DocReformDocAbstraction() { comp_obj_para.attrib.indent_base = 1; comp_obj_para.attrib.bullet = false; comp_obj_para.has.inline_links = true; - bookindex_section["scroll"] ~= comp_obj_para; - comp_obj_para.text = bi_tmp_seg.to!string.strip; - bookindex_section["seg"] ~= comp_obj_para; + comp_obj_para.text = bi_tmp.to!string.strip; + bookindex_section ~= comp_obj_para; ++mkn; } } else { // no book index, (figure out what to do here) @@ -5651,8 +5513,7 @@ template DocReformDocAbstraction() { comp_obj_heading_.metainfo.heading_lev_collapsed = 1; comp_obj_heading_.metainfo.parent_ocn = 1; comp_obj_heading_.metainfo.parent_lev_markup = 0; - bookindex_section["scroll"] ~= comp_obj_heading_; - bookindex_section["seg"] ~= comp_obj_heading_; + bookindex_section ~= comp_obj_heading_; } auto t = tuple( bookindex_section, @@ -5669,7 +5530,7 @@ template DocReformDocAbstraction() { static auto rgx = Rgx(); private auto gather_notes_for_endnote_section( ObjGenericComposite[] contents_am, - string[string] segment_anchor_tag_that_object_belongs_to, + string[string] tag_in_seg, int cntr, ) in { @@ -5700,13 +5561,13 @@ template DocReformDocAbstraction() { writeln( "{^{", m.captures[1], ".}^}" ~ mkup.mark_internal_site_lnk, - segment_anchor_tag_that_object_belongs_to["html"], + tag_in_seg["seg_lv4"], ".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["html"].empty) + object_notes["notes"] ~= (tag_in_seg["seg_lv4"].empty) ? (munge.url_links( "{^{" ~ m.captures[1] ~ ".}^}#noteref_" ~ m.captures[1]) ~ " " @@ -5715,7 +5576,7 @@ template DocReformDocAbstraction() { : (munge.url_links( "{^{" ~ m.captures[1] ~ ".}^}" ~ mkup.mark_internal_site_lnk - ~ segment_anchor_tag_that_object_belongs_to["html"] + ~ tag_in_seg["seg_lv4"] ~ ".fnSuffix#noteref_" ~ m.captures[1]) ~ " " ~ m.captures[2] ~ "』" @@ -5763,13 +5624,16 @@ 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_html = "_part_endnotes"; - comp_obj_heading_.tags.segment_anchor_tag_epub = comp_obj_heading_.tags.segment_anchor_tag_html; + comp_obj_heading_.tags.segment_anchor_tag_epub = "_part_endnotes"; + comp_obj_heading_.tags.anchor_tag_html = comp_obj_heading_.tags.segment_anchor_tag_epub; + comp_obj_heading_.tags.in_segment_html = "endnotes"; comp_obj_heading_.metainfo.heading_lev_markup = 1; comp_obj_heading_.metainfo.heading_lev_collapsed = 1; comp_obj_heading_.metainfo.parent_ocn = 1; comp_obj_heading_.metainfo.parent_lev_markup = 0; the_endnotes_section ~= comp_obj_heading_; + tag_assoc[comp_obj_heading_.tags.anchor_tag_html]["seg_lv4"] = comp_obj_heading_.tags.in_segment_html; + tag_assoc[comp_obj_heading_.tags.segment_anchor_tag_epub]["seg_lv1_to_4"] = comp_obj_heading_.tags.segment_anchor_tag_epub; ++mkn; comp_obj_heading_ = comp_obj_heading_.init; comp_obj_heading_.metainfo.is_of_part = "backmatter"; @@ -5780,14 +5644,17 @@ 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_html = "endnotes"; - comp_obj_heading_.tags.segment_anchor_tag_epub = comp_obj_heading_.tags.segment_anchor_tag_html; + comp_obj_heading_.tags.segment_anchor_tag_epub = "endnotes"; + comp_obj_heading_.tags.anchor_tag_html = comp_obj_heading_.tags.segment_anchor_tag_epub; + comp_obj_heading_.tags.in_segment_html = comp_obj_heading_.tags.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; comp_obj_heading_.metainfo.parent_lev_markup = 0; comp_obj_heading_.tags.anchor_tags = ["endnotes"]; the_endnotes_section ~= comp_obj_heading_; + tag_assoc[comp_obj_heading_.tags.anchor_tag_html]["seg_lv4"] = comp_obj_heading_.tags.in_segment_html; + tag_assoc[comp_obj_heading_.tags.segment_anchor_tag_epub]["seg_lv1_to_4"] = comp_obj_heading_.tags.segment_anchor_tag_epub; ++mkn; } else { comp_obj_heading_ = comp_obj_heading_.init; @@ -5940,9 +5807,9 @@ 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_that_object_belongs_to, + Tg tag_in_seg, La lev_anchor_tag, - Ta tag_assoc_html, + Ta tag_assoc, N obj_cite_digits, C cntr_, P ptr_, @@ -5950,12 +5817,12 @@ template DocReformDocAbstraction() { ) in { debug(asserts) { - static assert(is(typeof(lev_markup_number) == 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)); - static assert(is(typeof(is_) == string)); + static assert(is(typeof(lev_markup_number) == string)); + static assert(is(typeof(tag_in_seg) == string[string])); + static assert(is(typeof(obj_cite_digits.on) == int)); + static assert(is(typeof(cntr_) == int)); + static assert(is(typeof(ptr_) == int)); + static assert(is(typeof(is_) == string)); } assert(is_ != "heading"); assert(obj_cite_digits.on.to!int >= 0); @@ -5977,14 +5844,14 @@ template DocReformDocAbstraction() { p_["object_number"] = lv4; } ObjGenericComposite comp_obj_location; - 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_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"]; + 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.anchor_tag_html = tag_in_seg["seg_lv4"]; + comp_obj_location.tags.segment_anchor_tag_epub = tag_in_seg["seg_lv1_to_4"]; + comp_obj_location.tags.heading_lev_anchor_tag = lev_anchor_tag; + comp_obj_location.metainfo.parent_ocn = p_["object_number"]; + comp_obj_location.metainfo.parent_lev_markup = p_["lev_markup_number"]; debug(_node) { if (lev_markup_number.match(rgx.levels_numbered_headings)) { writeln("x ", _node.to!string); @@ -6003,9 +5870,9 @@ template DocReformDocAbstraction() { T _text, Lm lev_markup_number, Lc lev_collapsed_number, - TaB segment_anchor_tag_that_object_belongs_to, + TaB tag_in_seg, TaL lev_anchor_tag, - TA tag_assoc_html, + TA tag_assoc, N obj_cite_digits, C cntr_, P ptr_, @@ -6022,7 +5889,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[string])); + static assert(is(typeof(tag_in_seg) == string[string])); static assert(is(typeof(obj_cite_digits.on) == int)); static assert(is(typeof(cntr_) == int)); static assert(is(typeof(ptr_) == int)); @@ -6139,11 +6006,14 @@ template DocReformDocAbstraction() { _comp_obj_heading_.text = _text.to!string.strip; _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.o_n_book_index = obj_cite_digits.bkidx; _comp_obj_heading_.metainfo.object_number_type = obj_cite_digits.type; - _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.segment_anchor_tag_epub = tag_in_seg["seg_lv1_to_4"]; + _comp_obj_heading_.tags.anchor_tag_html = tag_in_seg["seg_lv4"]; + _comp_obj_heading_.tags.in_segment_html = _comp_obj_heading_.tags.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["html"]; + _comp_obj_heading_.tags.html_segment_anchor_tag_is = tag_in_seg["seg_lv4"]; + _comp_obj_heading_.tags.epub_segment_anchor_tag_is = tag_in_seg["seg_lv1_to_4"]; _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"]; @@ -6155,6 +6025,8 @@ template DocReformDocAbstraction() { _comp_obj_heading_.has.inline_notes_reg = flag_notes_reg; _comp_obj_heading_.has.inline_notes_star = flag_notes_star; _comp_obj_heading_.has.inline_links = flag_links; + tag_assoc[_comp_obj_heading_.tags.anchor_tag_html]["seg_lv4"] = _comp_obj_heading_.tags.in_segment_html; + tag_assoc[_comp_obj_heading_.tags.segment_anchor_tag_epub]["seg_lv1_to_4"] = _comp_obj_heading_.tags.segment_anchor_tag_epub; debug(_node) { if (lev_markup_number.match(rgx.levels_numbered_headings)) { writeln("* ", _node.to!string); diff --git a/src/doc_reform/meta/metadoc_summary.d b/src/doc_reform/meta/metadoc_summary.d index 6d4a01b..e44a12c 100644 --- a/src/doc_reform/meta/metadoc_summary.d +++ b/src/doc_reform/meta/metadoc_summary.d @@ -37,7 +37,7 @@ template DocReformAbstractionSummary() { check["last_object_number"] = obj.metainfo.object_number; } } - if (k == "bookindex_seg") { + if (k == "bookindex") { if (obj.metainfo.object_number_type == 2) { check["last_object_number_book_index"] = obj.metainfo.object_number_book_index; } @@ -59,7 +59,7 @@ template DocReformAbstractionSummary() { doc_matters.src.filename, markup.repeat_character_by_number_provided("-", char_repeat_number), "length toc arr:", - to!int(doc_abstraction["toc_seg"].length), + to!int(doc_abstraction["toc"].length), "length doc_abstraction arr:", to!int(doc_abstraction["body"].length), "last doc body ocn:", @@ -79,8 +79,8 @@ template DocReformAbstractionSummary() { ? (to!int(doc_abstraction["bibliography"].length)) : 0, "length bookindex:", - (doc_abstraction["bookindex_seg"].length > 1) - ? (to!int(doc_abstraction["bookindex_seg"].length)) + (doc_abstraction["bookindex"].length > 1) + ? (to!int(doc_abstraction["bookindex"].length)) : 0, " last book idx ocn:", to!int(check["last_object_number_book_index"]), diff --git a/src/doc_reform/meta/object_setter.d b/src/doc_reform/meta/object_setter.d index ebff33b..b3325fa 100644 --- a/src/doc_reform/meta/object_setter.d +++ b/src/doc_reform/meta/object_setter.d @@ -104,9 +104,11 @@ template ObjectSetter() { } struct DocObj_Tags_ { string[] heading_ancestors_text = [ "", "", "", "", "", "", "", "", ]; // TODO redundant? see markedup and collapsed ancestors DONE - string segment_anchor_tag_html = ""; + string anchor_tag_html = ""; + string in_segment_html = ""; string segment_anchor_tag_epub = ""; - string segment_anchor_tag_is = ""; + string html_segment_anchor_tag_is = ""; + string epub_segment_anchor_tag_is = ""; string heading_lev_anchor_tag = ""; string segname_prev = ""; string segname_next = ""; diff --git a/src/doc_reform/meta/rgx.d b/src/doc_reform/meta/rgx.d index 2ff08b3..6143656 100644 --- a/src/doc_reform/meta/rgx.d +++ b/src/doc_reform/meta/rgx.d @@ -189,8 +189,8 @@ static template DocReformRgxInit() { /+ bookindex split +/ static bi_main_terms_split = ctRegex!(`\s*;\s*`); static bi_main_term_plus_rest_split = ctRegex!(`\s*:\s*`); - static bi_sub_terms_plus_object_number_offset_split = ctRegex!(`\s*\|\s*`); - static bi_term_and_object_numbers_match = ctRegex!(`^(.+?)\+(\d+)`); + static bi_sub_terms_plus_object_number_offset_split = ctRegex!(`\s*\|\s*`); + static bi_term_and_object_numbers_match = ctRegex!(`^(.+?)\+(\d+)`); /+ language codes +/ auto language_codes = ctRegex!("(am|bg|bn|br|ca|cs|cy|da|de|el|en|eo|es|et|eu|fi|fr|ga|gl|he|hi|hr|hy|ia|is|it|ja|ko|la|lo|lt|lv|ml|mr|nl|no|nn|oc|pl|pt|pt_BR|ro|ru|sa|se|sk|sl|sq|sr|sv|ta|te|th|tk|tr|uk|ur|vi|zh)"); |