You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@camel.apache.org by zr...@apache.org on 2020/12/09 17:39:58 UTC
[camel-website] branch master updated: CAMEL-15929: sort
documentation components
This is an automated email from the ASF dual-hosted git repository.
zregvart pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/camel-website.git
The following commit(s) were added to refs/heads/master by this push:
new 8999e8f CAMEL-15929: sort documentation components
8999e8f is described below
commit 8999e8f69b90799ae09e86f430f41092f3f19663
Author: Zoran Regvart <zr...@apache.org>
AuthorDate: Wed Dec 9 18:15:43 2020 +0100
CAMEL-15929: sort documentation components
We want the manual first, components next, and the rest of the
sub-projects after them sorted alphabetically.
---
antora-ui-camel/src/helpers/order_components.js | 25 +++++++++++++++++++++++++
antora-ui-camel/src/partials/nav-explore.hbs | 2 +-
2 files changed, 26 insertions(+), 1 deletion(-)
diff --git a/antora-ui-camel/src/helpers/order_components.js b/antora-ui-camel/src/helpers/order_components.js
new file mode 100644
index 0000000..581c7cb
--- /dev/null
+++ b/antora-ui-camel/src/helpers/order_components.js
@@ -0,0 +1,25 @@
+'use strict'
+
+module.exports = (components) => Object.entries(components).sort((a, b) => {
+ const nameA = a[0]
+ const nameB = b[0]
+
+ if (nameA === 'manual') {
+ return -1
+ }
+ if (nameB === 'manual') {
+ return 1
+ }
+
+ if (nameA === 'components') {
+ return -1
+ }
+ if (nameB === 'components') {
+ return 1
+ }
+
+ return nameA.localeCompare(nameB)
+}).reduce((obj, [k, v]) => {
+ obj[k] = v
+ return obj
+}, {})
diff --git a/antora-ui-camel/src/partials/nav-explore.hbs b/antora-ui-camel/src/partials/nav-explore.hbs
index 8bab9dd..2df24f3 100644
--- a/antora-ui-camel/src/partials/nav-explore.hbs
+++ b/antora-ui-camel/src/partials/nav-explore.hbs
@@ -6,7 +6,7 @@
</div>
{{/if}}
<ul class="components">
- {{#each site.components}}
+ {{#each (order_components site.components)}}
<li class="component{{#if (eq this @root.page.component)}} is-current{{/if}}">
<span class="title">{{{./title}}}</span>
<ul class="versions">