From 49f6c45c3d60fe0251843cc23ce289ec23b3501b Mon Sep 17 00:00:00 2001 From: Ralph Amissah Date: Tue, 9 Oct 2018 13:10:49 -0400 Subject: internal links --- src/doc_reform/meta/metadoc_from_src.d | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) (limited to 'src/doc_reform/meta/metadoc_from_src.d') diff --git a/src/doc_reform/meta/metadoc_from_src.d b/src/doc_reform/meta/metadoc_from_src.d index 6d04725..aefb5ea 100644 --- a/src/doc_reform/meta/metadoc_from_src.d +++ b/src/doc_reform/meta/metadoc_from_src.d @@ -238,6 +238,17 @@ 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) { + 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; + } /+ ↓ abstract marked up document +/ auto DocReformDocAbstraction(Src,CMM,Opt,Mfst)( Src markup_sourcefile_content, @@ -966,6 +977,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); comp_obj_para = comp_obj_para.init; comp_obj_para.metainfo.is_of_part = "body"; comp_obj_para.metainfo.is_of_section = "body"; @@ -2788,6 +2800,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); comp_obj_block = comp_obj_block.init; comp_obj_block.metainfo.is_of_part = "body"; comp_obj_block.metainfo.is_of_section = "body"; @@ -2848,6 +2861,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); comp_obj_block = comp_obj_block.init; comp_obj_block.metainfo.is_of_part = "body"; comp_obj_block.metainfo.is_of_section = "body"; @@ -2891,6 +2905,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); comp_obj_block = comp_obj_block.init; comp_obj_block.metainfo.is_of_part = "body"; comp_obj_block.metainfo.is_of_section = "body"; @@ -2951,6 +2966,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); comp_obj_block = comp_obj_block.init; comp_obj_block.metainfo.is_of_part = "body"; comp_obj_block.metainfo.is_of_section = "body"; @@ -3316,6 +3332,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); comp_obj_block = comp_obj_block.init; comp_obj_block.metainfo.is_of_part = "body"; comp_obj_block.metainfo.is_of_section = "body"; @@ -3362,6 +3379,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); comp_obj_block = comp_obj_block.init; comp_obj_block.metainfo.is_of_part = "body"; comp_obj_block.metainfo.is_of_section = "body"; @@ -4435,6 +4453,10 @@ template DocReformDocAbstraction() { 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