aboutsummaryrefslogtreecommitdiff
path: root/plugins/base/src/main/kotlin/renderers/html/htmlPreprocessors.kt
diff options
context:
space:
mode:
authorMarcin Aman <maman@virtuslab.com>2020-07-22 19:06:59 +0200
committerSebastian Sellmair <34319766+sellmair@users.noreply.github.com>2020-07-23 14:50:54 +0200
commit0069d8328ca84e5ef3d245eada82826c7150e6b4 (patch)
tree9d7bf3b967a3372d4d3dc7636d071c0ad91b9c57 /plugins/base/src/main/kotlin/renderers/html/htmlPreprocessors.kt
parentc0c9c2f7c95716ae16a6274d1106a673ac4bf7d9 (diff)
downloaddokka-0069d8328ca84e5ef3d245eada82826c7150e6b4.tar.gz
dokka-0069d8328ca84e5ef3d245eada82826c7150e6b4.tar.bz2
dokka-0069d8328ca84e5ef3d245eada82826c7150e6b4.zip
Filter navigation pane
Diffstat (limited to 'plugins/base/src/main/kotlin/renderers/html/htmlPreprocessors.kt')
-rw-r--r--plugins/base/src/main/kotlin/renderers/html/htmlPreprocessors.kt19
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 {