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.git
The following commit(s) were added to refs/heads/main by this push:
new 2322e3ad33a CAMEL-17961: Re-add the JS file for the documentation
2322e3ad33a is described below
commit 2322e3ad33a7a54240ae457e6079d3e41b53ec61
Author: Nicolas Filotto <[email protected]>
AuthorDate: Wed Apr 13 12:40:21 2022 +0200
CAMEL-17961: Re-add the JS file for the documentation
---
docs/components/modules/ROOT/examples/js/camel.js | 42 +++++++++++++++++++++++
docs/gulpfile.js | 2 +-
2 files changed, 43 insertions(+), 1 deletion(-)
diff --git a/docs/components/modules/ROOT/examples/js/camel.js
b/docs/components/modules/ROOT/examples/js/camel.js
new file mode 100644
index 00000000000..82c2c14e2d3
--- /dev/null
+++ b/docs/components/modules/ROOT/examples/js/camel.js
@@ -0,0 +1,42 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+module.exports = {
+ extractConstantDisplayName: (name) => {
+ return name.split('#').pop().split('@').join('.')
+ },
+
+ extractConstantName: (name) => {
+ return name.split('#').pop().split('@').shift()
+ },
+
+ extractHeadersClass: (name) => {
+ return name.split('#').shift()
+ },
+
+ constantLink: (artifactId, name) => {
+ try {
+ return `https://javadoc.io/doc/org.apache.camel/${artifactId}/latest/`
+ + module.exports.extractHeadersClass(name).split('.').join('/') +
'.html#'
+ + module.exports.extractConstantName(name)
+ + '[`' + module.exports.extractConstantDisplayName(name) + '`]'
+ } catch (e) {
+ console.log('error', e)
+ return e.msg()
+ }
+ },
+}
diff --git a/docs/gulpfile.js b/docs/gulpfile.js
index d1a6998c956..c8e2bae0b56 100644
--- a/docs/gulpfile.js
+++ b/docs/gulpfile.js
@@ -423,7 +423,7 @@ const tasks = Array.from(sourcesMap).flatMap(([type,
definition]) => {
if (example) {
allTasks.push(
series(
- named(`clean:example:${type}`, clean, example.destination, ['json']),
+ named(`clean:example:${type}`, clean, example.destination, ['json',
'js']),
named(`symlink:example:${type}`, createExampleSymlinks,
example.source, example.destination)
)
)