From 099d54647f0ff4bf7effb7c554e987eeff11fb85 Mon Sep 17 00:00:00 2001 From: Ralph Amissah Date: Sat, 14 Jan 2017 10:08:53 -0500 Subject: identify internal links for downstream munging --- src/sdp/ao_abstract_doc_source.d | 41 ++++++++++++++++++++++++++-------------- 1 file changed, 27 insertions(+), 14 deletions(-) (limited to 'src/sdp/ao_abstract_doc_source.d') diff --git a/src/sdp/ao_abstract_doc_source.d b/src/sdp/ao_abstract_doc_source.d index ec1536e..e813260 100644 --- a/src/sdp/ao_abstract_doc_source.d +++ b/src/sdp/ao_abstract_doc_source.d @@ -42,7 +42,7 @@ template SiSUdocAbstraction() { h_text_5, // extra level, drop content_non_header } // header section A-D; header text 1-4 - enum DocStructCollapsedHeading { lv0, lv1, lv2, lv3, lv4, lv5, lv6, lv7 } // not yet used + enum DocStructCollapsedHeading { lv0, lv1, lv2, lv3, lv4, lv5, lv6, lv7 } /+ biblio variables +/ string biblio_tag_name, biblio_tag_entry, st; string[] biblio_arr_json; @@ -77,7 +77,7 @@ template SiSUdocAbstraction() { switch (obj.heading_lev_markup) { case 0: lv_ancestors[0] = to!string(obj.text); - foreach(k; 1..8) { // 1 .. 7 ? + foreach(k; 1..8) { lv_ancestors[k] = ""; } goto default; @@ -1030,8 +1030,9 @@ template SiSUdocAbstraction() { comp_obj_toc.bullet = false; if (the_endnotes_section.length > 1) { toc_txt_ = format( - "{ %s }../%s.fnSuffix", + "{ %s }%s../%s.fnSuffix", "Endnotes", + mkup.mark_internal_site_lnk, "endnotes", // segment_anchor_tag_that_object_belongs_to ); toc_txt_= munge.url_links(toc_txt_); @@ -1040,8 +1041,9 @@ template SiSUdocAbstraction() { } if (the_glossary_section.length > 1) { toc_txt_ = format( - "{ %s }../%s.fnSuffixs", + "{ %s }%s../%s.fnSuffixs", "Glossary", + mkup.mark_internal_site_lnk, "glossary", // segment_anchor_tag_that_object_belongs_to ); toc_txt_= munge.url_links(toc_txt_); @@ -1058,8 +1060,9 @@ template SiSUdocAbstraction() { } if (the_bibliography_section.length > 1){ toc_txt_ = format( - "{ %s }../%s.fnSuffix", + "{ %s }%s../%s.fnSuffix", "Bibliography", + mkup.mark_internal_site_lnk, "bibliography", // segment_anchor_tag_that_object_belongs_to ); toc_txt_= munge.url_links(toc_txt_); @@ -1077,8 +1080,9 @@ template SiSUdocAbstraction() { } if (the_bookindex_section["seg"].length > 1) { toc_txt_ = format( - "{ %s }../%s.fnSuffix", + "{ %s }%s../%s.fnSuffix", "Book Index", + mkup.mark_internal_site_lnk, "bookindex", // segment_anchor_tag_that_object_belongs_to ); toc_txt_= munge.url_links(toc_txt_); @@ -1097,8 +1101,9 @@ template SiSUdocAbstraction() { } if (the_blurb_section.length > 1) { toc_txt_ = format( - "{ %s }../%s.fnSuffix", + "{ %s }%s../%s.fnSuffix", "Blurb", + mkup.mark_internal_site_lnk, "blurb", // segment_anchor_tag_that_object_belongs_to ); toc_txt_= munge.url_links(toc_txt_); @@ -3135,6 +3140,8 @@ template SiSUdocAbstraction() { in { } body { ObjGenericComposite comp_obj_toc; + mixin InternalMarkup; + auto mkup = InlineMarkup(); char[] heading_toc_ = to!(char[])(obj_["body_nugget"].dup.strip); heading_toc_ = _clean_heading_toc_(heading_toc_); auto attrib=""; @@ -3192,7 +3199,7 @@ template SiSUdocAbstraction() { "hang_position" : 0, "base_position" : 0, ]; - toc_txt_ = "{ Table of Contents }../toc.fnSuffix"; + toc_txt_ = "{ Table of Contents }" ~ mkup.mark_internal_site_lnk ~ "../toc.fnSuffix"; toc_txt_= munge.url_links(toc_txt_); comp_obj_toc.indent_hang = indent["hang_position"]; comp_obj_toc.indent_base = indent["base_position"]; @@ -3216,8 +3223,9 @@ template SiSUdocAbstraction() { break; case 4: toc_txt_ = format( - "{ %s }../%s.fnSuffix", + "{ %s }%s../%s.fnSuffix", heading_toc_, + mkup.mark_internal_site_lnk, segment_anchor_tag_that_object_belongs_to, ); lev4_subtoc[segment_anchor_tag_that_object_belongs_to] = []; @@ -3233,8 +3241,9 @@ template SiSUdocAbstraction() { break; case 5: .. case 7: toc_txt_ = format( - "{ %s }../%s.fnSuffix#%s", + "{ %s }%s../%s.fnSuffix#%s", heading_toc_, + mkup.mark_internal_site_lnk, segment_anchor_tag_that_object_belongs_to, _anchor_tag, ); @@ -3789,6 +3798,8 @@ template SiSUdocAbstraction() { bool[string] opt_action_bool, ) { mixin SiSUnode; + mixin InternalMarkup; + auto mkup = InlineMarkup(); string type_is; string lev; int heading_lev_markup, heading_lev_collapsed; @@ -3852,7 +3863,7 @@ template SiSUdocAbstraction() { bi_tmp_scroll ~= munge.url_links(" {" ~ ref_ ~ "}#" ~ go ~ ", "); bi_tmp_seg ~= (segment_anchor_tag_that_object_belongs_to.empty) ? munge.url_links(" {" ~ ref_ ~ "}#" ~ go ~ ", ") - : munge.url_links(" {" ~ ref_ ~ "}../" ~ segment_anchor_tag_that_object_belongs_to ~ ".fnSuffix#" ~ go ~ ", "); + : munge.url_links(" {" ~ ref_ ~ "}" ~ mkup.mark_internal_site_lnk ~ "../" ~ segment_anchor_tag_that_object_belongs_to ~ ".fnSuffix#" ~ go ~ ", "); } bi_tmp_scroll ~= " \\\\\n "; bi_tmp_seg ~= " \\\\\n "; @@ -3869,7 +3880,7 @@ template SiSUdocAbstraction() { bi_tmp_scroll ~= munge.url_links(" {" ~ ref_ ~ "}#" ~ go ~ ", "); bi_tmp_seg ~= (segment_anchor_tag_that_object_belongs_to.empty) ? munge.url_links(" {" ~ ref_ ~ "}#" ~ go ~ ", ") - : munge.url_links(" {" ~ ref_ ~ "}../" ~ segment_anchor_tag_that_object_belongs_to ~ ".fnSuffix#" ~ go ~ ", "); + : munge.url_links(" {" ~ ref_ ~ "}" ~ mkup.mark_internal_site_lnk ~ "../" ~ segment_anchor_tag_that_object_belongs_to ~ ".fnSuffix#" ~ go ~ ", "); } bi_tmp_scroll ~= " \\\\\n "; bi_tmp_seg ~= " \\\\\n "; @@ -3937,6 +3948,8 @@ template SiSUdocAbstraction() { ); } body { + mixin InternalMarkup; + auto mkup = InlineMarkup(); auto munge = ObjInlineMarkupMunge(); foreach( m; @@ -3947,7 +3960,7 @@ template SiSUdocAbstraction() { ) { debug(endnotes_build) { writeln( - "{^{", m.captures[1], ".}^}../", segment_anchor_tag_that_object_belongs_to, ".fnSuffix#noteref_\n ", m.captures[1], " ", + "{^{", m.captures[1], ".}^}" ~ mkup.mark_internal_site_lnk ~ "../", segment_anchor_tag_that_object_belongs_to, ".fnSuffix#noteref_\n ", m.captures[1], " ", m.captures[2]); // sometimes need segment name (segmented html & epub) } // TODO NEXT you need anchor for segments at this point -> @@ -3958,7 +3971,7 @@ template SiSUdocAbstraction() { m.captures[1]) ~ " " ~ m.captures[2] ~ "』" ) : (munge.url_links( - "{^{" ~ m.captures[1] ~ ".}^}../" ~ + "{^{" ~ m.captures[1] ~ ".}^}" ~ mkup.mark_internal_site_lnk ~ "../" ~ segment_anchor_tag_that_object_belongs_to ~ ".fnSuffix#noteref_" ~ m.captures[1]) ~ " " ~ m.captures[2] ~ "』" ); -- cgit v1.2.3