diff options
author | Ralph Amissah <ralph.amissah@gmail.com> | 2019-05-05 12:25:22 -0400 |
---|---|---|
committer | Ralph Amissah <ralph.amissah@gmail.com> | 2019-05-17 16:59:54 -0400 |
commit | ca57754c411a97cf9b09cd74473099451bcf1248 (patch) | |
tree | ea9f7abb9d519c299754466df225ef9ae8cdac89 | |
parent | meta_abstraction some local renaming (diff) |
url encoding
-rw-r--r-- | org/default_regex.org | 1 | ||||
-rw-r--r-- | org/output_xmls.org | 6 | ||||
-rw-r--r-- | src/doc_reform/meta/rgx.d | 1 | ||||
-rw-r--r-- | src/doc_reform/output/rgx.d | 1 | ||||
-rw-r--r-- | src/doc_reform/output/xmls.d | 6 |
5 files changed, 13 insertions, 2 deletions
diff --git a/org/default_regex.org b/org/default_regex.org index 911832b..25536ff 100644 --- a/org/default_regex.org +++ b/org/default_regex.org @@ -549,6 +549,7 @@ static inline_link_clean = ctRegex!(`┤(?:.+?)├| static inline_a_url = ctRegex!(`(┤)([^\s┥┝┤├]+)(├)`, "mg"); static url = ctRegex!(`https?://`, "mg"); static uri = ctRegex!(`(?:https?|git)://`, "mg"); +static uri_identify_components = ctRegex!(`(?P<type>(?:https?|git)://)(?P<path>\S+?/)(?P<file>[^/]+)$`, "mg"); static inline_link_subtoc = ctRegex!(`^(?P<level>[5-7])~ ┥(?P<text>.+?)┝┤(?P<link>.+?)├`, "mg"); static fn_suffix = ctRegex!(`\.fnSuffix`, "mg"); static inline_link_fn_suffix = ctRegex!(`¤(.+?)(\.fnSuffix)`, "mg"); diff --git a/org/output_xmls.org b/org/output_xmls.org index 33995bd..21f4876 100644 --- a/org/output_xmls.org +++ b/org/output_xmls.org @@ -473,7 +473,11 @@ auto inline_links(O,M)( if (obj.has.inline_links) { if (obj.metainfo.is_a != "code") { _txt = replaceAll!(m => - m[1] ~ "┤" ~ to!string((obj.stow.link[m["num"].to!ulong])).encode ~ "├" + m[1] ~ "┤" + ~ (replaceAll!(n => + n["type"] ~ n["path"] ~ (n["file"].encodeComponent) + )((obj.stow.link[m["num"].to!ulong]).to!string, rgx.uri_identify_components)) + ~ "├" )(_txt, rgx.inline_link_number_only); } if ((_txt.match(rgx.mark_internal_site_lnk)) diff --git a/src/doc_reform/meta/rgx.d b/src/doc_reform/meta/rgx.d index 7490903..ecaa97c 100644 --- a/src/doc_reform/meta/rgx.d +++ b/src/doc_reform/meta/rgx.d @@ -293,6 +293,7 @@ static template DocReformRgxInit() { static inline_a_url = ctRegex!(`(┤)([^\s┥┝┤├]+)(├)`, "mg"); static url = ctRegex!(`https?://`, "mg"); static uri = ctRegex!(`(?:https?|git)://`, "mg"); + static uri_identify_components = ctRegex!(`(?P<type>(?:https?|git)://)(?P<path>\S+?/)(?P<file>[^/]+)$`, "mg"); static inline_link_subtoc = ctRegex!(`^(?P<level>[5-7])~ ┥(?P<text>.+?)┝┤(?P<link>.+?)├`, "mg"); static fn_suffix = ctRegex!(`\.fnSuffix`, "mg"); static inline_link_fn_suffix = ctRegex!(`¤(.+?)(\.fnSuffix)`, "mg"); diff --git a/src/doc_reform/output/rgx.d b/src/doc_reform/output/rgx.d index 7c1247a..c9e9516 100644 --- a/src/doc_reform/output/rgx.d +++ b/src/doc_reform/output/rgx.d @@ -82,6 +82,7 @@ static template DocReformOutputRgxInit() { static inline_a_url = ctRegex!(`(┤)([^\s┥┝┤├]+)(├)`, "mg"); static url = ctRegex!(`https?://`, "mg"); static uri = ctRegex!(`(?:https?|git)://`, "mg"); + static uri_identify_components = ctRegex!(`(?P<type>(?:https?|git)://)(?P<path>\S+?/)(?P<file>[^/]+)$`, "mg"); static inline_link_subtoc = ctRegex!(`^(?P<level>[5-7])~ ┥(?P<text>.+?)┝┤(?P<link>.+?)├`, "mg"); static fn_suffix = ctRegex!(`\.fnSuffix`, "mg"); static inline_link_fn_suffix = ctRegex!(`¤(.+?)(\.fnSuffix)`, "mg"); diff --git a/src/doc_reform/output/xmls.d b/src/doc_reform/output/xmls.d index e494bab..f27b0f4 100644 --- a/src/doc_reform/output/xmls.d +++ b/src/doc_reform/output/xmls.d @@ -356,7 +356,11 @@ template outputXHTMLs() { if (obj.has.inline_links) { if (obj.metainfo.is_a != "code") { _txt = replaceAll!(m => - m[1] ~ "┤" ~ to!string((obj.stow.link[m["num"].to!ulong])).encode ~ "├" + m[1] ~ "┤" + ~ (replaceAll!(n => + n["type"] ~ n["path"] ~ (n["file"].encodeComponent) + )((obj.stow.link[m["num"].to!ulong]).to!string, rgx.uri_identify_components)) + ~ "├" )(_txt, rgx.inline_link_number_only); } if ((_txt.match(rgx.mark_internal_site_lnk)) |