aboutsummaryrefslogtreecommitdiff
path: root/plugins/base/src/main/kotlin/renderers/html/htmlPreprocessors.kt
diff options
context:
space:
mode:
authorMarcin Aman <marcin.aman@gmail.com>2020-10-13 09:42:40 +0200
committerKamil Doległo <9080183+kamildoleglo@users.noreply.github.com>2020-10-15 03:05:14 +0200
commitcb5dbf7fd35d023d29cc00fefb0182bada323b7c (patch)
tree51c58549dc1988ccc96e8395698266a5aaed26bc /plugins/base/src/main/kotlin/renderers/html/htmlPreprocessors.kt
parent16fb8510dba9943dd062d42c12ea44525cc5ea9f (diff)
downloaddokka-cb5dbf7fd35d023d29cc00fefb0182bada323b7c.tar.gz
dokka-cb5dbf7fd35d023d29cc00fefb0182bada323b7c.tar.bz2
dokka-cb5dbf7fd35d023d29cc00fefb0182bada323b7c.zip
Distinguish types from functions on navigation
Diffstat (limited to 'plugins/base/src/main/kotlin/renderers/html/htmlPreprocessors.kt')
-rw-r--r--plugins/base/src/main/kotlin/renderers/html/htmlPreprocessors.kt10
1 files changed, 9 insertions, 1 deletions
diff --git a/plugins/base/src/main/kotlin/renderers/html/htmlPreprocessors.kt b/plugins/base/src/main/kotlin/renderers/html/htmlPreprocessors.kt
index a87254ce..43c26dc5 100644
--- a/plugins/base/src/main/kotlin/renderers/html/htmlPreprocessors.kt
+++ b/plugins/base/src/main/kotlin/renderers/html/htmlPreprocessors.kt
@@ -14,6 +14,7 @@ import org.jetbrains.dokka.base.renderers.sourceSets
import org.jetbrains.dokka.links.DRI
import org.jetbrains.dokka.model.DEnum
import org.jetbrains.dokka.model.DEnumEntry
+import org.jetbrains.dokka.model.DFunction
import org.jetbrains.dokka.model.withDescendants
import org.jetbrains.dokka.pages.*
import org.jetbrains.dokka.plugability.DokkaContext
@@ -55,7 +56,7 @@ object NavigationPageInstaller : PageTransformer {
private fun visit(page: ContentPage): NavigationNode =
NavigationNode(
- name = page.name,
+ name = page.displayableName,
dri = page.dri.first(),
sourceSets = page.sourceSets(),
children = page.navigableChildren()
@@ -69,6 +70,13 @@ object NavigationPageInstaller : PageTransformer {
children.filter { it is ContentPage && it.documentable is DEnumEntry }.map { visit(it as ContentPage) }
else -> emptyList()
}.sortedBy { it.name.toLowerCase() }
+
+ private val ContentPage.displayableName: String
+ get() = if(documentable is DFunction){
+ "$name()"
+ } else {
+ name
+ }
}
class CustomResourceInstaller(val dokkaContext: DokkaContext) : PageTransformer {