diff options
author | Ralph Amissah <ralph@amissah.com> | 2016-11-18 10:17:40 -0500 |
---|---|---|
committer | Ralph Amissah <ralph@amissah.com> | 2019-04-10 15:14:13 -0400 |
commit | a881c428c12f4948e4ea65b9315a3fabef8c7b4f (patch) | |
tree | 8c6c1cf05126f86fe955a4601cd92fb0a9a399bb /src/sdp/ao_abstract_doc_source.d | |
parent | minor reorganise same (diff) |
munge links & urls for sections: toc, endnotes, book index
Diffstat (limited to 'src/sdp/ao_abstract_doc_source.d')
-rw-r--r-- | src/sdp/ao_abstract_doc_source.d | 58 |
1 files changed, 42 insertions, 16 deletions
diff --git a/src/sdp/ao_abstract_doc_source.d b/src/sdp/ao_abstract_doc_source.d index 851d375..fd4afa7 100644 --- a/src/sdp/ao_abstract_doc_source.d +++ b/src/sdp/ao_abstract_doc_source.d @@ -171,6 +171,8 @@ template SiSUdocAbstraction() { "seg": [toc_head], "scroll": [toc_head], ]; + auto mkup = InlineMarkup(); + auto munge = ObjInlineMarkupMunge(); /+ abstraction init ↑ +/ /+ ↓ loop markup document/text line by line +/ srcDocLoop: @@ -805,6 +807,7 @@ template SiSUdocAbstraction() { "Endnotes", "endnotes", // segment_object_belongs_to ); + toc_txt_= munge.url_links(toc_txt_); the_table_of_contents_section["seg"] ~= set_abstract_object.contents_para( "toc", @@ -821,6 +824,7 @@ template SiSUdocAbstraction() { "Endnotes", "endnotes", // _anchor_tag ); + toc_txt_= munge.url_links(toc_txt_); the_table_of_contents_section["scroll"] ~= set_abstract_object.contents_para( "toc", @@ -837,6 +841,7 @@ template SiSUdocAbstraction() { "Glossary", "glossary", // segment_object_belongs_to ); + toc_txt_= munge.url_links(toc_txt_); the_table_of_contents_section["seg"] ~= set_abstract_object.contents_para( "toc", @@ -851,6 +856,7 @@ template SiSUdocAbstraction() { "Glossary", "glossary", // _anchor_tag ); + toc_txt_= munge.url_links(toc_txt_); the_table_of_contents_section["scroll"] ~= set_abstract_object.contents_para( "toc", @@ -867,6 +873,7 @@ template SiSUdocAbstraction() { "Bibliography", "bibliography", // segment_object_belongs_to ); + toc_txt_= munge.url_links(toc_txt_); the_table_of_contents_section["seg"] ~= set_abstract_object.contents_para( "toc", @@ -881,6 +888,7 @@ template SiSUdocAbstraction() { "Bibliography", "bibliography", // _anchor_tag ); + toc_txt_= munge.url_links(toc_txt_); the_table_of_contents_section["scroll"] ~= set_abstract_object.contents_para( "toc", @@ -897,6 +905,7 @@ template SiSUdocAbstraction() { "Book Index", "bookindex", // segment_object_belongs_to ); + toc_txt_= munge.url_links(toc_txt_); the_table_of_contents_section["seg"] ~= set_abstract_object.contents_para( "toc", @@ -913,6 +922,7 @@ template SiSUdocAbstraction() { "Book Index", "bookindex", // _anchor_tag ); + toc_txt_= munge.url_links(toc_txt_); the_table_of_contents_section["scroll"] ~= set_abstract_object.contents_para( "toc", @@ -929,6 +939,7 @@ template SiSUdocAbstraction() { "Blurb", "blurb", // segment_object_belongs_to ); + toc_txt_= munge.url_links(toc_txt_); the_table_of_contents_section["seg"] ~= set_abstract_object.contents_para( "toc", @@ -943,6 +954,7 @@ template SiSUdocAbstraction() { "Blurb", "blurb", // _anchor_tag ); + toc_txt_= munge.url_links(toc_txt_); the_table_of_contents_section["scroll"] ~= set_abstract_object.contents_para( "toc", @@ -2610,7 +2622,12 @@ template SiSUdocAbstraction() { char[] heading_toc_, ) { auto m = matchFirst(cast(char[]) heading_toc_, rgx.heading); - heading_toc_ = m.post; + heading_toc_ = + replaceAll( + m.post, + rgx.inline_notes_curly_gen, + ("") + ); return heading_toc_; }; auto table_of_contents_gather_headings( @@ -2634,6 +2651,7 @@ template SiSUdocAbstraction() { heading_toc_, _anchor_tag, ); + toc_txt_= munge.url_links(toc_txt_); indent=[ "hang_position" : to!int(obj_["lev_markup_number"]), "base_position" : to!int(obj_["lev_markup_number"]), @@ -2643,6 +2661,7 @@ template SiSUdocAbstraction() { heading_toc_, _anchor_tag, ); + toc_txt_= munge.url_links(toc_txt_); the_table_of_contents_section["scroll"] ~= set_abstract_object.contents_para( "toc", @@ -2673,10 +2692,12 @@ template SiSUdocAbstraction() { "hang_position" : 0, "base_position" : 0, ]; + toc_txt_ = "{ Table of Contents }../toc.fn_suffix"; + toc_txt_= munge.url_links(toc_txt_); the_table_of_contents_section["seg"] ~= set_abstract_object.contents_para( "toc", - "{ Table of Contents }../toc.fn_suffix", + toc_txt_, "", // attrib 0, indent, @@ -2692,6 +2713,7 @@ template SiSUdocAbstraction() { "%s", heading_toc_, ); + toc_txt_= munge.url_links(toc_txt_); the_table_of_contents_section["seg"] ~= set_abstract_object.contents_para( "toc", @@ -2708,6 +2730,7 @@ template SiSUdocAbstraction() { heading_toc_, segment_object_belongs_to, ); + toc_txt_= munge.url_links(toc_txt_); indent=[ "hang_position" : to!int(obj_["lev_markup_number"]), "base_position" : to!int(obj_["lev_markup_number"]), @@ -2729,6 +2752,7 @@ template SiSUdocAbstraction() { segment_object_belongs_to, _anchor_tag, ); + toc_txt_= munge.url_links(toc_txt_); indent=[ "hang_position" : to!int(obj_["lev_markup_number"]), "base_position" : to!int(obj_["lev_markup_number"]), @@ -3230,6 +3254,7 @@ template SiSUdocAbstraction() { struct BookIndexReportSection { int mkn, skn; auto rgx = Rgx(); + auto munge = ObjInlineMarkupMunge(); auto bookindex_write_section( string[][string][string] bookindex_unordered_hashes ) { @@ -3330,10 +3355,10 @@ template SiSUdocAbstraction() { bi_tmp_seg = "!{" ~ mainkey ~ "}! "; foreach (ref_; bookindex_unordered_hashes[mainkey]["_a"]) { auto go = replaceAll(ref_, rgx.book_index_go, "$1"); - bi_tmp_scroll ~= (" {" ~ ref_ ~ "}#" ~ go ~ ", "); + bi_tmp_scroll ~= munge.url_links(" {" ~ ref_ ~ "}#" ~ go ~ ", "); bi_tmp_seg ~= (segment_object_belongs_to.empty) - ? (" {" ~ ref_ ~ "}#" ~ go ~ ", ") - : (" {" ~ ref_ ~ "}../" ~ segment_object_belongs_to ~ ".fn_suffix#" ~ go ~ ", "); + ? munge.url_links(" {" ~ ref_ ~ "}#" ~ go ~ ", ") + : munge.url_links(" {" ~ ref_ ~ "}../" ~ segment_object_belongs_to ~ ".fn_suffix#" ~ go ~ ", "); } bi_tmp_scroll ~= " \\\\\n "; bi_tmp_seg ~= " \\\\\n "; @@ -3345,10 +3370,10 @@ template SiSUdocAbstraction() { bi_tmp_seg ~= subkey ~ ", "; foreach (ref_; bookindex_unordered_hashes[mainkey][subkey]) { auto go = replaceAll(ref_, rgx.book_index_go, "$1"); - bi_tmp_scroll ~= (" {" ~ ref_ ~ "}#" ~ go ~ ", "); + bi_tmp_scroll ~= munge.url_links(" {" ~ ref_ ~ "}#" ~ go ~ ", "); bi_tmp_seg ~= (segment_object_belongs_to.empty) - ? (" {" ~ ref_ ~ "}#" ~ go ~ ", ") - : (" {" ~ ref_ ~ "}../" ~ segment_object_belongs_to ~ ".fn_suffix#" ~ go ~ ", "); + ? munge.url_links(" {" ~ ref_ ~ "}#" ~ go ~ ", ") + : munge.url_links(" {" ~ ref_ ~ "}../" ~ segment_object_belongs_to ~ ".fn_suffix#" ~ go ~ ", "); } bi_tmp_scroll ~= " \\\\\n "; bi_tmp_seg ~= " \\\\\n "; @@ -3433,6 +3458,7 @@ template SiSUdocAbstraction() { ); } body { + auto munge = ObjInlineMarkupMunge(); foreach(m; matchAll(contents_am[counter].object, rgx.inline_notes_delimiter_al_regular_number_note)) { @@ -3443,16 +3469,16 @@ template SiSUdocAbstraction() { } // TODO NEXT you need anchor for segments at this point -> object_notes["seg"] ~= - "{^{" ~ m.captures[1] ~ ".}^}#noteref_" ~ - m.captures[1] ~ " " ~ m.captures[2] ~ "』"; + munge.url_links("{^{" ~ m.captures[1] ~ ".}^}#noteref_" ~ + m.captures[1]) ~ " " ~ m.captures[2] ~ "』"; object_notes["seg"] ~= (segment_object_belongs_to.empty) - ? ("{^{" ~ m.captures[1] ~ ".}^}#noteref_" ~ - m.captures[1] ~ " " ~ m.captures[2] ~ "』") - : ("{^{" ~ m.captures[1] ~ ".}^}../" ~ segment_object_belongs_to ~ ".fn_suffix#noteref_" ~ - m.captures[1] ~ " " ~ m.captures[2] ~ "』"); + ? (munge.url_links("{^{" ~ m.captures[1] ~ ".}^}#noteref_" ~ + m.captures[1]) ~ " " ~ m.captures[2] ~ "』") + : (munge.url_links("{^{" ~ m.captures[1] ~ ".}^}../" ~ segment_object_belongs_to ~ ".fn_suffix#noteref_" ~ + m.captures[1]) ~ " " ~ m.captures[2] ~ "』"); object_notes["scroll"] ~= - "{^{" ~ m.captures[1] ~ ".}^}#noteref_" ~ - m.captures[1] ~ " " ~ m.captures[2] ~ "』"; + munge.url_links("{^{" ~ m.captures[1] ~ ".}^}#noteref_" ~ + m.captures[1]) ~ " " ~ m.captures[2] ~ "』"; } return object_notes; } |