diff options
Diffstat (limited to 'plugins/base/src/main/kotlin')
-rw-r--r-- | plugins/base/src/main/kotlin/renderers/html/htmlPreprocessors.kt | 24 | ||||
-rw-r--r-- | plugins/base/src/main/kotlin/transformers/documentables/DocumentableVisibilityFilterTransformer.kt | 2 |
2 files changed, 16 insertions, 10 deletions
diff --git a/plugins/base/src/main/kotlin/renderers/html/htmlPreprocessors.kt b/plugins/base/src/main/kotlin/renderers/html/htmlPreprocessors.kt index 3297d09f..4527baa7 100644 --- a/plugins/base/src/main/kotlin/renderers/html/htmlPreprocessors.kt +++ b/plugins/base/src/main/kotlin/renderers/html/htmlPreprocessors.kt @@ -26,15 +26,21 @@ abstract class NavigationDataProvider { children = page.navigableChildren() ) - private fun ContentPage.navigableChildren(): List<NavigationNode> = - when { - this !is ClasslikePageNode -> - children.filterIsInstance<ContentPage>().map { visit(it) } - documentables.any { it is DEnum } -> - children.filter { it is WithDocumentables && it.documentables.any { it is DEnumEntry } } - .map { visit(it as ContentPage) } - else -> emptyList() - }.sortedBy { it.name.toLowerCase() } + private fun ContentPage.navigableChildren(): List<NavigationNode> { + return if (this !is ClasslikePageNode) { + children + .filterIsInstance<ContentPage>() + .map { visit(it) } + .sortedBy { it.name.toLowerCase() } + } else if (documentables.any { it is DEnum }) { + // no sorting for enum entries, should be the same as in source code + children + .filter { child -> child is WithDocumentables && child.documentables.any { it is DEnumEntry } } + .map { visit(it as ContentPage) } + } else { + emptyList() + } + } /** * Parenthesis is applied in 1 case: diff --git a/plugins/base/src/main/kotlin/transformers/documentables/DocumentableVisibilityFilterTransformer.kt b/plugins/base/src/main/kotlin/transformers/documentables/DocumentableVisibilityFilterTransformer.kt index 4b9da03b..4ca3d861 100644 --- a/plugins/base/src/main/kotlin/transformers/documentables/DocumentableVisibilityFilterTransformer.kt +++ b/plugins/base/src/main/kotlin/transformers/documentables/DocumentableVisibilityFilterTransformer.kt @@ -216,7 +216,7 @@ class DocumentableVisibilityFilterTransformer(val context: DokkaContext) : PreMe } private fun filterEnumEntries(entries: List<DEnumEntry>, filteredPlatforms: Set<DokkaSourceSet>): Pair<Boolean, List<DEnumEntry>> = - entries.foldRight(Pair(false, emptyList())) { entry, acc -> + entries.fold(Pair(false, emptyList())) { acc, entry -> val intersection = filteredPlatforms.intersect(entry.sourceSets) if (intersection.isEmpty()) Pair(true, acc.second) else { |