From 49f6c45c3d60fe0251843cc23ce289ec23b3501b Mon Sep 17 00:00:00 2001 From: Ralph Amissah Date: Tue, 9 Oct 2018 13:10:49 -0400 Subject: internal links --- org/meta_abstraction.org | 29 +++++++++++++++++++++++++++++ 1 file changed, 29 insertions(+) (limited to 'org/meta_abstraction.org') diff --git a/org/meta_abstraction.org b/org/meta_abstraction.org index 2a447bc..1b98b2e 100644 --- a/org/meta_abstraction.org +++ b/org/meta_abstraction.org @@ -34,6 +34,7 @@ template DocReformDocAbstraction() { <> /+ ↓ abstraction struct init +/ <> + <> /+ ↓ abstract marked up document +/ auto DocReformDocAbstraction(Src,CMM,Opt,Mfst)( Src markup_sourcefile_content, @@ -418,6 +419,23 @@ auto node_construct = NodeStructureMetadata(); enum sObj { content, anchor_tag, notes_reg, notes_star, links, image_no_dimensions } #+END_SRC +*** inline para tag associations + +#+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) { + 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 + } else { + writeln("a tag named already exists, check text line\n ", an_object["substantive"]); + } + } + return tag_assoc; +} +#+END_SRC + *** scope #+name: abs_init_rest @@ -1294,6 +1312,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); comp_obj_para = comp_obj_para.init; comp_obj_para.metainfo.is_of_part = "body"; comp_obj_para.metainfo.is_of_section = "body"; @@ -3782,6 +3801,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); comp_obj_block = comp_obj_block.init; comp_obj_block.metainfo.is_of_part = "body"; comp_obj_block.metainfo.is_of_section = "body"; @@ -3842,6 +3862,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); comp_obj_block = comp_obj_block.init; comp_obj_block.metainfo.is_of_part = "body"; comp_obj_block.metainfo.is_of_section = "body"; @@ -3885,6 +3906,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); comp_obj_block = comp_obj_block.init; comp_obj_block.metainfo.is_of_part = "body"; comp_obj_block.metainfo.is_of_section = "body"; @@ -3945,6 +3967,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); comp_obj_block = comp_obj_block.init; comp_obj_block.metainfo.is_of_part = "body"; comp_obj_block.metainfo.is_of_section = "body"; @@ -4167,6 +4190,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); comp_obj_block = comp_obj_block.init; comp_obj_block.metainfo.is_of_part = "body"; comp_obj_block.metainfo.is_of_section = "body"; @@ -4219,6 +4243,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); comp_obj_block = comp_obj_block.init; comp_obj_block.metainfo.is_of_part = "body"; comp_obj_block.metainfo.is_of_section = "body"; @@ -5433,6 +5458,10 @@ static struct ObjInlineMarkupMunge { urls = true; obj_txt_in = url_links(obj_txt_in); } + if (auto m = obj_txt_in.match(rgx.para_inline_link_anchor)) { + obj_txt_in = (obj_txt_in) + .replaceAll(rgx.para_inline_link_anchor, "┋$1┋"); + } auto ftn = footnotes_endnotes_markup_and_number_or_stars(obj_txt_in, reset_note_numbers); obj_txt_out = ftn[0]; debug(footnotes) { -- cgit v1.2.3