diff options
author | Marcin Aman <marcin.aman@gmail.com> | 2020-12-16 10:25:34 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-12-16 10:25:34 +0100 |
commit | 7b3bc6f97ee46981bd88852a50ee4a351bd4879d (patch) | |
tree | c5b8e939b790da6e351a01dd290b0ab2f5b00837 /plugins/javadoc/src/main/kotlin/org/jetbrains | |
parent | 4f231b3666568e1f2a5a3241e87c2cbc26af6127 (diff) | |
download | dokka-7b3bc6f97ee46981bd88852a50ee4a351bd4879d.tar.gz dokka-7b3bc6f97ee46981bd88852a50ee4a351bd4879d.tar.bz2 dokka-7b3bc6f97ee46981bd88852a50ee4a351bd4879d.zip |
Resolve an issue with cross package linking in javadoc (#1659)
Diffstat (limited to 'plugins/javadoc/src/main/kotlin/org/jetbrains')
-rw-r--r-- | plugins/javadoc/src/main/kotlin/org/jetbrains/dokka/javadoc/location/JavadocLocationProvider.kt | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/plugins/javadoc/src/main/kotlin/org/jetbrains/dokka/javadoc/location/JavadocLocationProvider.kt b/plugins/javadoc/src/main/kotlin/org/jetbrains/dokka/javadoc/location/JavadocLocationProvider.kt index 440bfc2f..11d8420a 100644 --- a/plugins/javadoc/src/main/kotlin/org/jetbrains/dokka/javadoc/location/JavadocLocationProvider.kt +++ b/plugins/javadoc/src/main/kotlin/org/jetbrains/dokka/javadoc/location/JavadocLocationProvider.kt @@ -63,9 +63,9 @@ class JavadocLocationProvider(pageRoot: RootPageNode, dokkaContext: DokkaContext private operator fun IdentityHashMap<PageNode, List<String>>.get(dri: DRI) = this[nodeIndex[dri]] private fun List<String>.relativeTo(context: List<String>): String { - val contextPath = context.dropLast(1) - val commonPathElements = zip(contextPath).takeWhile { (a, b) -> a == b }.count() - return (List(contextPath.size - commonPathElements) { ".." } + this.drop(commonPathElements)).joinToString("/") + val contextPath = context.dropLast(1).flatMap { it.split("/") } + val commonPathElements = flatMap { it.split("/") }.zip(contextPath).takeWhile { (a, b) -> a == b }.count() + return (List(contextPath.size - commonPathElements) { ".." } + this.flatMap { it.split("/") }.drop(commonPathElements)).joinToString("/") } private fun JavadocClasslikePageNode.findAnchorableByDRI(dri: DRI): AnchorableJavadocNode? = |