diff options
author | Marcin Aman <marcin.aman@gmail.com> | 2020-10-07 14:40:09 +0200 |
---|---|---|
committer | Kamil Doległo <9080183+kamildoleglo@users.noreply.github.com> | 2020-10-08 19:05:41 +0200 |
commit | 0d2ee179b6563020874db9f60906fb16b6ae1556 (patch) | |
tree | d55f43d48eea5966d312a8fe169cf1b493ce927d /plugins/base/src/main/kotlin/resolvers | |
parent | 4331d1b816c30731842ab36827bbc1a4a9b292b3 (diff) | |
download | dokka-0d2ee179b6563020874db9f60906fb16b6ae1556.tar.gz dokka-0d2ee179b6563020874db9f60906fb16b6ae1556.tar.bz2 dokka-0d2ee179b6563020874db9f60906fb16b6ae1556.zip |
Add information about content kind and sourceset to anchor
Diffstat (limited to 'plugins/base/src/main/kotlin/resolvers')
-rw-r--r-- | plugins/base/src/main/kotlin/resolvers/anchors/AnchorsHint.kt | 14 | ||||
-rw-r--r-- | plugins/base/src/main/kotlin/resolvers/local/DokkaLocationProvider.kt | 2 |
2 files changed, 9 insertions, 7 deletions
diff --git a/plugins/base/src/main/kotlin/resolvers/anchors/AnchorsHint.kt b/plugins/base/src/main/kotlin/resolvers/anchors/AnchorsHint.kt index 0b68db10..8f633b70 100644 --- a/plugins/base/src/main/kotlin/resolvers/anchors/AnchorsHint.kt +++ b/plugins/base/src/main/kotlin/resolvers/anchors/AnchorsHint.kt @@ -3,11 +3,13 @@ package org.jetbrains.dokka.base.resolvers.anchors import org.jetbrains.dokka.model.Documentable import org.jetbrains.dokka.model.properties.ExtraProperty import org.jetbrains.dokka.pages.ContentNode +import org.jetbrains.dokka.pages.Kind -data class SymbolAnchorHint(val anchorName: String): ExtraProperty<ContentNode> { - object SymbolAnchorHintKey : ExtraProperty.Key<ContentNode, SymbolAnchorHint> - override val key: ExtraProperty.Key<ContentNode, SymbolAnchorHint> = SymbolAnchorHintKey - companion object: ExtraProperty.Key<ContentNode, SymbolAnchorHint> { - fun from(d: Documentable): SymbolAnchorHint? = d.name?.let { SymbolAnchorHint(it) } +data class SymbolAnchorHint(val anchorName: String, val contentKind: Kind) : ExtraProperty<ContentNode> { + override val key: ExtraProperty.Key<ContentNode, SymbolAnchorHint> = SymbolAnchorHint + + companion object : ExtraProperty.Key<ContentNode, SymbolAnchorHint> { + fun from(d: Documentable, contentKind: Kind): SymbolAnchorHint? = + d.name?.let { SymbolAnchorHint(it, contentKind) } } -}
\ No newline at end of file +} diff --git a/plugins/base/src/main/kotlin/resolvers/local/DokkaLocationProvider.kt b/plugins/base/src/main/kotlin/resolvers/local/DokkaLocationProvider.kt index a89aed9a..fe8c8f84 100644 --- a/plugins/base/src/main/kotlin/resolvers/local/DokkaLocationProvider.kt +++ b/plugins/base/src/main/kotlin/resolvers/local/DokkaLocationProvider.kt @@ -44,7 +44,7 @@ open class DokkaLocationProvider( pageGraphRoot.withDescendants().filterIsInstance<ContentPage>() .flatMap { page -> page.content.withDescendants() - .filter { it.extra[SymbolAnchorHint.SymbolAnchorHintKey] != null } + .filter { it.extra[SymbolAnchorHint] != null } .mapNotNull { it.dci.dri.singleOrNull() } .distinct() .flatMap { dri -> |