diff options
Diffstat (limited to 'src/doc_reform')
-rw-r--r-- | src/doc_reform/meta/metadoc_from_src.d | 69 |
1 files changed, 40 insertions, 29 deletions
diff --git a/src/doc_reform/meta/metadoc_from_src.d b/src/doc_reform/meta/metadoc_from_src.d index aefb5ea..69db575 100644 --- a/src/doc_reform/meta/metadoc_from_src.d +++ b/src/doc_reform/meta/metadoc_from_src.d @@ -33,7 +33,9 @@ template DocReformDocAbstraction() { string anchor_tag_; string segment_anchor_tag_that_object_belongs_to; string lev_anchor_tag; - string[][string] tag_assoc; + string[][string] tag_assoc_html; + string[][string] tag_assoc_lv0_to_lv3_html; + string[][string] tag_assoc_lv0_to_lv3_epub; string segment_anchor_tag_that_object_belongs_to_uri; /+ enum +/ enum State { off, on } @@ -238,16 +240,16 @@ 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) { + auto inline_para_link_anchor(O,St,TA)(O an_object, St segment_anchor_tag_that_object_belongs_to, TA tag_assoc_html) { static auto rgx = Rgx(); if (auto m = an_object["substantive"].match(rgx.inline_link_anchor)) { - if (m.captures[1] !in tag_assoc) { - tag_assoc[(m.captures[1])] = [segment_anchor_tag_that_object_belongs_to]; // follow figure out how to use for text inline anchor tags + if (m.captures[1] !in tag_assoc_html) { + tag_assoc_html[(m.captures[1])] = [segment_anchor_tag_that_object_belongs_to]; } else { writeln("a tag named already exists, check text line\n ", an_object["substantive"]); } } - return tag_assoc; + return tag_assoc_html; } /+ ↓ abstract marked up document +/ auto DocReformDocAbstraction(Src,CMM,Opt,Mfst)( @@ -866,17 +868,24 @@ template DocReformDocAbstraction() { } if ( an_object["lev_markup_number"].to!int == 4 - && !(anchor_tag.empty) + && (!(anchor_tag.empty) + || (tag_assoc_lv0_to_lv3_html.length > 1)) ) { segment_anchor_tag_that_object_belongs_to = anchor_tag; lev_anchor_tag = anchor_tag; - tag_assoc[anchor_tag] = [segment_anchor_tag_that_object_belongs_to]; + tag_assoc_html[anchor_tag] = [segment_anchor_tag_that_object_belongs_to]; + 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]; + } + } segment_anchor_tag_that_object_belongs_to_uri = anchor_tag ~ ".fnSuffix"; anchor_tag_ = anchor_tag; + tag_assoc_lv0_to_lv3_html = tag_assoc_lv0_to_lv3_html.init; } else if (an_object["lev_markup_number"].to!int > 4) { segment_anchor_tag_that_object_belongs_to = anchor_tag_; lev_anchor_tag = anchor_tag; - tag_assoc[anchor_tag] = [segment_anchor_tag_that_object_belongs_to]; + tag_assoc_html[anchor_tag] = [segment_anchor_tag_that_object_belongs_to]; segment_anchor_tag_that_object_belongs_to_uri = anchor_tag_ ~ ".fnSuffix#" ~ obj_cite_digits.on.to!string; } else if (an_object["lev_markup_number"].to!int < 4) { string segn; @@ -899,6 +908,8 @@ template DocReformDocAbstraction() { default: segment_anchor_tag_that_object_belongs_to = segn; segment_anchor_tag_that_object_belongs_to_uri = segn ~ ".fnSuffix"; + tag_assoc_lv0_to_lv3_html[segn] = [""]; + tag_assoc_lv0_to_lv3_epub[segn] = ["segn"]; break; } } @@ -928,7 +939,7 @@ template DocReformDocAbstraction() { an_object["lev_collapsed_number"], // string segment_anchor_tag_that_object_belongs_to, // string lev_anchor_tag, // string - tag_assoc, + tag_assoc_html, obj_cite_digits, // OCNset cntr, // int heading_ptr, // int @@ -967,7 +978,7 @@ template DocReformDocAbstraction() { content_non_header, segment_anchor_tag_that_object_belongs_to, lev_anchor_tag, - tag_assoc, + tag_assoc_html, obj_cite_digits, cntr, heading_ptr-1, @@ -977,7 +988,7 @@ 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 = inline_para_link_anchor(an_object, segment_anchor_tag_that_object_belongs_to, tag_assoc); + 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"; @@ -2324,7 +2335,7 @@ template DocReformDocAbstraction() { sequenced_document_keys, segnames_lv4, segnames_lv0_to_4, - tag_assoc, + tag_assoc_html, images, ); return t; @@ -2800,7 +2811,7 @@ 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 = inline_para_link_anchor(an_object, segment_anchor_tag_that_object_belongs_to, tag_assoc); + 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"; @@ -2851,7 +2862,7 @@ template DocReformDocAbstraction() { content_non_header, segment_anchor_tag_that_object_belongs_to, lev_anchor_tag, - tag_assoc, + tag_assoc_html, obj_cite_digits, cntr, heading_ptr-1, @@ -2861,7 +2872,7 @@ 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 = inline_para_link_anchor(an_object, segment_anchor_tag_that_object_belongs_to, tag_assoc); + 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"; @@ -2905,7 +2916,7 @@ 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 = inline_para_link_anchor(an_object, segment_anchor_tag_that_object_belongs_to, tag_assoc); + 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"; @@ -2956,7 +2967,7 @@ template DocReformDocAbstraction() { content_non_header, segment_anchor_tag_that_object_belongs_to, lev_anchor_tag, - tag_assoc, + tag_assoc_html, obj_cite_digits, cntr, heading_ptr-1, @@ -2966,7 +2977,7 @@ 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 = inline_para_link_anchor(an_object, segment_anchor_tag_that_object_belongs_to, tag_assoc); + 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"; @@ -3260,7 +3271,7 @@ template DocReformDocAbstraction() { content_non_header, segment_anchor_tag_that_object_belongs_to, lev_anchor_tag, - tag_assoc, + tag_assoc_html, obj_cite_digits, cntr, heading_ptr-1, @@ -3322,7 +3333,7 @@ template DocReformDocAbstraction() { content_non_header, segment_anchor_tag_that_object_belongs_to, lev_anchor_tag, - tag_assoc, + tag_assoc_html, obj_cite_digits, cntr, heading_ptr-1, @@ -3332,7 +3343,7 @@ 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 = inline_para_link_anchor(an_object, segment_anchor_tag_that_object_belongs_to, tag_assoc); + 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"; @@ -3369,7 +3380,7 @@ template DocReformDocAbstraction() { content_non_header, segment_anchor_tag_that_object_belongs_to, lev_anchor_tag, - tag_assoc, + tag_assoc_html, obj_cite_digits, cntr, heading_ptr-1, @@ -3379,7 +3390,7 @@ 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 = inline_para_link_anchor(an_object, segment_anchor_tag_that_object_belongs_to, tag_assoc); + 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"; @@ -3416,7 +3427,7 @@ template DocReformDocAbstraction() { content_non_header, segment_anchor_tag_that_object_belongs_to, lev_anchor_tag, - tag_assoc, + tag_assoc_html, obj_cite_digits, cntr, heading_ptr-1, @@ -3460,7 +3471,7 @@ template DocReformDocAbstraction() { content_non_header, segment_anchor_tag_that_object_belongs_to, lev_anchor_tag, - tag_assoc, + tag_assoc_html, obj_cite_digits, cntr, heading_ptr-1, @@ -3497,7 +3508,7 @@ template DocReformDocAbstraction() { content_non_header, segment_anchor_tag_that_object_belongs_to, lev_anchor_tag, - tag_assoc, + tag_assoc_html, obj_cite_digits, cntr, heading_ptr-1, @@ -3544,7 +3555,7 @@ template DocReformDocAbstraction() { content_non_header, segment_anchor_tag_that_object_belongs_to, lev_anchor_tag, - tag_assoc, + tag_assoc_html, obj_cite_digits, cntr, heading_ptr-1, @@ -5927,7 +5938,7 @@ template DocReformDocAbstraction() { Lv lev_markup_number, Tg segment_anchor_tag, La lev_anchor_tag, - Ta tag_assoc, + Ta tag_assoc_html, N obj_cite_digits, C cntr_, P ptr_, @@ -5990,7 +6001,7 @@ template DocReformDocAbstraction() { Lc lev_collapsed_number, TaB segment_anchor_tag_that_object_belongs_to, TaL lev_anchor_tag, - TA tag_assoc, + TA tag_assoc_html, N obj_cite_digits, C cntr_, P ptr_, |