aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--plugins/javadoc/src/main/kotlin/org/jetbrains/dokka/javadoc/location/JavadocLocationProvider.kt6
-rw-r--r--plugins/javadoc/src/main/kotlin/org/jetbrains/dokka/javadoc/pages/JavadocPageNodes.kt22
-rw-r--r--plugins/javadoc/src/main/kotlin/org/jetbrains/dokka/javadoc/pages/htmlPreprocessors.kt2
-rw-r--r--plugins/javadoc/src/main/resources/views/class.korte2
4 files changed, 18 insertions, 14 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 984ee0e7..38258fc6 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
@@ -49,9 +49,13 @@ class JavadocLocationProvider(pageRoot: RootPageNode, dokkaContext: DokkaContext
pageRoot.children.forEach { registerPath(it) }
}
+ private val parentPageIndex = HashMap<DRI, PageNode>()
private val nodeIndex = HashMap<DRI, PageNode>().apply {
fun registerNode(node: PageNode) {
if (node is ContentPage) put(node.dri.first(), node)
+ (node as? JavadocClasslikePageNode)?.getAnchorables()?.forEach { navigableNode ->
+ parentPageIndex[navigableNode.getDRI()] = node
+ }
node.children.forEach(::registerNode)
}
registerNode(pageRoot)
@@ -77,7 +81,7 @@ class JavadocLocationProvider(pageRoot: RootPageNode, dokkaContext: DokkaContext
private fun getLocalLocation(dri: DRI, context: PageNode?): String? =
nodeIndex[dri]?.let { resolve(it, context) }
- ?: nodeIndex[dri.parent]?.takeIf { dri.target !is PointingToGenericParameters && it is JavadocClasslikePageNode }?.let {
+ ?: parentPageIndex[dri]?.let {
val anchor = when (val anchorElement = (it as? JavadocClasslikePageNode)?.findAnchorableByDRI(dri)) {
is JavadocFunctionNode -> anchorElement.getAnchor()
is JavadocEntryNode -> anchorElement.name
diff --git a/plugins/javadoc/src/main/kotlin/org/jetbrains/dokka/javadoc/pages/JavadocPageNodes.kt b/plugins/javadoc/src/main/kotlin/org/jetbrains/dokka/javadoc/pages/JavadocPageNodes.kt
index feedc493..3875c307 100644
--- a/plugins/javadoc/src/main/kotlin/org/jetbrains/dokka/javadoc/pages/JavadocPageNodes.kt
+++ b/plugins/javadoc/src/main/kotlin/org/jetbrains/dokka/javadoc/pages/JavadocPageNodes.kt
@@ -1,7 +1,6 @@
package org.jetbrains.dokka.javadoc.pages
import com.intellij.psi.PsiClass
-import org.jetbrains.dokka.DokkaConfiguration
import org.jetbrains.dokka.Platform
import org.jetbrains.dokka.analysis.DescriptorDocumentableSource
import org.jetbrains.dokka.analysis.PsiDocumentableSource
@@ -15,8 +14,6 @@ import org.jetbrains.dokka.pages.*
import org.jetbrains.kotlin.descriptors.ClassDescriptor
import org.jetbrains.kotlin.descriptors.ClassKind
import org.jetbrains.kotlin.resolve.DescriptorUtils.getClassDescriptorForType
-import java.util.*
-import kotlin.collections.HashMap
interface JavadocPageNode : ContentPage
@@ -25,8 +22,8 @@ interface WithJavadocExtra<T : Documentable> : WithExtraProperties<T> {
throw IllegalStateException("Merging extras is not applicable for javadoc")
}
-interface WithIndexables {
- fun getAllIndexables(): List<NavigableJavadocNode>
+interface WithNavigable {
+ fun getAllNavigables(): List<NavigableJavadocNode>
}
interface WithBrief {
@@ -73,13 +70,13 @@ class JavadocPackagePageNode(
override val children: List<PageNode> = emptyList(),
override val embeddedResources: List<String> = listOf()
) : JavadocPageNode,
- WithIndexables,
+ WithNavigable,
NavigableJavadocNode,
PackagePage {
- override fun getAllIndexables(): List<NavigableJavadocNode> =
+ override fun getAllNavigables(): List<NavigableJavadocNode> =
children.filterIsInstance<NavigableJavadocNode>().flatMap {
- if (it is WithIndexables) it.getAllIndexables()
+ if (it is WithNavigable) it.getAllNavigables()
else listOf(it)
}
@@ -185,10 +182,13 @@ class JavadocClasslikePageNode(
override val children: List<PageNode> = emptyList(),
override val embeddedResources: List<String> = listOf(),
override val extra: PropertyContainer<DClasslike> = PropertyContainer.empty(),
-) : JavadocPageNode, WithJavadocExtra<DClasslike>, NavigableJavadocNode, WithIndexables, WithBrief, ClasslikePage {
+) : JavadocPageNode, WithJavadocExtra<DClasslike>, NavigableJavadocNode, WithNavigable, WithBrief, ClasslikePage {
- override fun getAllIndexables(): List<NavigableJavadocNode> =
- methods + entries + classlikes.map { it.getAllIndexables() }.flatten() + this
+ override fun getAllNavigables(): List<NavigableJavadocNode> =
+ methods + entries + classlikes.map { it.getAllNavigables() }.flatten() + this
+
+ fun getAnchorables(): List<AnchorableJavadocNode> =
+ constructors + methods + entries + properties
val kind: String? = documentable?.kind()
val packageName = dri.first().packageName
diff --git a/plugins/javadoc/src/main/kotlin/org/jetbrains/dokka/javadoc/pages/htmlPreprocessors.kt b/plugins/javadoc/src/main/kotlin/org/jetbrains/dokka/javadoc/pages/htmlPreprocessors.kt
index 5d51bc24..4b775f29 100644
--- a/plugins/javadoc/src/main/kotlin/org/jetbrains/dokka/javadoc/pages/htmlPreprocessors.kt
+++ b/plugins/javadoc/src/main/kotlin/org/jetbrains/dokka/javadoc/pages/htmlPreprocessors.kt
@@ -77,7 +77,7 @@ object IndexGenerator : PageTransformer {
override fun invoke(input: RootPageNode): RootPageNode {
val elements = HashMap<Char, MutableSet<NavigableJavadocNode>>()
(input as JavadocModulePageNode).children.filterIsInstance<JavadocPackagePageNode>().forEach {
- it.getAllIndexables().forEach { d ->
+ it.getAllNavigables().forEach { d ->
val name = when (d) {
is JavadocPageNode -> d.name
is AnchorableJavadocNode -> d.name
diff --git a/plugins/javadoc/src/main/resources/views/class.korte b/plugins/javadoc/src/main/resources/views/class.korte
index 048a479e..fcb866cb 100644
--- a/plugins/javadoc/src/main/resources/views/class.korte
+++ b/plugins/javadoc/src/main/resources/views/class.korte
@@ -65,7 +65,7 @@
<td class="colFirst"><code>{{ classlike.modifiers }}</code></td>
<th class="colSecond" scope="row"><code>{{ classlike.signature }}</span></code>
</th>
- <td class="colLast">{{ classlike.description }}</td>
+ <td class="colLast">{{ classlike.description|raw }}</td>
</tr>
{% endfor %}
</table>