diff options
author | Marcin Aman <marcin.aman@gmail.com> | 2021-07-28 18:24:13 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-07-28 18:24:13 +0200 |
commit | f068030082cd38ec93988c911f4b5511ed64fca3 (patch) | |
tree | 87c9b60cdf33372b146a3a2c8ba2caf47c7345ad | |
parent | b2b542988d1523749ab3a881e3cd4cf502ccdd6d (diff) | |
download | dokka-f068030082cd38ec93988c911f4b5511ed64fca3.tar.gz dokka-f068030082cd38ec93988c911f4b5511ed64fca3.tar.bz2 dokka-f068030082cd38ec93988c911f4b5511ed64fca3.zip |
Include parenthesis for merged pages (#2039)
-rw-r--r-- | plugins/base/src/main/kotlin/renderers/html/htmlPreprocessors.kt | 10 |
1 files changed, 8 insertions, 2 deletions
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 |