From f068030082cd38ec93988c911f4b5511ed64fca3 Mon Sep 17 00:00:00 2001 From: Marcin Aman Date: Wed, 28 Jul 2021 18:24:13 +0200 Subject: Include parenthesis for merged pages (#2039) --- .../base/src/main/kotlin/renderers/html/htmlPreprocessors.kt | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) (limited to 'plugins/base') diff --git a/plugins/base/src/main/kotlin/renderers/html/htmlPreprocessors.kt b/plugins/base/src/main/kotlin/renderers/html/htmlPreprocessors.kt index ff724f02..b6099e21 100644 --- a/plugins/base/src/main/kotlin/renderers/html/htmlPreprocessors.kt +++ b/plugins/base/src/main/kotlin/renderers/html/htmlPreprocessors.kt @@ -16,7 +16,7 @@ import org.jetbrains.dokka.transformers.pages.PageTransformer abstract class NavigationDataProvider { open fun navigableChildren(input: RootPageNode): NavigationNode = input.withDescendants() - .first { it is ModulePage || it is MultimoduleRootPage }.let { visit(it as ContentPage) } + .first { it is ModulePage || it is MultimoduleRootPage }.let { visit(it as ContentPage) } open fun visit(page: ContentPage): NavigationNode = NavigationNode( @@ -35,8 +35,14 @@ abstract class NavigationDataProvider { else -> emptyList() }.sortedBy { it.name.toLowerCase() } + /** + * Parenthesis is applied in 2 cases: + * - page only contains functions (therefore documentable from this page is [DFunction]) + * - page merges only functions (documentable is null because [SameMethodNamePageMergerStrategy][org.jetbrains.dokka.base.transformers.pages.merger.SameMethodNamePageMergerStrategy] + * removes it from page) + */ private val ContentPage.displayableName: String - get() = if (documentable is DFunction) { + get() = if (documentable is DFunction || (documentable == null && dri.all { it.callable != null })) { "$name()" } else { name -- cgit