diff options
author | Szymon Świstun <sswistun@virtuslab.com> | 2020-02-04 11:42:57 +0100 |
---|---|---|
committer | Paweł Marks <Kordyjan@users.noreply.github.com> | 2020-02-04 14:39:05 +0100 |
commit | 6f241300f799001e266b0301c56c1a8daad5ba24 (patch) | |
tree | 63c11ada222156d4ea5c427d4c077a68180a0ef1 | |
parent | 0508be47cbbc5a160217aa35233398044d8cdaf8 (diff) | |
download | dokka-6f241300f799001e266b0301c56c1a8daad5ba24.tar.gz dokka-6f241300f799001e266b0301c56c1a8daad5ba24.tar.bz2 dokka-6f241300f799001e266b0301c56c1a8daad5ba24.zip |
dri sets
7 files changed, 22 insertions, 20 deletions
diff --git a/core/src/main/kotlin/pages/ContentNodes.kt b/core/src/main/kotlin/pages/ContentNodes.kt index dcc511cc..7cf0e7b8 100644 --- a/core/src/main/kotlin/pages/ContentNodes.kt +++ b/core/src/main/kotlin/pages/ContentNodes.kt @@ -2,7 +2,7 @@ package org.jetbrains.dokka.pages import org.jetbrains.dokka.links.DRI -data class DCI(val dri: DRI, val kind: Kind) { +data class DCI(val dri: Set<DRI>, val kind: Kind) { override fun toString() = "$dri[$kind]" } diff --git a/core/src/main/kotlin/pages/DocTagToContentConverter.kt b/core/src/main/kotlin/pages/DocTagToContentConverter.kt index 3d34ddd2..08a579a8 100644 --- a/core/src/main/kotlin/pages/DocTagToContentConverter.kt +++ b/core/src/main/kotlin/pages/DocTagToContentConverter.kt @@ -53,7 +53,7 @@ class DocTagToContentConverter( ContentDRILink( buildChildren(docTag), docTag.dri, - DCI(docTag.dri, ContentKind.Symbol), + DCI(setOf(docTag.dri), ContentKind.Symbol), platforms, styles, extras diff --git a/core/src/main/kotlin/pages/PageBuilder.kt b/core/src/main/kotlin/pages/PageBuilder.kt index b32e4f4f..ce32645d 100644 --- a/core/src/main/kotlin/pages/PageBuilder.kt +++ b/core/src/main/kotlin/pages/PageBuilder.kt @@ -12,12 +12,12 @@ class DefaultPageBuilder( ModulePageNode(m.name.ifEmpty { "root" }, contentForModule(m), m, m.packages.map { pageForPackage(it) }) override fun pageForPackage(p: Package) = - PackagePageNode(p.name, contentForPackage(p), p.dri, p, + PackagePageNode(p.name, contentForPackage(p), setOf(p.dri), p, p.classes.map { pageForClass(it) } + p.functions.map { pageForMember(it) }) override fun pageForClass(c: Class): ClassPageNode = - ClassPageNode(c.name, contentForClass(c), c.dri, c, + ClassPageNode(c.name, contentForClass(c), setOf(c.dri), c, c.constructors.map { pageForMember(it) } + c.classes.map { pageForClass(it) } + c.functions.map { pageForMember(it) }) @@ -25,7 +25,7 @@ class DefaultPageBuilder( override fun pageForMember(m: CallableNode): MemberPageNode = when (m) { is Function -> - MemberPageNode(m.name, contentForFunction(m), m.dri, m) + MemberPageNode(m.name, contentForFunction(m), setOf(m.dri), m) else -> throw IllegalStateException("$m should not be present here") } diff --git a/core/src/main/kotlin/pages/PageContentBuilder.kt b/core/src/main/kotlin/pages/PageContentBuilder.kt index d56a6d70..efe23b5a 100644 --- a/core/src/main/kotlin/pages/PageContentBuilder.kt +++ b/core/src/main/kotlin/pages/PageContentBuilder.kt @@ -9,7 +9,7 @@ import org.jetbrains.dokka.model.TypeWrapper import org.jetbrains.dokka.links.DRI class DefaultPageContentBuilder( - private val dri: DRI, + private val dri: Set<DRI>, private val platformData: Set<PlatformData>, private val kind: Kind, private val commentsConverter: CommentsToContentConverter, @@ -39,7 +39,7 @@ class DefaultPageContentBuilder( } private fun signature(f: Function, block: PageContentBuilderFunction) { - contents += group(f.dri, f.platformData, ContentKind.Symbol, block) + contents += group(setOf(f.dri), f.platformData, ContentKind.Symbol, block) } override fun signature(f: Function) = signature(f) { @@ -85,7 +85,7 @@ class DefaultPageContentBuilder( contents += ContentTable( emptyList(), - elements.map { group(it.dri, it.platformData, kind) { operation(it) } }, + elements.map { group(setOf(it.dri), it.platformData, kind) { operation(it) } }, DCI(dri, kind), platformData, styles, extras ) @@ -143,7 +143,7 @@ class DefaultPageContentBuilder( group(dri, platformData, kind, block) override fun group( - dri: DRI, + dri: Set<DRI>, platformData: Set<PlatformData>, kind: Kind, block: PageContentBuilderFunction @@ -151,7 +151,7 @@ class DefaultPageContentBuilder( companion object { fun group( - dri: DRI, + dri: Set<DRI>, platformData: Set<PlatformData>, kind: Kind, commentsConverter: CommentsToContentConverter, @@ -186,9 +186,10 @@ annotation class ContentMarker @ContentMarker interface PageContentBuilder { fun group( - dri: DRI, + dri: Set<DRI>, platformData: Set<PlatformData>, - kind: Kind, block: PageContentBuilderFunction): ContentGroup + kind: Kind, block: PageContentBuilderFunction + ): ContentGroup fun text(text: String, kind: Kind = ContentKind.Symbol) fun signature(f: Function) fun link(text: String, address: DRI, kind: Kind = ContentKind.Symbol) diff --git a/core/src/main/kotlin/pages/PageNodes.kt b/core/src/main/kotlin/pages/PageNodes.kt index 80b21547..73d63cd7 100644 --- a/core/src/main/kotlin/pages/PageNodes.kt +++ b/core/src/main/kotlin/pages/PageNodes.kt @@ -17,7 +17,7 @@ interface PageNode { interface ContentPage: PageNode { val content: ContentNode - val dri: DRI + val dri: Set<DRI> val documentable: Documentable? val embeddedResources: List<String> @@ -68,7 +68,7 @@ class ModulePageNode( override val children: List<PageNode>, override val embeddedResources: List<String> = listOf() ) : RootPageNode(), ContentPage { - override val dri: DRI = DRI.topLevel + override val dri: Set<DRI> = setOf(DRI.topLevel) override fun modified(name: String, children: List<PageNode>): ModulePageNode = modified(name = name, content = this.content, children = children) @@ -86,7 +86,7 @@ class ModulePageNode( class PackagePageNode( override val name: String, override val content: ContentNode, - override val dri: DRI, + override val dri: Set<DRI>, override val documentable: Documentable?, override val children: List<PageNode>, @@ -108,7 +108,7 @@ class PackagePageNode( class ClassPageNode( override val name: String, override val content: ContentNode, - override val dri: DRI, + override val dri: Set<DRI>, override val documentable: Documentable?, override val children: List<PageNode>, override val embeddedResources: List<String> = listOf() @@ -129,7 +129,7 @@ class ClassPageNode( class MemberPageNode( override val name: String, override val content: ContentNode, - override val dri: DRI, + override val dri: Set<DRI>, override val documentable: Documentable?, override val children: List<PageNode> = emptyList(), override val embeddedResources: List<String> = listOf() diff --git a/core/src/main/kotlin/resolvers/DefaultLocationProvider.kt b/core/src/main/kotlin/resolvers/DefaultLocationProvider.kt index 48ea5316..cac7b740 100644 --- a/core/src/main/kotlin/resolvers/DefaultLocationProvider.kt +++ b/core/src/main/kotlin/resolvers/DefaultLocationProvider.kt @@ -17,8 +17,9 @@ open class DefaultLocationProvider( protected val extension = dokkaContext.single(CoreExtensions.fileExtension) protected val pagesIndex: Map<DRI, ContentPage> = pageGraphRoot.asSequence().filterIsInstance<ContentPage>() - .groupingBy { it.dri } - .aggregate { dri, _, page, first -> + .map { it.dri.map { dri -> dri to it } }.flatten() + .groupingBy { it.first } + .aggregate { dri, _, (_, page), first -> if (first) page else throw AssertionError("Multiple pages associated with dri: $dri") } diff --git a/core/src/main/kotlin/transformers/documentation/DefaultDocumentationToPageTranslator.kt b/core/src/main/kotlin/transformers/documentation/DefaultDocumentationToPageTranslator.kt index 20180ba7..81c6dfea 100644 --- a/core/src/main/kotlin/transformers/documentation/DefaultDocumentationToPageTranslator.kt +++ b/core/src/main/kotlin/transformers/documentation/DefaultDocumentationToPageTranslator.kt @@ -13,7 +13,7 @@ object DefaultDocumentationToPageTranslator : DocumentationToPageTranslator { override fun invoke(module: Module, context: DokkaContext): ModulePageNode = DefaultPageBuilder { node, kind, operation -> DefaultPageContentBuilder.group( - node.dri, + setOf(node.dri), node.platformData, kind, context.single(CoreExtensions.commentsToContentConverter), |