From c04e88ddf1e0662389ea0027b2104bf2199f3559 Mon Sep 17 00:00:00 2001 From: Ralph Amissah Date: Fri, 12 Oct 2018 17:20:34 -0400 Subject: internal linking to headers A to D for segmented html --- org/meta_abstraction.org | 69 ++++++++++++++++++++++++++++-------------------- 1 file changed, 40 insertions(+), 29 deletions(-) (limited to 'org') diff --git a/org/meta_abstraction.org b/org/meta_abstraction.org index 1b98b2e..b75a801 100644 --- a/org/meta_abstraction.org +++ b/org/meta_abstraction.org @@ -188,7 +188,9 @@ string anchor_tag; 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 } @@ -423,16 +425,16 @@ enum sObj { content, anchor_tag, notes_reg, notes_star, links, image_no_dimensio #+name: abs_inline_para_tag_associations #+BEGIN_SRC d -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; } #+END_SRC @@ -1195,17 +1197,24 @@ if ((obj_type_status["heading"] == State.on) } 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; @@ -1228,6 +1237,8 @@ if ((obj_type_status["heading"] == State.on) 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; } } @@ -1257,7 +1268,7 @@ if ((obj_type_status["heading"] == State.on) 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 @@ -1302,7 +1313,7 @@ if ((obj_type_status["heading"] == State.on) 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, @@ -1312,7 +1323,7 @@ if ((obj_type_status["heading"] == State.on) = 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"; @@ -2992,7 +3003,7 @@ auto t = tuple( sequenced_document_keys, segnames_lv4, segnames_lv0_to_4, - tag_assoc, + tag_assoc_html, images, ); return t; @@ -3801,7 +3812,7 @@ void _poem_block_(L,O,T,C,N,CMM,Ts)( = 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"; @@ -3852,7 +3863,7 @@ void _poem_block_(L,O,T,C,N,CMM,Ts)( 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, @@ -3862,7 +3873,7 @@ void _poem_block_(L,O,T,C,N,CMM,Ts)( = 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"; @@ -3906,7 +3917,7 @@ void _poem_block_(L,O,T,C,N,CMM,Ts)( = 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"; @@ -3957,7 +3968,7 @@ void _poem_block_(L,O,T,C,N,CMM,Ts)( 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, @@ -3967,7 +3978,7 @@ void _poem_block_(L,O,T,C,N,CMM,Ts)( = 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"; @@ -4104,7 +4115,7 @@ void _table_closed_make_special_notation_table_(N,CMM)( 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, @@ -4180,7 +4191,7 @@ void _block_flag_line_empty_(B,N,CMM,Ts)( 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, @@ -4190,7 +4201,7 @@ void _block_flag_line_empty_(B,N,CMM,Ts)( = 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"; @@ -4233,7 +4244,7 @@ void _block_flag_line_empty_(B,N,CMM,Ts)( 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, @@ -4243,7 +4254,7 @@ void _block_flag_line_empty_(B,N,CMM,Ts)( = 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"; @@ -4286,7 +4297,7 @@ void _block_flag_line_empty_(B,N,CMM,Ts)( 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, @@ -4336,7 +4347,7 @@ void _block_flag_line_empty_(B,N,CMM,Ts)( 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, @@ -4379,7 +4390,7 @@ void _block_flag_line_empty_(B,N,CMM,Ts)( 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, @@ -4432,7 +4443,7 @@ void _block_flag_line_empty_(B,N,CMM,Ts)( 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, @@ -7282,7 +7293,7 @@ struct NodeStructureMetadata { 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_, @@ -7351,7 +7362,7 @@ struct NodeStructureMetadata { 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_, -- cgit v1.2.3