This is an automated email from the ASF dual-hosted git repository.

jamesnetherton pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/camel-quarkus.git


The following commit(s) were added to refs/heads/main by this push:
     new fea7adeea3 Fix Camel header documentation
fea7adeea3 is described below

commit fea7adeea382afd3e86d8fcf54c9308139f5ab2c
Author: James Netherton <[email protected]>
AuthorDate: Fri Oct 18 11:28:08 2024 +0100

    Fix Camel header documentation
---
 docs/modules/ROOT/examples/js/camel.js             | 42 ++++++++++++++++++++++
 .../ROOT/partials/component-endpoint-headers.adoc  |  2 +-
 2 files changed, 43 insertions(+), 1 deletion(-)

diff --git a/docs/modules/ROOT/examples/js/camel.js 
b/docs/modules/ROOT/examples/js/camel.js
new file mode 100644
index 0000000000..dbd1cc8f6a
--- /dev/null
+++ b/docs/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.quarkus/${artifactId}-component/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/modules/ROOT/partials/component-endpoint-headers.adoc 
b/docs/modules/ROOT/partials/component-endpoint-headers.adoc
index eeda9e706a..97000c6f2f 100644
--- a/docs/modules/ROOT/partials/component-endpoint-headers.adoc
+++ b/docs/modules/ROOT/partials/component-endpoint-headers.adoc
@@ -1,7 +1,7 @@
 //component headers: START
 
 :tablespec: width="100%",cols="2,5a,^1,2",options="header"
-:cellformats: 'util.boldLink(path[2], "endpoint_header", value.group) + 
"\n\nConstant: " + camel.constantLink("{artifactid}",value.constantName) \
+:cellformats: 'util.boldLink(path[2], "endpoint_header", value.group) + 
"\n\nConstant: " + camel.constantLink("{cq-artifact-id}",value.constantName) \
 |util.description(value) \
 |util.valueAsString(value.defaultValue) \
 |util.javaSimpleName(value.javaType)'

Reply via email to