aboutsummaryrefslogtreecommitdiff
path: root/plugins/base/src/main/kotlin/renderers/pageId.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/pageId.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/pageId.kt')
-rw-r--r--plugins/base/src/main/kotlin/renderers/pageId.kt18
1 files changed, 18 insertions, 0 deletions
diff --git a/plugins/base/src/main/kotlin/renderers/pageId.kt b/plugins/base/src/main/kotlin/renderers/pageId.kt
new file mode 100644
index 00000000..b80121c0
--- /dev/null
+++ b/plugins/base/src/main/kotlin/renderers/pageId.kt
@@ -0,0 +1,18 @@
+package org.jetbrains.dokka.base.renderers
+
+import org.jetbrains.dokka.base.renderers.html.NavigationNode
+import org.jetbrains.dokka.links.DRI
+import org.jetbrains.dokka.model.DisplaySourceSet
+import org.jetbrains.dokka.pages.ContentPage
+
+internal val ContentPage.pageId: String
+ get() = pageId(dri.first(), sourceSets())
+
+internal val NavigationNode.pageId: String
+ get() = pageId(dri, sourceSets)
+
+/**
+ * Page Id is required to have a sourceSet in order to distinguish between different pages that has same DRI but different sourceSet
+ * like main functions that are not expect/actual
+ */
+private fun pageId(dri: DRI, sourceSets: Set<DisplaySourceSet>): String = "$dri/${sourceSets.hashCode()}" \ No newline at end of file