From e6bae1ca42533a1736dfd1a7c8c68a8a80047e09 Mon Sep 17 00:00:00 2001 From: Ralph Amissah Date: Thu, 11 Jul 2019 10:46:08 -0400 Subject: html scroll toc backmatter (url/link) fix --- org/default_regex.org | 1 + org/meta_abstraction.org | 5 +++++ org/output_xmls.org | 3 +++ src/doc_reform/meta/metadoc_from_src.d | 5 +++++ src/doc_reform/meta/rgx.d | 1 + src/doc_reform/output/rgx.d | 1 + src/doc_reform/output/xmls.d | 3 +++ 7 files changed, 19 insertions(+) diff --git a/org/default_regex.org b/org/default_regex.org index 4a87e37..e0ec4d3 100644 --- a/org/default_regex.org +++ b/org/default_regex.org @@ -551,6 +551,7 @@ static inline_link_number_only = ctRegex!(`(┥.+?┝)┤ static inline_link_stow_uri = ctRegex!(`┥(?P.+?)┝┤(?P[^ 0-9#┥┝┤├][^ 0-9┥┝┤├]+)├`, "mg"); // will not stow (stowed links) or object number internal links static inline_link_hash = ctRegex!(`┥(?P.+?)┝┤(?P#(?P\S+?))├`, "mg"); static inline_link_clean = ctRegex!(`┤(?:.+?)├|[┥┝]`, "mg"); +static inline_link_toc_to_backmatter = ctRegex!(`┤#(?Pendnotes|bibliography|bookindex|glossary|blurb)├`, "mg"); static inline_a_url = ctRegex!(`(┤)([^\s┥┝┤├]+)(├)`, "mg"); static url = ctRegex!(`https?://`, "mg"); static uri = ctRegex!(`(?:https?|git)://`, "mg"); diff --git a/org/meta_abstraction.org b/org/meta_abstraction.org index 6ac33b3..9257725 100644 --- a/org/meta_abstraction.org +++ b/org/meta_abstraction.org @@ -797,6 +797,7 @@ if there is a glossary section you need to: comp_obj_heading_.tags.segment_anchor_tag_epub = "_part_glossary"; comp_obj_heading_.tags.anchor_tag_html = comp_obj_heading_.tags.segment_anchor_tag_epub; comp_obj_heading_.tags.in_segment_html = "glossary"; + comp_obj_heading_.tags.anchor_tags = ["section_glossary"]; comp_obj_heading_.metainfo.heading_lev_markup = 1; comp_obj_heading_.metainfo.heading_lev_collapsed = 1; comp_obj_heading_.metainfo.parent_ocn = 1; @@ -939,6 +940,7 @@ if there is a blurb section you need to: comp_obj_heading_.tags.segment_anchor_tag_epub = "_part_blurb"; comp_obj_heading_.tags.anchor_tag_html = comp_obj_heading_.tags.segment_anchor_tag_epub; comp_obj_heading_.tags.in_segment_html = "blurb"; + comp_obj_heading_.tags.anchor_tags = ["section_blurb"]; comp_obj_heading_.metainfo.heading_lev_markup = 1; comp_obj_heading_.metainfo.heading_lev_collapsed = 1; comp_obj_heading_.metainfo.parent_ocn = 1; @@ -1620,6 +1622,7 @@ if (biblio_ordered.length > 0) { comp_obj_heading_.tags.segment_anchor_tag_epub = "_part_bibliography"; comp_obj_heading_.tags.anchor_tag_html = comp_obj_heading_.tags.segment_anchor_tag_epub; comp_obj_heading_.tags.in_segment_html = "bibliography"; + comp_obj_heading_.tags.anchor_tags = ["section_bibliography"]; comp_obj_heading_.metainfo.heading_lev_markup = 1; comp_obj_heading_.metainfo.heading_lev_collapsed = 1; comp_obj_heading_.metainfo.parent_ocn = 1; @@ -6595,6 +6598,7 @@ struct BookIndexReportSection { comp_obj_heading_.tags.segment_anchor_tag_epub = "_part_book_index"; comp_obj_heading_.tags.anchor_tag_html = comp_obj_heading_.tags.segment_anchor_tag_epub; comp_obj_heading_.tags.in_segment_html = "bookindex"; + comp_obj_heading_.tags.anchor_tags = ["section_bookindex"]; comp_obj_heading_.metainfo.heading_lev_markup = 1; comp_obj_heading_.metainfo.heading_lev_collapsed = 1; comp_obj_heading_.metainfo.parent_ocn = 1; @@ -6864,6 +6868,7 @@ struct NotesSection { comp_obj_heading_.tags.segment_anchor_tag_epub = "_part_endnotes"; comp_obj_heading_.tags.anchor_tag_html = comp_obj_heading_.tags.segment_anchor_tag_epub; comp_obj_heading_.tags.in_segment_html = "endnotes"; + comp_obj_heading_.tags.anchor_tags = ["section_endnotes"]; comp_obj_heading_.metainfo.heading_lev_markup = 1; comp_obj_heading_.metainfo.heading_lev_collapsed = 1; comp_obj_heading_.metainfo.parent_ocn = 1; diff --git a/org/output_xmls.org b/org/output_xmls.org index e994647..942897e 100644 --- a/org/output_xmls.org +++ b/org/output_xmls.org @@ -1005,6 +1005,9 @@ string para_scroll(O,M)( M doc_matters, string _suffix = ".html", ) { + if (obj.metainfo.is_a == "toc" && _txt.match(rgx.inline_link_toc_to_backmatter)) { + _txt = _txt.replaceAll(rgx.inline_link_toc_to_backmatter, "┤#section_$1├"); + } _txt = inline_markup_scroll(_txt, obj, doc_matters, _suffix); string o = para(_txt, obj, doc_matters); return o; diff --git a/src/doc_reform/meta/metadoc_from_src.d b/src/doc_reform/meta/metadoc_from_src.d index 1bfd183..944189e 100644 --- a/src/doc_reform/meta/metadoc_from_src.d +++ b/src/doc_reform/meta/metadoc_from_src.d @@ -572,6 +572,7 @@ template DocReformDocAbstraction() { comp_obj_heading_.tags.segment_anchor_tag_epub = "_part_glossary"; comp_obj_heading_.tags.anchor_tag_html = comp_obj_heading_.tags.segment_anchor_tag_epub; comp_obj_heading_.tags.in_segment_html = "glossary"; + comp_obj_heading_.tags.anchor_tags = ["section_glossary"]; comp_obj_heading_.metainfo.heading_lev_markup = 1; comp_obj_heading_.metainfo.heading_lev_collapsed = 1; comp_obj_heading_.metainfo.parent_ocn = 1; @@ -701,6 +702,7 @@ template DocReformDocAbstraction() { comp_obj_heading_.tags.segment_anchor_tag_epub = "_part_blurb"; comp_obj_heading_.tags.anchor_tag_html = comp_obj_heading_.tags.segment_anchor_tag_epub; comp_obj_heading_.tags.in_segment_html = "blurb"; + comp_obj_heading_.tags.anchor_tags = ["section_blurb"]; comp_obj_heading_.metainfo.heading_lev_markup = 1; comp_obj_heading_.metainfo.heading_lev_collapsed = 1; comp_obj_heading_.metainfo.parent_ocn = 1; @@ -1240,6 +1242,7 @@ template DocReformDocAbstraction() { comp_obj_heading_.tags.segment_anchor_tag_epub = "_part_bibliography"; comp_obj_heading_.tags.anchor_tag_html = comp_obj_heading_.tags.segment_anchor_tag_epub; comp_obj_heading_.tags.in_segment_html = "bibliography"; + comp_obj_heading_.tags.anchor_tags = ["section_bibliography"]; comp_obj_heading_.metainfo.heading_lev_markup = 1; comp_obj_heading_.metainfo.heading_lev_collapsed = 1; comp_obj_heading_.metainfo.parent_ocn = 1; @@ -5253,6 +5256,7 @@ template DocReformDocAbstraction() { comp_obj_heading_.tags.segment_anchor_tag_epub = "_part_book_index"; comp_obj_heading_.tags.anchor_tag_html = comp_obj_heading_.tags.segment_anchor_tag_epub; comp_obj_heading_.tags.in_segment_html = "bookindex"; + comp_obj_heading_.tags.anchor_tags = ["section_bookindex"]; comp_obj_heading_.metainfo.heading_lev_markup = 1; comp_obj_heading_.metainfo.heading_lev_collapsed = 1; comp_obj_heading_.metainfo.parent_ocn = 1; @@ -5493,6 +5497,7 @@ template DocReformDocAbstraction() { comp_obj_heading_.tags.segment_anchor_tag_epub = "_part_endnotes"; comp_obj_heading_.tags.anchor_tag_html = comp_obj_heading_.tags.segment_anchor_tag_epub; comp_obj_heading_.tags.in_segment_html = "endnotes"; + comp_obj_heading_.tags.anchor_tags = ["section_endnotes"]; comp_obj_heading_.metainfo.heading_lev_markup = 1; comp_obj_heading_.metainfo.heading_lev_collapsed = 1; comp_obj_heading_.metainfo.parent_ocn = 1; diff --git a/src/doc_reform/meta/rgx.d b/src/doc_reform/meta/rgx.d index ddaf3f9..50665e1 100644 --- a/src/doc_reform/meta/rgx.d +++ b/src/doc_reform/meta/rgx.d @@ -276,6 +276,7 @@ static template DocReformRgxInit() { static inline_link_stow_uri = ctRegex!(`┥(?P.+?)┝┤(?P[^ 0-9#┥┝┤├][^ 0-9┥┝┤├]+)├`, "mg"); // will not stow (stowed links) or object number internal links static inline_link_hash = ctRegex!(`┥(?P.+?)┝┤(?P#(?P\S+?))├`, "mg"); static inline_link_clean = ctRegex!(`┤(?:.+?)├|[┥┝]`, "mg"); + static inline_link_toc_to_backmatter = ctRegex!(`┤#(?Pendnotes|bibliography|bookindex|glossary|blurb)├`, "mg"); static inline_a_url = ctRegex!(`(┤)([^\s┥┝┤├]+)(├)`, "mg"); static url = ctRegex!(`https?://`, "mg"); static uri = ctRegex!(`(?:https?|git)://`, "mg"); diff --git a/src/doc_reform/output/rgx.d b/src/doc_reform/output/rgx.d index 86cd48b..c7896ac 100644 --- a/src/doc_reform/output/rgx.d +++ b/src/doc_reform/output/rgx.d @@ -80,6 +80,7 @@ static template DocReformOutputRgxInit() { static inline_link_stow_uri = ctRegex!(`┥(?P.+?)┝┤(?P[^ 0-9#┥┝┤├][^ 0-9┥┝┤├]+)├`, "mg"); // will not stow (stowed links) or object number internal links static inline_link_hash = ctRegex!(`┥(?P.+?)┝┤(?P#(?P\S+?))├`, "mg"); static inline_link_clean = ctRegex!(`┤(?:.+?)├|[┥┝]`, "mg"); + static inline_link_toc_to_backmatter = ctRegex!(`┤#(?Pendnotes|bibliography|bookindex|glossary|blurb)├`, "mg"); static inline_a_url = ctRegex!(`(┤)([^\s┥┝┤├]+)(├)`, "mg"); static url = ctRegex!(`https?://`, "mg"); static uri = ctRegex!(`(?:https?|git)://`, "mg"); diff --git a/src/doc_reform/output/xmls.d b/src/doc_reform/output/xmls.d index 3bf20cc..164613b 100644 --- a/src/doc_reform/output/xmls.d +++ b/src/doc_reform/output/xmls.d @@ -816,6 +816,9 @@ template outputXHTMLs() { M doc_matters, string _suffix = ".html", ) { + if (obj.metainfo.is_a == "toc" && _txt.match(rgx.inline_link_toc_to_backmatter)) { + _txt = _txt.replaceAll(rgx.inline_link_toc_to_backmatter, "┤#section_$1├"); + } _txt = inline_markup_scroll(_txt, obj, doc_matters, _suffix); string o = para(_txt, obj, doc_matters); return o; -- cgit v1.2.3