aboutsummaryrefslogtreecommitdiff
path: root/plugins/javadoc/src
diff options
context:
space:
mode:
authorAndrzej Ratajczak <andrzej.ratajczak98@gmail.com>2020-08-19 15:23:53 +0200
committerPaweł Marks <Kordyjan@users.noreply.github.com>2020-08-20 15:36:07 +0200
commitfab2d4ba4f13454ab36ea7ee333579bf3441f2ed (patch)
treeb5ca2c962c8524e8708f63c4ad1eade282c6ac3a /plugins/javadoc/src
parent45bec5b68c2da35860877c6298bff04a4cb3d1d6 (diff)
downloaddokka-fab2d4ba4f13454ab36ea7ee333579bf3441f2ed.tar.gz
dokka-fab2d4ba4f13454ab36ea7ee333579bf3441f2ed.tar.bz2
dokka-fab2d4ba4f13454ab36ea7ee333579bf3441f2ed.zip
Fix tests after bad rebase
Diffstat (limited to 'plugins/javadoc/src')
-rw-r--r--plugins/javadoc/src/main/kotlin/org/jetbrains/dokka/javadoc/location/JavadocLocationProvider.kt13
1 files changed, 9 insertions, 4 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 359cfef0..e8913922 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
@@ -1,10 +1,10 @@
package org.jetbrains.dokka.javadoc.location
-import org.jetbrains.dokka.DokkaConfiguration.DokkaSourceSet
import org.jetbrains.dokka.base.resolvers.local.DefaultLocationProvider
import org.jetbrains.dokka.javadoc.pages.*
import org.jetbrains.dokka.links.DRI
import org.jetbrains.dokka.links.Nullable
+import org.jetbrains.dokka.links.PointingToDeclaration
import org.jetbrains.dokka.links.parent
import org.jetbrains.dokka.model.*
import org.jetbrains.dokka.pages.ContentPage
@@ -67,7 +67,14 @@ class JavadocLocationProvider(pageRoot: RootPageNode, dokkaContext: DokkaContext
private fun JavadocClasslikePageNode.findAnchorableByDRI(dri: DRI): AnchorableJavadocNode? =
(constructors + methods + entries + properties).firstOrNull { it.dri == dri }
- override fun resolve(dri: DRI, sourceSets: Set<DisplaySourceSet>, context: PageNode?) =
+ override fun resolve(dri: DRI, sourceSets: Set<DisplaySourceSet>, context: PageNode?): String? =
+ getLocalLocation(dri, context)
+ ?: getLocalLocation(dri.copy(target = PointingToDeclaration), context)
+ // Not found in PageGraph, that means it's an external link
+ ?: getExternalLocation(dri, sourceSets)
+ ?: getExternalLocation(dri.copy(target = PointingToDeclaration), sourceSets)
+
+ private fun getLocalLocation(dri: DRI, context: PageNode?): String? =
nodeIndex[dri]?.let { resolve(it, context) }
?: nodeIndex[dri.parent]?.takeIf { it is JavadocClasslikePageNode }?.let {
val anchor = when (val anchorElement = (it as? JavadocClasslikePageNode)?.findAnchorableByDRI(dri)) {
@@ -78,8 +85,6 @@ class JavadocLocationProvider(pageRoot: RootPageNode, dokkaContext: DokkaContext
}
"${resolve(it, context, skipExtension = true)}.html#$anchor"
}
- ?: getExternalLocation(dri, sourceSets)
-
private fun JavadocFunctionNode.getAnchor(): String =
"$name(" +