diff options
Diffstat (limited to 'plugins/base')
-rw-r--r-- | plugins/base/src/main/kotlin/renderers/pageId.kt | 11 | ||||
-rw-r--r-- | plugins/base/src/main/kotlin/resolvers/local/DokkaBaseLocationProvider.kt | 3 |
2 files changed, 12 insertions, 2 deletions
diff --git a/plugins/base/src/main/kotlin/renderers/pageId.kt b/plugins/base/src/main/kotlin/renderers/pageId.kt index b80121c0..d3a9ed7a 100644 --- a/plugins/base/src/main/kotlin/renderers/pageId.kt +++ b/plugins/base/src/main/kotlin/renderers/pageId.kt @@ -11,8 +11,17 @@ internal val ContentPage.pageId: String internal val NavigationNode.pageId: String get() = pageId(dri, sourceSets) +@JvmName("shortenSourceSetsToUrl") +internal fun Set<DisplaySourceSet>.shortenToUrl() = + sortedBy { it.sourceSetIDs.merged.let { it.scopeId + it.sourceSetName } }.joinToString().hashCode() + +internal fun DRI.shortenToUrl() = toString() + +@JvmName("shortenDrisToUrl") +internal fun Set<DRI>.shortenToUrl() = sortedBy { it.toString() }.joinToString().hashCode() + /** * 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 +private fun pageId(dri: DRI, sourceSets: Set<DisplaySourceSet>): String = "${dri.shortenToUrl()}/${sourceSets.shortenToUrl()}"
\ No newline at end of file diff --git a/plugins/base/src/main/kotlin/resolvers/local/DokkaBaseLocationProvider.kt b/plugins/base/src/main/kotlin/resolvers/local/DokkaBaseLocationProvider.kt index fa133045..41a9a7e2 100644 --- a/plugins/base/src/main/kotlin/resolvers/local/DokkaBaseLocationProvider.kt +++ b/plugins/base/src/main/kotlin/resolvers/local/DokkaBaseLocationProvider.kt @@ -1,5 +1,6 @@ package org.jetbrains.dokka.base.resolvers.local +import org.jetbrains.dokka.base.renderers.shortenToUrl import org.jetbrains.dokka.model.DisplaySourceSet import org.jetbrains.dokka.pages.DCI import org.jetbrains.dokka.pages.RootPageNode @@ -17,6 +18,6 @@ abstract class DokkaBaseLocationProvider( * 2040 characters limit */ open fun anchorForDCI(dci: DCI, sourceSets: Set<DisplaySourceSet>): String = - (dci.dri.toString() + "/" + dci.kind + "/" + sourceSets.hashCode()).urlEncoded() + (dci.dri.shortenToUrl().toString() + "/" + dci.kind + "/" + sourceSets.shortenToUrl()).urlEncoded() } |