You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@camel.apache.org by dj...@apache.org on 2021/11/13 03:34:12 UTC
[camel-website] 06/08: temporary workaround for escaping special characters in attribute values
This is an automated email from the ASF dual-hosted git repository.
djencks pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/camel-website.git
commit ce424f36c0199966242e136ca28c27808aa93347
Author: David Jencks <dj...@apache.org>
AuthorDate: Wed Nov 10 15:38:06 2021 -0800
temporary workaround for escaping special characters in attribute values
---
util/jsonpath-util.js | 12 ++++++++++++
1 file changed, 12 insertions(+)
diff --git a/util/jsonpath-util.js b/util/jsonpath-util.js
index bb5f38e..5cce308 100644
--- a/util/jsonpath-util.js
+++ b/util/jsonpath-util.js
@@ -17,6 +17,14 @@
const RESOURCEID_RX = /[^$]*\$json\/(.*)\.json/
+const SPECIAL_CHARS = /[<>&]/g
+
+const REPLACEMENTS = {
+ '<': '<',
+ '>': '>',
+ '&': '&',
+}
+
module.exports = {
alias: (name, aliases) => {
for (expr of (aliases || '').split(',')) {
@@ -82,6 +90,10 @@ module.exports = {
return 'Both producer and consumer are supported'
},
+ //Presumably temporary until asciidoctor-jsonpath can do this
+ //used from camel-kafka-connector template.
+ scSubs: (string) => string.replace(SPECIAL_CHARS, (m) => REPLACEMENTS[m]),
+
starterArtifactId: (data) => {
return data['starter-artifactid'] ? data['starter-artifactid'] : `${data.artifactid}-starter`
},