diff options
Diffstat (limited to 'plugins/base/src/main/kotlin/renderers/html/htmlPreprocessors.kt')
-rw-r--r-- | plugins/base/src/main/kotlin/renderers/html/htmlPreprocessors.kt | 19 |
1 files changed, 8 insertions, 11 deletions
diff --git a/plugins/base/src/main/kotlin/renderers/html/htmlPreprocessors.kt b/plugins/base/src/main/kotlin/renderers/html/htmlPreprocessors.kt index 2f7c8ee1..70878bbe 100644 --- a/plugins/base/src/main/kotlin/renderers/html/htmlPreprocessors.kt +++ b/plugins/base/src/main/kotlin/renderers/html/htmlPreprocessors.kt @@ -49,17 +49,14 @@ object NavigationPageInstaller : PageTransformer { page.navigableChildren() ) - private fun ContentPage.navigableChildren(): List<NavigationNode> { - if (this !is ClasslikePageNode) { - return children.filterIsInstance<ContentPage>() - .map { visit(it) } - } else if (documentable is DEnum) { - return children.filter { it is ContentPage && it.documentable is DEnumEntry } - .map { visit(it as ContentPage) } - } - - return emptyList() - } + private fun ContentPage.navigableChildren(): List<NavigationNode> = + when { + this !is ClasslikePageNode -> + children.filterIsInstance<ContentPage>().map { visit(it) } + documentable is DEnum -> + children.filter { it is ContentPage && it.documentable is DEnumEntry }.map { visit(it as ContentPage) } + else -> emptyList() + }.sortedBy { it.name.toLowerCase() } } object ResourceInstaller : PageTransformer { |