aboutsummaryrefslogtreecommitdiff
path: root/plugins/base/src/main
diff options
context:
space:
mode:
authorMarcin Aman <marcin.aman@gmail.com>2021-07-28 18:24:13 +0200
committerGitHub <noreply@github.com>2021-07-28 18:24:13 +0200
commitf068030082cd38ec93988c911f4b5511ed64fca3 (patch)
tree87c9b60cdf33372b146a3a2c8ba2caf47c7345ad /plugins/base/src/main
parentb2b542988d1523749ab3a881e3cd4cf502ccdd6d (diff)
downloaddokka-f068030082cd38ec93988c911f4b5511ed64fca3.tar.gz
dokka-f068030082cd38ec93988c911f4b5511ed64fca3.tar.bz2
dokka-f068030082cd38ec93988c911f4b5511ed64fca3.zip
Include parenthesis for merged pages (#2039)
Diffstat (limited to 'plugins/base/src/main')
-rw-r--r--plugins/base/src/main/kotlin/renderers/html/htmlPreprocessors.kt10
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