diff options
author | Marcin Aman <maman@virtuslab.com> | 2020-09-01 17:03:53 +0200 |
---|---|---|
committer | Kamil Doległo <9080183+kamildoleglo@users.noreply.github.com> | 2020-10-08 19:05:41 +0200 |
commit | 4331d1b816c30731842ab36827bbc1a4a9b292b3 (patch) | |
tree | b48a7443f22bfb0dd8b8fe0f6ec72b0aae1144b9 /plugins/base/src/main | |
parent | aae7623bb459d2bcd1e1b492aadf5c3858a3e657 (diff) | |
download | dokka-4331d1b816c30731842ab36827bbc1a4a9b292b3.tar.gz dokka-4331d1b816c30731842ab36827bbc1a4a9b292b3.tar.bz2 dokka-4331d1b816c30731842ab36827bbc1a4a9b292b3.zip |
Fixes to multimodule page anchoring
Diffstat (limited to 'plugins/base/src/main')
3 files changed, 10 insertions, 7 deletions
diff --git a/plugins/base/src/main/kotlin/allModulePage/MultimodulePageCreator.kt b/plugins/base/src/main/kotlin/allModulePage/MultimodulePageCreator.kt index 57c36634..5ae8f04a 100644 --- a/plugins/base/src/main/kotlin/allModulePage/MultimodulePageCreator.kt +++ b/plugins/base/src/main/kotlin/allModulePage/MultimodulePageCreator.kt @@ -7,6 +7,7 @@ import org.jetbrains.dokka.base.parsers.moduleAndPackage.ModuleAndPackageDocumen import org.jetbrains.dokka.base.parsers.moduleAndPackage.ModuleAndPackageDocumentationParsingContext import org.jetbrains.dokka.base.parsers.moduleAndPackage.parseModuleAndPackageDocumentation import org.jetbrains.dokka.base.parsers.moduleAndPackage.parseModuleAndPackageDocumentationFragments +import org.jetbrains.dokka.base.resolvers.anchors.SymbolAnchorHint import org.jetbrains.dokka.base.resolvers.local.MultimoduleLocationProvider.Companion.MULTIMODULE_PACKAGE_PLACEHOLDER import org.jetbrains.dokka.base.transformers.pages.comments.DocTagToContentConverter import org.jetbrains.dokka.base.translators.documentables.PageContentBuilder @@ -14,6 +15,7 @@ import org.jetbrains.dokka.links.DRI import org.jetbrains.dokka.model.doc.DocTag import org.jetbrains.dokka.model.doc.DocumentationNode import org.jetbrains.dokka.model.doc.P +import org.jetbrains.dokka.model.properties.PropertyContainer import org.jetbrains.dokka.pages.* import org.jetbrains.dokka.plugability.DokkaContext import org.jetbrains.dokka.plugability.querySingle @@ -46,7 +48,8 @@ class MultimodulePageCreator( val displayedModuleDocumentation = getDisplayedModuleDocumentation(module) val dri = DRI(packageName = MULTIMODULE_PACKAGE_PLACEHOLDER, classNames = module.name) val dci = DCI(setOf(dri), ContentKind.Comment) - val header = linkNode(module.name, dri) + val extraWithAnchor = PropertyContainer.withAll(SymbolAnchorHint(module.name)) + val header = linkNode(module.name, dri, DCI(setOf(dri), ContentKind.Main), extra = extraWithAnchor) val content = ContentGroup( children = if (displayedModuleDocumentation != null) @@ -56,7 +59,7 @@ class MultimodulePageCreator( sourceSets = emptySet(), style = emptySet() ) - ContentGroup(listOf(header, content), dci, emptySet(), emptySet()) + ContentGroup(listOf(header, content), dci, emptySet(), emptySet(), extraWithAnchor) } } } diff --git a/plugins/base/src/main/kotlin/resolvers/local/DokkaLocationProvider.kt b/plugins/base/src/main/kotlin/resolvers/local/DokkaLocationProvider.kt index fe8c8f84..a89aed9a 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] != null } + .filter { it.extra[SymbolAnchorHint.SymbolAnchorHintKey] != null } .mapNotNull { it.dci.dri.singleOrNull() } .distinct() .flatMap { dri -> diff --git a/plugins/base/src/main/kotlin/translators/documentables/PageContentBuilder.kt b/plugins/base/src/main/kotlin/translators/documentables/PageContentBuilder.kt index 2fc0c7b2..c67fe4b0 100644 --- a/plugins/base/src/main/kotlin/translators/documentables/PageContentBuilder.kt +++ b/plugins/base/src/main/kotlin/translators/documentables/PageContentBuilder.kt @@ -223,20 +223,20 @@ open class PageContentBuilder( styles: Set<Style> = mainStyles, extra: PropertyContainer<ContentNode> = mainExtra ) { - contents += linkNode(text, address, kind, sourceSets, styles, extra) + contents += linkNode(text, address, DCI(mainDRI, kind), sourceSets, styles, extra) } fun linkNode( text: String, address: DRI, - kind: Kind = ContentKind.Main, + dci: DCI = DCI(mainDRI, ContentKind.Main), sourceSets: Set<DokkaSourceSet> = mainSourcesetData, styles: Set<Style> = mainStyles, extra: PropertyContainer<ContentNode> = mainExtra ) = ContentDRILink( - listOf(createText(text, kind, sourceSets, styles, extra)), + listOf(createText(text, dci.kind, sourceSets, styles, extra)), address, - DCI(mainDRI, kind), + dci, sourceSets.toDisplaySourceSets(), extra = extra ) |