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/10/14 03:17:39 UTC
[camel-website] 01/04: improve util/jsonpath-util.js
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 004d6fa5f78be1047ee506374e329713a0191ec0
Author: David Jencks <dj...@apache.org>
AuthorDate: Thu Oct 7 23:42:37 2021 -0700
improve util/jsonpath-util.js
---
util/jsonpath-util.js | 38 +++++++++++++++++++++++++++++++-------
1 file changed, 31 insertions(+), 7 deletions(-)
diff --git a/util/jsonpath-util.js b/util/jsonpath-util.js
index d28ef02..c428408 100644
--- a/util/jsonpath-util.js
+++ b/util/jsonpath-util.js
@@ -10,14 +10,34 @@ module.exports = {
return ''
},
+ boldLink: (text, idPrefix, suffix = '') => {
+ const idText = `_${idPrefix}_${text.split('.').join('_')}`
+ text = suffix ? `*${text}* (${suffix})` : `*${text}*`
+ return `[#${idText}]\nxref:#${idText}['',role=anchor]${text}`
+ },
+
description: (value) => {
try {
- return module.exports.strong(value, "Autowired")
- + module.exports.strong(value, "Required")
- + module.exports.strong(value, "Deprecated")
- + module.exports.escapeAttributes(value.description) + (value.description.endsWith(".") ? "" : ".")
- + (value.deprecatedNote ? `\n\nNOTE: ${value.deprecatedNote}` : "")
- + (value.enum ? `${["\n\nEnum values:\n"].concat(value.enum).join("\n* ")}` : "")
+ return module.exports.strong(value, 'Autowired')
+ + module.exports.strong(value, 'Required')
+ + module.exports.strong(value, 'Deprecated')
+ + (value.description ? module.exports.escapeAttributes(value.description) + (value.description.endsWith('.') ? '' : '.') : '')
+ + (value.deprecatedNote ? `\n\nNOTE: ${value.deprecatedNote}` : '')
+ + (value.enum ? `${['\n\nEnum values:\n'].concat(value.enum).join('\n* ')}` : '')
+ } catch (e) {
+ console.log('error', e)
+ return e.msg()
+ }
+ },
+
+ description2: (value) => {
+ try {
+ return module.exports.strong(value, 'Autowired')
+ + module.exports.strong(value, 'Required')
+ + module.exports.strong(value, 'Deprecated')
+ + (value.description ? module.exports.escapeAttributes(value.description) + (value.description.endsWith('.') ? '' : '') : '')
+ + (value.deprecatedNote ? `\n\nNOTE: ${value.deprecatedNote}` : '')
+ + (value.enum ? `${['\n\nEnum values:\n'].concat(value.enum).join('\n* ')}` : '')
} catch (e) {
console.log('error', e)
return e.msg()
@@ -25,7 +45,7 @@ module.exports = {
},
escapeAttributes: (text) => {
- return text.split('{').join('\\{')
+ return text ? text.split('{').join('\\{') : text
},
formatSignature: (signature) => {
@@ -55,6 +75,10 @@ module.exports = {
strong: (data, text) => {
return data[text.toLowerCase()] ? `*${text}* ` : ''
},
+
+ valueAsString: (value) => {
+ return value === undefined ? '' : `${value}`
+ },
}
function splitOnce (querySpec, token = '=') {