This is an automated email from the ASF dual-hosted git repository.
zregvart pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/camel-website.git
The following commit(s) were added to refs/heads/main by this push:
new 51e5aa9 feat: escapeAutoLinks utility
51e5aa9 is described below
commit 51e5aa9d21cfa287c7280d91e956bf82dc8be303
Author: Zoran Regvart <[email protected]>
AuthorDate: Mon Mar 21 20:04:15 2022 +0100
feat: escapeAutoLinks utility
We need this to escape any text that might automatically be converted to
links and generate broken links.
See https://docs.asciidoctor.org/asciidoc/latest/macros/autolinks/
---
util/jsonpath-util.js | 7 +++++++
1 file changed, 7 insertions(+)
diff --git a/util/jsonpath-util.js b/util/jsonpath-util.js
index 60b4621..901730e 100644
--- a/util/jsonpath-util.js
+++ b/util/jsonpath-util.js
@@ -61,6 +61,13 @@ module.exports = {
return text ? text.split('{').join('\\{') : text
},
+ escapeAutoLinks: (text) => {
+ return text ? text
+ .replaceAll(/ (http|https|ftp|irc|mailto|file):\/\//g, ' \\$1://')
+ .replaceAll(/ (\b[\w\.\/\-\+]+@[\w\.\/\-]+\b)/g, ' \\$1')
+ : text
+ },
+
extractSBName: (resourceid) => {
const m =resourceid.match(RESOURCEID_RX)
return m ? m[1] : 'no match'