From 0069d8328ca84e5ef3d245eada82826c7150e6b4 Mon Sep 17 00:00:00 2001 From: Marcin Aman Date: Wed, 22 Jul 2020 19:06:59 +0200 Subject: Filter navigation pane --- .../main/kotlin/renderers/html/htmlPreprocessors.kt | 19 ++++++++----------- 1 file changed, 8 insertions(+), 11 deletions(-) (limited to 'plugins/base/src/main/kotlin') 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 { - if (this !is ClasslikePageNode) { - return children.filterIsInstance() - .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 = + when { + this !is ClasslikePageNode -> + children.filterIsInstance().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 { -- cgit