diff options
22 files changed, 185 insertions, 185 deletions
diff --git a/core/src/main/kotlin/model/ContentSourceSet.kt b/core/src/main/kotlin/model/ContentSourceSet.kt deleted file mode 100644 index 8a1bf53c..00000000 --- a/core/src/main/kotlin/model/ContentSourceSet.kt +++ /dev/null @@ -1,24 +0,0 @@ -package org.jetbrains.dokka.model - -import org.jetbrains.dokka.DokkaConfiguration.DokkaSourceSet -import org.jetbrains.dokka.DokkaSourceSetID -import org.jetbrains.dokka.Platform -import org.jetbrains.dokka.utilities.SelfRepresentingSingletonSet - -data class ContentSourceSet( - val sourceSetIDs: CompositeSourceSetID, - val displayName: String, - val analysisPlatform: Platform -) : SelfRepresentingSingletonSet<ContentSourceSet> { - constructor(sourceSet: DokkaSourceSet) : this( - sourceSetIDs = CompositeSourceSetID(sourceSet.sourceSetID), - displayName = sourceSet.displayName, - analysisPlatform = sourceSet.analysisPlatform - ) -} - -fun DokkaSourceSet.toContentSourceSet(): ContentSourceSet = ContentSourceSet(this) - -fun Iterable<DokkaSourceSet>.toContentSourceSets(): Set<ContentSourceSet> = map { it.toContentSourceSet() }.toSet() - -val Iterable<ContentSourceSet>.sourceSetIDs: List<DokkaSourceSetID> get() = this.flatMap { it.sourceSetIDs.all } diff --git a/core/src/main/kotlin/model/DisplaySourceSet.kt b/core/src/main/kotlin/model/DisplaySourceSet.kt new file mode 100644 index 00000000..4f1387aa --- /dev/null +++ b/core/src/main/kotlin/model/DisplaySourceSet.kt @@ -0,0 +1,25 @@ +package org.jetbrains.dokka.model + +import org.jetbrains.dokka.DokkaConfiguration.DokkaSourceSet +import org.jetbrains.dokka.DokkaSourceSetID +import org.jetbrains.dokka.Platform +import org.jetbrains.dokka.utilities.SelfRepresentingSingletonSet + +data class DisplaySourceSet( + val sourceSetIDs: CompositeSourceSetID, + val name: String, + val platform + : Platform +) : SelfRepresentingSingletonSet<DisplaySourceSet> { + constructor(sourceSet: DokkaSourceSet) : this( + sourceSetIDs = CompositeSourceSetID(sourceSet.sourceSetID), + name = sourceSet.displayName, + platform = sourceSet.analysisPlatform + ) +} + +fun DokkaSourceSet.toDisplaySourceSet(): DisplaySourceSet = DisplaySourceSet(this) + +fun Iterable<DokkaSourceSet>.toDisplaySourceSets(): Set<DisplaySourceSet> = map { it.toDisplaySourceSet() }.toSet() + +val Iterable<DisplaySourceSet>.sourceSetIDs: List<DokkaSourceSetID> get() = this.flatMap { it.sourceSetIDs.all } diff --git a/core/src/main/kotlin/pages/ContentNodes.kt b/core/src/main/kotlin/pages/ContentNodes.kt index f068dd7a..35ae3d10 100644 --- a/core/src/main/kotlin/pages/ContentNodes.kt +++ b/core/src/main/kotlin/pages/ContentNodes.kt @@ -1,7 +1,7 @@ package org.jetbrains.dokka.pages import org.jetbrains.dokka.links.DRI -import org.jetbrains.dokka.model.ContentSourceSet +import org.jetbrains.dokka.model.DisplaySourceSet import org.jetbrains.dokka.model.WithChildren import org.jetbrains.dokka.model.properties.PropertyContainer import org.jetbrains.dokka.model.properties.WithExtraProperties @@ -12,12 +12,12 @@ data class DCI(val dri: Set<DRI>, val kind: Kind) { interface ContentNode : WithExtraProperties<ContentNode>, WithChildren<ContentNode> { val dci: DCI - val sourceSets: Set<ContentSourceSet> + val sourceSets: Set<DisplaySourceSet> val style: Set<Style> fun hasAnyContent(): Boolean - fun withSourceSets(sourceSets: Set<ContentSourceSet>): ContentNode + fun withSourceSets(sourceSets: Set<DisplaySourceSet>): ContentNode override val children: List<ContentNode> get() = emptyList() @@ -27,24 +27,24 @@ interface ContentNode : WithExtraProperties<ContentNode>, WithChildren<ContentNo data class ContentText( val text: String, override val dci: DCI, - override val sourceSets: Set<ContentSourceSet>, + override val sourceSets: Set<DisplaySourceSet>, override val style: Set<Style> = emptySet(), override val extra: PropertyContainer<ContentNode> = PropertyContainer.empty() ) : ContentNode { override fun withNewExtras(newExtras: PropertyContainer<ContentNode>): ContentText = copy(extra = newExtras) - override fun withSourceSets(sourceSets: Set<ContentSourceSet>): ContentText = copy(sourceSets = sourceSets) + override fun withSourceSets(sourceSets: Set<DisplaySourceSet>): ContentText = copy(sourceSets = sourceSets) override fun hasAnyContent(): Boolean = !text.isBlank() } // TODO: Remove data class ContentBreakLine( - override val sourceSets: Set<ContentSourceSet>, + override val sourceSets: Set<DisplaySourceSet>, override val dci: DCI = DCI(emptySet(), ContentKind.Empty), override val style: Set<Style> = emptySet(), override val extra: PropertyContainer<ContentNode> = PropertyContainer.empty() ) : ContentNode { override fun withNewExtras(newExtras: PropertyContainer<ContentNode>): ContentBreakLine = copy(extra = newExtras) - override fun withSourceSets(sourceSets: Set<ContentSourceSet>): ContentBreakLine = copy(sourceSets = sourceSets) + override fun withSourceSets(sourceSets: Set<DisplaySourceSet>): ContentBreakLine = copy(sourceSets = sourceSets) override fun hasAnyContent(): Boolean = true } @@ -53,7 +53,7 @@ data class ContentHeader( override val children: List<ContentNode>, val level: Int, override val dci: DCI, - override val sourceSets: Set<ContentSourceSet>, + override val sourceSets: Set<DisplaySourceSet>, override val style: Set<Style>, override val extra: PropertyContainer<ContentNode> = PropertyContainer.empty() ) : ContentComposite { @@ -64,7 +64,7 @@ data class ContentHeader( override fun transformChildren(transformer: (ContentNode) -> ContentNode): ContentHeader = copy(children = children.map(transformer)) - override fun withSourceSets(sourceSets: Set<ContentSourceSet>): ContentHeader = + override fun withSourceSets(sourceSets: Set<DisplaySourceSet>): ContentHeader = copy(sourceSets = sourceSets) } @@ -75,7 +75,7 @@ data class ContentCodeBlock( override val children: List<ContentNode>, val language: String, override val dci: DCI, - override val sourceSets: Set<ContentSourceSet>, + override val sourceSets: Set<DisplaySourceSet>, override val style: Set<Style>, override val extra: PropertyContainer<ContentNode> = PropertyContainer.empty() ) : ContentCode { @@ -84,7 +84,7 @@ data class ContentCodeBlock( override fun transformChildren(transformer: (ContentNode) -> ContentNode): ContentCodeBlock = copy(children = children.map(transformer)) - override fun withSourceSets(sourceSets: Set<ContentSourceSet>): ContentCodeBlock = + override fun withSourceSets(sourceSets: Set<DisplaySourceSet>): ContentCodeBlock = copy(sourceSets = sourceSets) } @@ -93,7 +93,7 @@ data class ContentCodeInline( override val children: List<ContentNode>, val language: String, override val dci: DCI, - override val sourceSets: Set<ContentSourceSet>, + override val sourceSets: Set<DisplaySourceSet>, override val style: Set<Style>, override val extra: PropertyContainer<ContentNode> = PropertyContainer.empty() ) : ContentCode { @@ -102,7 +102,7 @@ data class ContentCodeInline( override fun transformChildren(transformer: (ContentNode) -> ContentNode): ContentCodeInline = copy(children = children.map(transformer)) - override fun withSourceSets(sourceSets: Set<ContentSourceSet>): ContentCodeInline = + override fun withSourceSets(sourceSets: Set<DisplaySourceSet>): ContentCodeInline = copy(sourceSets = sourceSets) } @@ -115,7 +115,7 @@ data class ContentDRILink( override val children: List<ContentNode>, val address: DRI, override val dci: DCI, - override val sourceSets: Set<ContentSourceSet>, + override val sourceSets: Set<DisplaySourceSet>, override val style: Set<Style> = emptySet(), override val extra: PropertyContainer<ContentNode> = PropertyContainer.empty() ) : ContentLink { @@ -124,7 +124,7 @@ data class ContentDRILink( override fun transformChildren(transformer: (ContentNode) -> ContentNode): ContentDRILink = copy(children = children.map(transformer)) - override fun withSourceSets(sourceSets: Set<ContentSourceSet>): ContentDRILink = + override fun withSourceSets(sourceSets: Set<DisplaySourceSet>): ContentDRILink = copy(sourceSets = sourceSets) } @@ -134,7 +134,7 @@ data class ContentResolvedLink( override val children: List<ContentNode>, val address: String, override val dci: DCI, - override val sourceSets: Set<ContentSourceSet>, + override val sourceSets: Set<DisplaySourceSet>, override val style: Set<Style> = emptySet(), override val extra: PropertyContainer<ContentNode> = PropertyContainer.empty() ) : ContentLink { @@ -144,7 +144,7 @@ data class ContentResolvedLink( override fun transformChildren(transformer: (ContentNode) -> ContentNode): ContentResolvedLink = copy(children = children.map(transformer)) - override fun withSourceSets(sourceSets: Set<ContentSourceSet>): ContentResolvedLink = + override fun withSourceSets(sourceSets: Set<DisplaySourceSet>): ContentResolvedLink = copy(sourceSets = sourceSets) } @@ -154,7 +154,7 @@ data class ContentEmbeddedResource( val address: String, val altText: String?, override val dci: DCI, - override val sourceSets: Set<ContentSourceSet>, + override val sourceSets: Set<DisplaySourceSet>, override val style: Set<Style> = emptySet(), override val extra: PropertyContainer<ContentNode> = PropertyContainer.empty() ) : ContentLink { @@ -164,7 +164,7 @@ data class ContentEmbeddedResource( override fun transformChildren(transformer: (ContentNode) -> ContentNode): ContentEmbeddedResource = copy(children = children.map(transformer)) - override fun withSourceSets(sourceSets: Set<ContentSourceSet>): ContentEmbeddedResource = + override fun withSourceSets(sourceSets: Set<DisplaySourceSet>): ContentEmbeddedResource = copy(sourceSets = sourceSets) } @@ -172,7 +172,7 @@ data class ContentEmbeddedResource( interface ContentComposite : ContentNode { override val children: List<ContentNode> // overwrite to make it abstract once again - override val sourceSets: Set<ContentSourceSet> get() = children.flatMap { it.sourceSets }.toSet() + override val sourceSets: Set<DisplaySourceSet> get() = children.flatMap { it.sourceSets }.toSet() fun transformChildren(transformer: (ContentNode) -> ContentNode): ContentComposite @@ -184,7 +184,7 @@ data class ContentTable( val header: List<ContentGroup>, override val children: List<ContentGroup>, override val dci: DCI, - override val sourceSets: Set<ContentSourceSet>, + override val sourceSets: Set<DisplaySourceSet>, override val style: Set<Style>, override val extra: PropertyContainer<ContentNode> = PropertyContainer.empty() ) : ContentComposite { @@ -193,7 +193,7 @@ data class ContentTable( override fun transformChildren(transformer: (ContentNode) -> ContentNode): ContentTable = copy(children = children.map(transformer).map { it as ContentGroup }) - override fun withSourceSets(sourceSets: Set<ContentSourceSet>): ContentTable = + override fun withSourceSets(sourceSets: Set<DisplaySourceSet>): ContentTable = copy(sourceSets = sourceSets) } @@ -203,7 +203,7 @@ data class ContentList( override val children: List<ContentNode>, val ordered: Boolean, override val dci: DCI, - override val sourceSets: Set<ContentSourceSet>, + override val sourceSets: Set<DisplaySourceSet>, override val style: Set<Style>, override val extra: PropertyContainer<ContentNode> = PropertyContainer.empty() ) : ContentComposite { @@ -212,7 +212,7 @@ data class ContentList( override fun transformChildren(transformer: (ContentNode) -> ContentNode): ContentList = copy(children = children.map(transformer)) - override fun withSourceSets(sourceSets: Set<ContentSourceSet>): ContentList = + override fun withSourceSets(sourceSets: Set<DisplaySourceSet>): ContentList = copy(sourceSets = sourceSets) } @@ -220,7 +220,7 @@ data class ContentList( data class ContentGroup( override val children: List<ContentNode>, override val dci: DCI, - override val sourceSets: Set<ContentSourceSet>, + override val sourceSets: Set<DisplaySourceSet>, override val style: Set<Style>, override val extra: PropertyContainer<ContentNode> = PropertyContainer.empty() ) : ContentComposite { @@ -229,7 +229,7 @@ data class ContentGroup( override fun transformChildren(transformer: (ContentNode) -> ContentNode): ContentGroup = copy(children = children.map(transformer)) - override fun withSourceSets(sourceSets: Set<ContentSourceSet>): ContentGroup = + override fun withSourceSets(sourceSets: Set<DisplaySourceSet>): ContentGroup = copy(sourceSets = sourceSets) } @@ -246,7 +246,7 @@ data class ContentDivergentGroup( ) : ContentComposite { data class GroupID(val name: String) - override val sourceSets: Set<ContentSourceSet> + override val sourceSets: Set<DisplaySourceSet> get() = children.flatMap { it.sourceSets }.distinct().toSet() override fun withNewExtras(newExtras: PropertyContainer<ContentNode>): ContentDivergentGroup = @@ -256,7 +256,7 @@ data class ContentDivergentGroup( copy(children = children.map(transformer).map { it as ContentDivergentInstance }) // TODO NOW? - override fun withSourceSets(sourceSets: Set<ContentSourceSet>): ContentDivergentGroup = this + override fun withSourceSets(sourceSets: Set<DisplaySourceSet>): ContentDivergentGroup = this } /** Instance of a divergent content */ @@ -265,7 +265,7 @@ data class ContentDivergentInstance( val divergent: ContentNode, val after: ContentNode?, override val dci: DCI, - override val sourceSets: Set<ContentSourceSet>, + override val sourceSets: Set<DisplaySourceSet>, override val style: Set<Style>, override val extra: PropertyContainer<ContentNode> = PropertyContainer.empty() ) : ContentComposite { @@ -282,14 +282,14 @@ data class ContentDivergentInstance( after = after?.let(transformer) ) - override fun withSourceSets(sourceSets: Set<ContentSourceSet>): ContentDivergentInstance = + override fun withSourceSets(sourceSets: Set<DisplaySourceSet>): ContentDivergentInstance = copy(sourceSets = sourceSets) } data class PlatformHintedContent( val inner: ContentNode, - override val sourceSets: Set<ContentSourceSet> + override val sourceSets: Set<DisplaySourceSet> ) : ContentComposite { override val children = listOf(inner) @@ -308,7 +308,7 @@ data class PlatformHintedContent( override fun transformChildren(transformer: (ContentNode) -> ContentNode): PlatformHintedContent = copy(inner = transformer(inner)) - override fun withSourceSets(sourceSets: Set<ContentSourceSet>): PlatformHintedContent = + override fun withSourceSets(sourceSets: Set<DisplaySourceSet>): PlatformHintedContent = copy(sourceSets = sourceSets) } diff --git a/core/src/test/kotlin/model/ContentSourceSetTest.kt b/core/src/test/kotlin/model/DisplaySourceSetTest.kt index 74f7854b..adabdbdb 100644 --- a/core/src/test/kotlin/model/ContentSourceSetTest.kt +++ b/core/src/test/kotlin/model/DisplaySourceSetTest.kt @@ -3,19 +3,19 @@ package model import org.jetbrains.dokka.DokkaSourceSetID import org.jetbrains.dokka.Platform import org.jetbrains.dokka.model.CompositeSourceSetID -import org.jetbrains.dokka.model.ContentSourceSet +import org.jetbrains.dokka.model.DisplaySourceSet import org.jetbrains.dokka.model.sourceSetIDs import kotlin.test.Test import kotlin.test.assertFalse import kotlin.test.assertTrue -class ContentSourceSetTest { +class DisplaySourceSetTest { @Test fun `contains sourceSetId`() { - val contentSourceSet = ContentSourceSet( + val contentSourceSet = DisplaySourceSet( sourceSetIDs = CompositeSourceSetID(listOf(DokkaSourceSetID("m1", "s1"), DokkaSourceSetID("m2", "s2"))), - displayName = "displayName", - analysisPlatform = Platform.common + name = "displayName", + platform = Platform.common ) assertFalse( @@ -37,10 +37,10 @@ class ContentSourceSetTest { @Test fun `Iterable contains sourceSetId`() { - val contentSourceSet = ContentSourceSet( + val contentSourceSet = DisplaySourceSet( sourceSetIDs = CompositeSourceSetID(listOf(DokkaSourceSetID("m1", "s1"), DokkaSourceSetID("m2", "s2"))), - displayName = "displayName", - analysisPlatform = Platform.common + name = "displayName", + platform = Platform.common ) assertFalse( diff --git a/plugins/base/src/main/kotlin/renderers/DefaultRenderer.kt b/plugins/base/src/main/kotlin/renderers/DefaultRenderer.kt index b7062310..ef04bb47 100644 --- a/plugins/base/src/main/kotlin/renderers/DefaultRenderer.kt +++ b/plugins/base/src/main/kotlin/renderers/DefaultRenderer.kt @@ -6,7 +6,7 @@ import kotlinx.coroutines.launch import kotlinx.coroutines.runBlocking import org.jetbrains.dokka.base.DokkaBase import org.jetbrains.dokka.base.resolvers.local.LocationProvider -import org.jetbrains.dokka.model.ContentSourceSet +import org.jetbrains.dokka.model.DisplaySourceSet import org.jetbrains.dokka.pages.* import org.jetbrains.dokka.plugability.DokkaContext import org.jetbrains.dokka.plugability.plugin @@ -30,7 +30,7 @@ abstract class DefaultRenderer<T>( abstract fun T.buildList( node: ContentList, pageContext: ContentPage, - sourceSetRestriction: Set<ContentSourceSet>? = null + sourceSetRestriction: Set<DisplaySourceSet>? = null ) abstract fun T.buildNewLine() @@ -38,7 +38,7 @@ abstract class DefaultRenderer<T>( abstract fun T.buildTable( node: ContentTable, pageContext: ContentPage, - sourceSetRestriction: Set<ContentSourceSet>? = null + sourceSetRestriction: Set<DisplaySourceSet>? = null ) abstract fun T.buildText(textNode: ContentText) @@ -50,13 +50,13 @@ abstract class DefaultRenderer<T>( open fun T.buildPlatformDependent( content: PlatformHintedContent, pageContext: ContentPage, - sourceSetRestriction: Set<ContentSourceSet>? + sourceSetRestriction: Set<DisplaySourceSet>? ) = buildContentNode(content.inner, pageContext) open fun T.buildGroup( node: ContentGroup, pageContext: ContentPage, - sourceSetRestriction: Set<ContentSourceSet>? = null + sourceSetRestriction: Set<DisplaySourceSet>? = null ) = wrapGroup(node, pageContext) { node.children.forEach { it.build(this, pageContext, sourceSetRestriction) } } @@ -69,7 +69,7 @@ abstract class DefaultRenderer<T>( open fun T.buildLinkText( nodes: List<ContentNode>, pageContext: ContentPage, - sourceSetRestriction: Set<ContentSourceSet>? = null + sourceSetRestriction: Set<DisplaySourceSet>? = null ) { nodes.forEach { it.build(this, pageContext, sourceSetRestriction) } } @@ -85,7 +85,7 @@ abstract class DefaultRenderer<T>( open fun T.buildHeader( node: ContentHeader, pageContext: ContentPage, - sourceSetRestriction: Set<ContentSourceSet>? = null + sourceSetRestriction: Set<DisplaySourceSet>? = null ) { buildHeader(node.level, node) { node.children.forEach { it.build(this, pageContext, sourceSetRestriction) } } } @@ -93,14 +93,14 @@ abstract class DefaultRenderer<T>( open fun ContentNode.build( builder: T, pageContext: ContentPage, - sourceSetRestriction: Set<ContentSourceSet>? = null + sourceSetRestriction: Set<DisplaySourceSet>? = null ) = builder.buildContentNode(this, pageContext, sourceSetRestriction) open fun T.buildContentNode( node: ContentNode, pageContext: ContentPage, - sourceSetRestriction: Set<ContentSourceSet>? = null + sourceSetRestriction: Set<DisplaySourceSet>? = null ) { if (sourceSetRestriction == null || node.sourceSets.any { it in sourceSetRestriction }) { when (node) { @@ -178,8 +178,8 @@ abstract class DefaultRenderer<T>( protected fun ContentDivergentGroup.groupDivergentInstances( pageContext: ContentPage, - beforeTransformer: (ContentDivergentInstance, ContentPage, ContentSourceSet) -> String, - afterTransformer: (ContentDivergentInstance, ContentPage, ContentSourceSet) -> String + beforeTransformer: (ContentDivergentInstance, ContentPage, DisplaySourceSet) -> String, + afterTransformer: (ContentDivergentInstance, ContentPage, DisplaySourceSet) -> String ): Map<SerializedBeforeAndAfter, List<InstanceWithSource>> = children.flatMap { instance -> instance.sourceSets.map { sourceSet -> @@ -195,6 +195,6 @@ abstract class DefaultRenderer<T>( } internal typealias SerializedBeforeAndAfter = Pair<String, String> -internal typealias InstanceWithSource = Pair<ContentDivergentInstance, ContentSourceSet> +internal typealias InstanceWithSource = Pair<ContentDivergentInstance, DisplaySourceSet> fun ContentPage.sourceSets() = this.content.sourceSets diff --git a/plugins/base/src/main/kotlin/renderers/html/HtmlRenderer.kt b/plugins/base/src/main/kotlin/renderers/html/HtmlRenderer.kt index 529caa93..812776af 100644 --- a/plugins/base/src/main/kotlin/renderers/html/HtmlRenderer.kt +++ b/plugins/base/src/main/kotlin/renderers/html/HtmlRenderer.kt @@ -11,7 +11,7 @@ import org.jetbrains.dokka.base.DokkaBase import org.jetbrains.dokka.base.renderers.DefaultRenderer import org.jetbrains.dokka.base.renderers.TabSortingStrategy import org.jetbrains.dokka.links.DRI -import org.jetbrains.dokka.model.ContentSourceSet +import org.jetbrains.dokka.model.DisplaySourceSet import org.jetbrains.dokka.model.dfs import org.jetbrains.dokka.model.properties.PropertyContainer import org.jetbrains.dokka.model.sourceSetIDs @@ -116,13 +116,13 @@ open class HtmlRenderer( button(classes = "platform-tag platform-selector") { attributes["data-active"] = "" attributes["data-filter"] = it.sourceSetIDs.merged.toString() - when (it.analysisPlatform.key) { + when (it.platform.key) { "common" -> classes = classes + "common-like" "native" -> classes = classes + "native-like" "jvm" -> classes = classes + "jvm-like" "js" -> classes = classes + "js-like" } - text(it.displayName) + text(it.name) } } } @@ -161,7 +161,7 @@ open class HtmlRenderer( override fun FlowContent.buildPlatformDependent( content: PlatformHintedContent, pageContext: ContentPage, - sourceSetRestriction: Set<ContentSourceSet>? + sourceSetRestriction: Set<DisplaySourceSet>? ) = buildPlatformDependent( content.sourceSets.filter { @@ -173,7 +173,7 @@ open class HtmlRenderer( ) private fun FlowContent.buildPlatformDependent( - nodes: Map<ContentSourceSet, Collection<ContentNode>>, + nodes: Map<DisplaySourceSet, Collection<ContentNode>>, pageContext: ContentPage, extra: PropertyContainer<ContentNode> = PropertyContainer.empty(), styles: Set<Style> = emptySet() @@ -194,14 +194,14 @@ open class HtmlRenderer( attributes["data-filterable-set"] = pair.first.sourceSetIDs.merged.toString() if (index == 0) attributes["data-active"] = "" attributes["data-toggle"] = pair.first.sourceSetIDs.merged.toString() - when (pair.first.analysisPlatform.key) { + when (pair.first.platform.key) { "common" -> classes = classes + "common-like" "native" -> classes = classes + "native-like" "jvm" -> classes = classes + "jvm-like" "js" -> classes = classes + "js-like" } attributes["data-toggle"] = pair.first.sourceSetIDs.merged.toString() - text(pair.first.displayName) + text(pair.first.name) } } } @@ -213,9 +213,9 @@ open class HtmlRenderer( } private fun contentsForSourceSetDependent( - nodes: Map<ContentSourceSet, Collection<ContentNode>>, + nodes: Map<DisplaySourceSet, Collection<ContentNode>>, pageContext: ContentPage, - ): List<Pair<ContentSourceSet, String>> { + ): List<Pair<DisplaySourceSet, String>> { var counter = 0 return nodes.toList().map { (sourceSet, elements) -> sourceSet to createHTML(prettyPrint = false).div { @@ -224,8 +224,8 @@ open class HtmlRenderer( } }.stripDiv() }.groupBy( - Pair<ContentSourceSet, String>::second, - Pair<ContentSourceSet, String>::first + Pair<DisplaySourceSet, String>::second, + Pair<DisplaySourceSet, String>::first ).entries.flatMap { (html, sourceSets) -> sourceSets.filterNot { sourceSet -> sourceSet.sourceSetIDs.all.flatMap { sourceSetDependencyMap[it].orEmpty() } @@ -314,14 +314,14 @@ open class HtmlRenderer( override fun FlowContent.buildList( node: ContentList, pageContext: ContentPage, - sourceSetRestriction: Set<ContentSourceSet>? + sourceSetRestriction: Set<DisplaySourceSet>? ) = if (node.ordered) ol { buildListItems(node.children, pageContext, sourceSetRestriction) } else ul { buildListItems(node.children, pageContext, sourceSetRestriction) } open fun OL.buildListItems( items: List<ContentNode>, pageContext: ContentPage, - sourceSetRestriction: Set<ContentSourceSet>? = null + sourceSetRestriction: Set<DisplaySourceSet>? = null ) { items.forEach { if (it is ContentList) @@ -334,7 +334,7 @@ open class HtmlRenderer( open fun UL.buildListItems( items: List<ContentNode>, pageContext: ContentPage, - sourceSetRestriction: Set<ContentSourceSet>? = null + sourceSetRestriction: Set<DisplaySourceSet>? = null ) { items.forEach { if (it is ContentList) @@ -361,7 +361,7 @@ open class HtmlRenderer( private fun FlowContent.buildRow( node: ContentGroup, pageContext: ContentPage, - sourceSetRestriction: Set<ContentSourceSet>?, + sourceSetRestriction: Set<DisplaySourceSet>?, style: Set<Style> ) { node.children @@ -414,18 +414,18 @@ open class HtmlRenderer( } } - private fun FlowContent.createPlatformTagBubbles(sourceSets: List<ContentSourceSet>) { + private fun FlowContent.createPlatformTagBubbles(sourceSets: List<DisplaySourceSet>) { if (shouldRenderSourceSetBubbles) { div("platform-tags") { sourceSets.forEach { div("platform-tag") { - when (it.analysisPlatform.key) { + when (it.platform.key) { "common" -> classes = classes + "common-like" "native" -> classes = classes + "native-like" "jvm" -> classes = classes + "jvm-like" "js" -> classes = classes + "js-like" } - text(it.displayName) + text(it.name) } } } @@ -434,7 +434,7 @@ open class HtmlRenderer( private fun FlowContent.createPlatformTags( node: ContentNode, - sourceSetRestriction: Set<ContentSourceSet>? = null + sourceSetRestriction: Set<DisplaySourceSet>? = null ) { node.takeIf { sourceSetRestriction == null || it.sourceSets.any { s -> s in sourceSetRestriction } }?.let { createPlatformTagBubbles(node.sourceSets.filter { @@ -446,7 +446,7 @@ open class HtmlRenderer( override fun FlowContent.buildTable( node: ContentTable, pageContext: ContentPage, - sourceSetRestriction: Set<ContentSourceSet>? + sourceSetRestriction: Set<DisplaySourceSet>? ) { when (node.dci.kind) { ContentKind.Comment -> buildDefaultTable(node, pageContext, sourceSetRestriction) @@ -463,7 +463,7 @@ open class HtmlRenderer( fun FlowContent.buildDefaultTable( node: ContentTable, pageContext: ContentPage, - sourceSetRestriction: Set<ContentSourceSet>? + sourceSetRestriction: Set<DisplaySourceSet>? ) { table { thead { @@ -548,7 +548,7 @@ open class HtmlRenderer( fun FlowContent.buildLink( to: DRI, - platforms: List<ContentSourceSet>, + platforms: List<DisplaySourceSet>, from: PageNode? = null, block: FlowContent.() -> Unit ) = buildLink(locationProvider.resolve(to, platforms.toSet(), from), block) @@ -588,7 +588,7 @@ open class HtmlRenderer( private fun getSymbolSignature(page: ContentPage) = page.content.dfs { it.dci.kind == ContentKind.Symbol } private fun flattenToText(node: ContentNode): String { - fun getContentTextNodes(node: ContentNode, sourceSetRestriction: ContentSourceSet): List<ContentText> = + fun getContentTextNodes(node: ContentNode, sourceSetRestriction: DisplaySourceSet): List<ContentText> = when (node) { is ContentText -> listOf(node) is ContentComposite -> node.children @@ -600,7 +600,7 @@ open class HtmlRenderer( } val sourceSetRestriction = - node.sourceSets.find { it.analysisPlatform == Platform.common } ?: node.sourceSets.first() + node.sourceSets.find { it.platform == Platform.common } ?: node.sourceSets.first() return getContentTextNodes(node, sourceSetRestriction).joinToString("") { it.text } } diff --git a/plugins/base/src/main/kotlin/renderers/html/NavigationPage.kt b/plugins/base/src/main/kotlin/renderers/html/NavigationPage.kt index 7c5d31f8..a6a16412 100644 --- a/plugins/base/src/main/kotlin/renderers/html/NavigationPage.kt +++ b/plugins/base/src/main/kotlin/renderers/html/NavigationPage.kt @@ -3,7 +3,7 @@ package org.jetbrains.dokka.base.renderers.html import kotlinx.html.* import kotlinx.html.stream.createHTML import org.jetbrains.dokka.links.DRI -import org.jetbrains.dokka.model.ContentSourceSet +import org.jetbrains.dokka.model.DisplaySourceSet import org.jetbrains.dokka.pages.PageNode import org.jetbrains.dokka.pages.RendererSpecificPage import org.jetbrains.dokka.pages.RenderingStrategy @@ -41,7 +41,7 @@ class NavigationPage(val root: NavigationNode) : RendererSpecificPage { class NavigationNode( val name: String, val dri: DRI, - val sourceSets: Set<ContentSourceSet>, + val sourceSets: Set<DisplaySourceSet>, val children: List<NavigationNode> ) diff --git a/plugins/base/src/main/kotlin/resolvers/local/BaseLocationProvider.kt b/plugins/base/src/main/kotlin/resolvers/local/BaseLocationProvider.kt index 9c9a0c0e..7387789b 100644 --- a/plugins/base/src/main/kotlin/resolvers/local/BaseLocationProvider.kt +++ b/plugins/base/src/main/kotlin/resolvers/local/BaseLocationProvider.kt @@ -3,7 +3,7 @@ package org.jetbrains.dokka.base.resolvers.local import org.jetbrains.dokka.DokkaConfiguration import org.jetbrains.dokka.base.DokkaBase import org.jetbrains.dokka.links.DRI -import org.jetbrains.dokka.model.ContentSourceSet +import org.jetbrains.dokka.model.DisplaySourceSet import org.jetbrains.dokka.model.sourceSetIDs import org.jetbrains.dokka.plugability.DokkaContext import org.jetbrains.dokka.plugability.plugin @@ -24,7 +24,7 @@ abstract class BaseLocationProvider(protected val dokkaContext: DokkaContext) : protected fun getExternalLocation( dri: DRI, - sourceSets: Set<ContentSourceSet> + sourceSets: Set<DisplaySourceSet> ): String { val jdkToExternalDocumentationLinks = dokkaContext.configuration.sourceSets .filter { sourceSet -> sourceSet.sourceSetID in sourceSets.sourceSetIDs } diff --git a/plugins/base/src/main/kotlin/resolvers/local/DefaultLocationProvider.kt b/plugins/base/src/main/kotlin/resolvers/local/DefaultLocationProvider.kt index c437b52a..b9df45ae 100644 --- a/plugins/base/src/main/kotlin/resolvers/local/DefaultLocationProvider.kt +++ b/plugins/base/src/main/kotlin/resolvers/local/DefaultLocationProvider.kt @@ -4,7 +4,7 @@ import org.jetbrains.dokka.DokkaConfiguration import org.jetbrains.dokka.base.resolvers.anchors.SymbolAnchorHint import org.jetbrains.dokka.base.resolvers.external.ExternalLocationProvider import org.jetbrains.dokka.links.DRI -import org.jetbrains.dokka.model.ContentSourceSet +import org.jetbrains.dokka.model.DisplaySourceSet import org.jetbrains.dokka.model.withDescendants import org.jetbrains.dokka.pages.* import org.jetbrains.dokka.plugability.DokkaContext @@ -51,7 +51,7 @@ open class DefaultLocationProvider( override fun resolve(node: PageNode, context: PageNode?, skipExtension: Boolean): String = pathTo(node, context) + if (!skipExtension) extension else "" - override fun resolve(dri: DRI, sourceSets: Set<ContentSourceSet>, context: PageNode?): String = + override fun resolve(dri: DRI, sourceSets: Set<DisplaySourceSet>, context: PageNode?): String = pagesIndex[dri]?.let { resolve(it, context) } ?: anchorsIndex[dri]?.let { resolve(it, context) + "#$dri" } // Not found in PageGraph, that means it's an external link diff --git a/plugins/base/src/main/kotlin/resolvers/local/LocationProvider.kt b/plugins/base/src/main/kotlin/resolvers/local/LocationProvider.kt index d95594cf..5077195f 100644 --- a/plugins/base/src/main/kotlin/resolvers/local/LocationProvider.kt +++ b/plugins/base/src/main/kotlin/resolvers/local/LocationProvider.kt @@ -1,12 +1,12 @@ package org.jetbrains.dokka.base.resolvers.local import org.jetbrains.dokka.links.DRI -import org.jetbrains.dokka.model.ContentSourceSet +import org.jetbrains.dokka.model.DisplaySourceSet import org.jetbrains.dokka.pages.PageNode import org.jetbrains.dokka.pages.RootPageNode interface LocationProvider { - fun resolve(dri: DRI, sourceSets: Set<ContentSourceSet>, context: PageNode? = null): String + fun resolve(dri: DRI, sourceSets: Set<DisplaySourceSet>, context: PageNode? = null): String fun resolve(node: PageNode, context: PageNode? = null, skipExtension: Boolean = false): String fun resolveRoot(node: PageNode): String fun ancestors(node: PageNode): List<PageNode> diff --git a/plugins/base/src/main/kotlin/resolvers/local/MultimoduleLocationProvider.kt b/plugins/base/src/main/kotlin/resolvers/local/MultimoduleLocationProvider.kt index 3f903bb3..75c2ccf6 100644 --- a/plugins/base/src/main/kotlin/resolvers/local/MultimoduleLocationProvider.kt +++ b/plugins/base/src/main/kotlin/resolvers/local/MultimoduleLocationProvider.kt @@ -1,7 +1,7 @@ package org.jetbrains.dokka.base.resolvers.local import org.jetbrains.dokka.links.DRI -import org.jetbrains.dokka.model.ContentSourceSet +import org.jetbrains.dokka.model.DisplaySourceSet import org.jetbrains.dokka.pages.PageNode import org.jetbrains.dokka.pages.RootPageNode import org.jetbrains.dokka.plugability.DokkaContext @@ -14,7 +14,7 @@ class MultimoduleLocationProvider(private val root: RootPageNode, context: Dokka it.name to it.path }.toMap() - override fun resolve(dri: DRI, sourceSets: Set<ContentSourceSet>, context: PageNode?): String = + override fun resolve(dri: DRI, sourceSets: Set<DisplaySourceSet>, context: PageNode?): String = dri.takeIf { it.packageName == MULTIMODULE_PACKAGE_PLACEHOLDER }?.classNames?.let { paths[it] }?.let { "$it/${identifierToFilename(dri.classNames.orEmpty())}/index.html" } ?: defaultLocationProvider.resolve(dri, sourceSets, context) diff --git a/plugins/base/src/main/kotlin/transformers/pages/comments/DocTagToContentConverter.kt b/plugins/base/src/main/kotlin/transformers/pages/comments/DocTagToContentConverter.kt index f5181f4a..0c88b3c6 100644 --- a/plugins/base/src/main/kotlin/transformers/pages/comments/DocTagToContentConverter.kt +++ b/plugins/base/src/main/kotlin/transformers/pages/comments/DocTagToContentConverter.kt @@ -3,7 +3,7 @@ package org.jetbrains.dokka.base.transformers.pages.comments import org.jetbrains.dokka.DokkaConfiguration.DokkaSourceSet import org.jetbrains.dokka.model.doc.* import org.jetbrains.dokka.model.properties.PropertyContainer -import org.jetbrains.dokka.model.toContentSourceSets +import org.jetbrains.dokka.model.toDisplaySourceSets import org.jetbrains.dokka.pages.* object DocTagToContentConverter : CommentsToContentConverter { @@ -31,7 +31,7 @@ object DocTagToContentConverter : CommentsToContentConverter { buildChildren(docTag), level, dci, - sourceSets.toContentSourceSets(), + sourceSets.toDisplaySourceSets(), styles ) ) @@ -42,7 +42,7 @@ object DocTagToContentConverter : CommentsToContentConverter { buildChildren(docTag), ordered, dci, - sourceSets.toContentSourceSets(), + sourceSets.toDisplaySourceSets(), styles, ((PropertyContainer.empty<ContentNode>()) + SimpleAttr("start", start.toString())) ) @@ -50,7 +50,7 @@ object DocTagToContentConverter : CommentsToContentConverter { fun buildNewLine() = listOf( ContentBreakLine( - sourceSets.toContentSourceSets() + sourceSets.toDisplaySourceSets() ) ) @@ -67,7 +67,7 @@ object DocTagToContentConverter : CommentsToContentConverter { is Ul -> buildList(false) is Ol -> buildList(true, docTag.params["start"]?.toInt() ?: 1) is Li -> listOf( - ContentGroup(buildChildren(docTag), dci, sourceSets.toContentSourceSets(), styles, extra) + ContentGroup(buildChildren(docTag), dci, sourceSets.toDisplaySourceSets(), styles, extra) ) is Br -> buildNewLine() is B -> buildChildren(docTag, setOf(TextStyle.Strong)) @@ -76,7 +76,7 @@ object DocTagToContentConverter : CommentsToContentConverter { ContentGroup( buildChildren(docTag.collapseParagraphs()), dci, - sourceSets.toContentSourceSets(), + sourceSets.toDisplaySourceSets(), styles + setOf(TextStyle.Paragraph), extra ) @@ -86,7 +86,7 @@ object DocTagToContentConverter : CommentsToContentConverter { buildChildren(docTag), docTag.params.getValue("href"), dci, - sourceSets.toContentSourceSets(), + sourceSets.toDisplaySourceSets(), styles ) ) @@ -98,7 +98,7 @@ object DocTagToContentConverter : CommentsToContentConverter { setOf(docTag.dri), ContentKind.Main ), - sourceSets.toContentSourceSets(), + sourceSets.toDisplaySourceSets(), styles ) ) @@ -107,7 +107,7 @@ object DocTagToContentConverter : CommentsToContentConverter { buildChildren(docTag), "", dci, - sourceSets.toContentSourceSets(), + sourceSets.toDisplaySourceSets(), styles ) ) @@ -116,7 +116,7 @@ object DocTagToContentConverter : CommentsToContentConverter { buildChildren(docTag), "", dci, - sourceSets.toContentSourceSets(), + sourceSets.toDisplaySourceSets(), styles ) ) @@ -125,7 +125,7 @@ object DocTagToContentConverter : CommentsToContentConverter { buildChildren(docTag), "", dci, - sourceSets.toContentSourceSets(), + sourceSets.toDisplaySourceSets(), styles ) ) @@ -134,7 +134,7 @@ object DocTagToContentConverter : CommentsToContentConverter { address = docTag.params["href"]!!, altText = docTag.params["alt"], dci = dci, - sourceSets = sourceSets.toContentSourceSets(), + sourceSets = sourceSets.toDisplaySourceSets(), style = styles, extra = extra ) @@ -143,7 +143,7 @@ object DocTagToContentConverter : CommentsToContentConverter { ContentText( "", dci, - sourceSets.toContentSourceSets(), + sourceSets.toDisplaySourceSets(), setOf() ) ) @@ -151,7 +151,7 @@ object DocTagToContentConverter : CommentsToContentConverter { ContentText( docTag.body, dci, - sourceSets.toContentSourceSets(), + sourceSets.toDisplaySourceSets(), styles ) ) @@ -161,7 +161,7 @@ object DocTagToContentConverter : CommentsToContentConverter { buildTableRows(docTag.children.filterIsInstance<Th>(), CommentTable), buildTableRows(docTag.children.filterIsInstance<Tr>(), CommentTable), dci, - sourceSets.toContentSourceSets(), + sourceSets.toDisplaySourceSets(), styles + CommentTable ) ) @@ -169,10 +169,10 @@ object DocTagToContentConverter : CommentsToContentConverter { is Tr -> listOf( ContentGroup( docTag.children.map { - ContentGroup(buildChildren(it), dci, sourceSets.toContentSourceSets(), styles, extra) + ContentGroup(buildChildren(it), dci, sourceSets.toDisplaySourceSets(), styles, extra) }, dci, - sourceSets.toContentSourceSets(), + sourceSets.toDisplaySourceSets(), styles ) ) @@ -180,7 +180,7 @@ object DocTagToContentConverter : CommentsToContentConverter { ContentGroup( buildChildren(docTag, newStyles = styles + ContentStyle.InDocumentationAnchor), dci, - sourceSets.toContentSourceSets(), + sourceSets.toDisplaySourceSets(), styles ) ) diff --git a/plugins/base/src/main/kotlin/transformers/pages/merger/SourceSetMergingPageTransformer.kt b/plugins/base/src/main/kotlin/transformers/pages/merger/SourceSetMergingPageTransformer.kt index ca1a7e3b..61e72abf 100644 --- a/plugins/base/src/main/kotlin/transformers/pages/merger/SourceSetMergingPageTransformer.kt +++ b/plugins/base/src/main/kotlin/transformers/pages/merger/SourceSetMergingPageTransformer.kt @@ -1,15 +1,15 @@ package org.jetbrains.dokka.base.transformers.pages.merger import org.jetbrains.dokka.Platform -import org.jetbrains.dokka.model.ContentSourceSet -import org.jetbrains.dokka.model.toContentSourceSets +import org.jetbrains.dokka.model.DisplaySourceSet +import org.jetbrains.dokka.model.toDisplaySourceSets import org.jetbrains.dokka.pages.* import org.jetbrains.dokka.plugability.DokkaContext import org.jetbrains.dokka.transformers.pages.PageTransformer class SourceSetMergingPageTransformer(context: DokkaContext) : PageTransformer { - private val mergedSourceSets = context.configuration.sourceSets.toContentSourceSets() + private val mergedSourceSets = context.configuration.sourceSets.toDisplaySourceSets() .associateBy { sourceSet -> sourceSet.key } override fun invoke(input: RootPageNode): RootPageNode { @@ -33,6 +33,6 @@ class SourceSetMergingPageTransformer(context: DokkaContext) : PageTransformer { } } -private val ContentSourceSet.key get() = SourceSetMergingKey(displayName, analysisPlatform) +private val DisplaySourceSet.key get() = SourceSetMergingKey(name, platform) private data class SourceSetMergingKey(private val displayName: String, private val platform: Platform) diff --git a/plugins/base/src/main/kotlin/transformers/pages/samples/SamplesTransformer.kt b/plugins/base/src/main/kotlin/transformers/pages/samples/SamplesTransformer.kt index c7202a0b..2099cab5 100644 --- a/plugins/base/src/main/kotlin/transformers/pages/samples/SamplesTransformer.kt +++ b/plugins/base/src/main/kotlin/transformers/pages/samples/SamplesTransformer.kt @@ -9,7 +9,7 @@ import org.jetbrains.dokka.analysis.DokkaResolutionFacade import org.jetbrains.dokka.analysis.EnvironmentAndFacade import org.jetbrains.dokka.base.renderers.sourceSets import org.jetbrains.dokka.links.DRI -import org.jetbrains.dokka.model.ContentSourceSet +import org.jetbrains.dokka.model.DisplaySourceSet import org.jetbrains.dokka.model.doc.Sample import org.jetbrains.dokka.model.properties.PropertyContainer import org.jetbrains.dokka.pages.* @@ -20,7 +20,6 @@ import org.jetbrains.kotlin.name.FqName import org.jetbrains.kotlin.resolve.BindingContext import org.jetbrains.kotlin.resolve.DescriptorToSourceUtils import org.jetbrains.kotlin.utils.PathUtil -import java.io.File abstract class SamplesTransformer(val context: DokkaContext) : PageTransformer { @@ -126,7 +125,7 @@ abstract class SamplesTransformer(val context: DokkaContext) : PageTransformer { } private fun contentCode( - sourceSets: Set<ContentSourceSet>, + sourceSets: Set<DisplaySourceSet>, dri: Set<DRI>, content: String, language: String, diff --git a/plugins/base/src/main/kotlin/transformers/pages/sourcelinks/SourceLinksTransformer.kt b/plugins/base/src/main/kotlin/transformers/pages/sourcelinks/SourceLinksTransformer.kt index f0cf8597..8eb7208b 100644 --- a/plugins/base/src/main/kotlin/transformers/pages/sourcelinks/SourceLinksTransformer.kt +++ b/plugins/base/src/main/kotlin/transformers/pages/sourcelinks/SourceLinksTransformer.kt @@ -9,7 +9,7 @@ import org.jetbrains.dokka.DokkaConfiguration.DokkaSourceSet import org.jetbrains.dokka.analysis.DescriptorDocumentableSource import org.jetbrains.dokka.analysis.PsiDocumentableSource import org.jetbrains.dokka.model.WithExpectActual -import org.jetbrains.dokka.model.toContentSourceSets +import org.jetbrains.dokka.model.toDisplaySourceSets import org.jetbrains.dokka.pages.* import org.jetbrains.dokka.plugability.DokkaContext import org.jetbrains.dokka.transformers.pages.PageTransformer @@ -67,7 +67,7 @@ class SourceLinksTransformer(val context: DokkaContext, val builder: PageContent } }, DCI(node.dri, ContentKind.Source), - node.documentable!!.sourceSets.toContentSourceSets(), + node.documentable!!.sourceSets.toDisplaySourceSets(), style = emptySet(), extra = mainExtra + SimpleAttr.header("Sources") ) diff --git a/plugins/base/src/main/kotlin/translators/documentables/DefaultPageCreator.kt b/plugins/base/src/main/kotlin/translators/documentables/DefaultPageCreator.kt index 04b29990..3f3e157e 100644 --- a/plugins/base/src/main/kotlin/translators/documentables/DefaultPageCreator.kt +++ b/plugins/base/src/main/kotlin/translators/documentables/DefaultPageCreator.kt @@ -159,7 +159,7 @@ open class DefaultPageCreator( } }, DCI(setOf(dri), ContentKind.Inheritors), - sourceSets.toContentSourceSets(), + sourceSets.toDisplaySourceSets(), style = emptySet(), extra = mainExtra + SimpleAttr.header("Inheritors") ) diff --git a/plugins/base/src/main/kotlin/translators/documentables/PageContentBuilder.kt b/plugins/base/src/main/kotlin/translators/documentables/PageContentBuilder.kt index 9d4f6a9e..a1f3c002 100644 --- a/plugins/base/src/main/kotlin/translators/documentables/PageContentBuilder.kt +++ b/plugins/base/src/main/kotlin/translators/documentables/PageContentBuilder.kt @@ -9,7 +9,7 @@ import org.jetbrains.dokka.model.Documentable import org.jetbrains.dokka.model.SourceSetDependent import org.jetbrains.dokka.model.doc.DocTag import org.jetbrains.dokka.model.properties.PropertyContainer -import org.jetbrains.dokka.model.toContentSourceSets +import org.jetbrains.dokka.model.toDisplaySourceSets import org.jetbrains.dokka.pages.* import org.jetbrains.dokka.utilities.DokkaLogger @@ -74,7 +74,7 @@ open class PageContentBuilder( ) = ContentGroup( contents.toList(), DCI(mainDRI, kind), - sourceSets.toContentSourceSets(), + sourceSets.toDisplaySourceSets(), styles, extra ) @@ -154,7 +154,7 @@ open class PageContentBuilder( defaultHeaders, operation(), DCI(mainDRI, kind), - sourceSets.toContentSourceSets(), styles, extra + sourceSets.toDisplaySourceSets(), styles, extra ) } @@ -189,7 +189,7 @@ open class PageContentBuilder( } }, DCI(mainDRI, kind), - sourceSets.toContentSourceSets(), styles, extra + sourceSets.toDisplaySourceSets(), styles, extra ) } } @@ -235,7 +235,7 @@ open class PageContentBuilder( listOf(createText(text, kind, sourceSets, styles, extra)), address, DCI(mainDRI, kind), - sourceSets.toContentSourceSets() + sourceSets.toDisplaySourceSets() ) fun link( @@ -251,7 +251,7 @@ open class PageContentBuilder( address = address, extra = PropertyContainer.empty(), dci = DCI(mainDRI, kind), - sourceSets = sourceSets.toContentSourceSets(), + sourceSets = sourceSets.toDisplaySourceSets(), style = emptySet() ) } @@ -268,7 +268,7 @@ open class PageContentBuilder( contentFor(mainDRI, sourceSets, kind, styles, extra, block).children, address, DCI(mainDRI, kind), - sourceSets.toContentSourceSets() + sourceSets.toDisplaySourceSets() ) } @@ -284,7 +284,7 @@ open class PageContentBuilder( DCI(mainDRI, kind), sourceSets ) - contents += ContentGroup(content, DCI(mainDRI, kind), sourceSets.toContentSourceSets(), styles, extra) + contents += ContentGroup(content, DCI(mainDRI, kind), sourceSets.toDisplaySourceSets(), styles, extra) } fun group( @@ -332,7 +332,7 @@ open class PageContentBuilder( ) { contents += PlatformHintedContent( buildGroup(dri, sourceSets, kind, styles, extra, block), - sourceSets.toContentSourceSets() + sourceSets.toDisplaySourceSets() ) } @@ -346,7 +346,7 @@ open class PageContentBuilder( ) { contents += PlatformHintedContent( buildGroup(setOf(dri), sourcesetData, kind, styles, extra, block), - sourcesetData.toContentSourceSets() + sourcesetData.toDisplaySourceSets() ) } @@ -357,7 +357,7 @@ open class PageContentBuilder( styles: Set<Style>, extra: PropertyContainer<ContentNode> ) = - ContentText(text, DCI(mainDRI, kind), sourceSets.toContentSourceSets(), styles, extra) + ContentText(text, DCI(mainDRI, kind), sourceSets.toDisplaySourceSets(), styles, extra) fun <T> sourceSetDependentText( value: SourceSetDependent<T>, @@ -467,7 +467,7 @@ open class PageContentBuilder( divergent ?: throw IllegalStateException("Divergent block needs divergent part"), after, DCI(mainDRI, kind), - sourceSets.toContentSourceSets(), + sourceSets.toDisplaySourceSets(), styles, extra ) diff --git a/plugins/gfm/src/main/kotlin/GfmPlugin.kt b/plugins/gfm/src/main/kotlin/GfmPlugin.kt index 8ae4a78a..b565deb5 100644 --- a/plugins/gfm/src/main/kotlin/GfmPlugin.kt +++ b/plugins/gfm/src/main/kotlin/GfmPlugin.kt @@ -7,7 +7,7 @@ import org.jetbrains.dokka.base.renderers.PackageListCreator import org.jetbrains.dokka.base.renderers.RootCreator import org.jetbrains.dokka.base.resolvers.local.DefaultLocationProvider import org.jetbrains.dokka.base.resolvers.local.LocationProviderFactory -import org.jetbrains.dokka.model.ContentSourceSet +import org.jetbrains.dokka.model.DisplaySourceSet import org.jetbrains.dokka.pages.* import org.jetbrains.dokka.plugability.DokkaContext import org.jetbrains.dokka.plugability.DokkaPlugin @@ -85,7 +85,7 @@ open class CommonmarkRenderer( override fun StringBuilder.buildList( node: ContentList, pageContext: ContentPage, - sourceSetRestriction: Set<ContentSourceSet>? + sourceSetRestriction: Set<DisplaySourceSet>? ) { buildListLevel(node, pageContext) } @@ -125,14 +125,14 @@ open class CommonmarkRenderer( override fun StringBuilder.buildPlatformDependent( content: PlatformHintedContent, pageContext: ContentPage, - sourceSetRestriction: Set<ContentSourceSet>? + sourceSetRestriction: Set<DisplaySourceSet>? ) { buildPlatformDependentItem(content.inner, content.sourceSets, pageContext) } private fun StringBuilder.buildPlatformDependentItem( content: ContentNode, - sourceSets: Set<ContentSourceSet>, + sourceSets: Set<DisplaySourceSet>, pageContext: ContentPage, ) { if (content is ContentGroup && content.children.firstOrNull { it is ContentTable } != null) { @@ -140,7 +140,7 @@ open class CommonmarkRenderer( } else { val distinct = sourceSets.map { it to buildString { buildContentNode(content, pageContext, setOf(it)) } - }.groupBy(Pair<ContentSourceSet, String>::second, Pair<ContentSourceSet, String>::first) + }.groupBy(Pair<DisplaySourceSet, String>::second, Pair<DisplaySourceSet, String>::first) distinct.filter { it.key.isNotBlank() }.forEach { (text, platforms) -> append(" ") @@ -158,12 +158,12 @@ open class CommonmarkRenderer( override fun StringBuilder.buildTable( node: ContentTable, pageContext: ContentPage, - sourceSetRestriction: Set<ContentSourceSet>? + sourceSetRestriction: Set<DisplaySourceSet>? ) { buildNewLine() if (node.dci.kind == ContentKind.Sample || node.dci.kind == ContentKind.Parameters) { node.sourceSets.forEach { sourcesetData -> - append(sourcesetData.displayName) + append(sourcesetData.name) buildNewLine() buildTable( node.copy( @@ -340,11 +340,11 @@ open class CommonmarkRenderer( private fun String.withEntersAsHtml(): String = replace("\n", "<br>") - private fun List<Pair<ContentDivergentInstance, ContentSourceSet>>.getInstanceAndSourceSets() = + private fun List<Pair<ContentDivergentInstance, DisplaySourceSet>>.getInstanceAndSourceSets() = this.let { Pair(it.first().first, it.map { it.second }.toSet()) } - private fun StringBuilder.buildSourceSetTags(sourceSets: Set<ContentSourceSet>) = - append(sourceSets.joinToString(prefix = "[", postfix = "]") { it.displayName }) + private fun StringBuilder.buildSourceSetTags(sourceSets: Set<DisplaySourceSet>) = + append(sourceSets.joinToString(prefix = "[", postfix = "]") { it.name }) } class MarkdownLocationProviderFactory(val context: DokkaContext) : LocationProviderFactory { diff --git a/plugins/javadoc/src/main/kotlin/org/jetbrains/dokka/javadoc/JavadocPageCreator.kt b/plugins/javadoc/src/main/kotlin/org/jetbrains/dokka/javadoc/JavadocPageCreator.kt index a72544e2..20fe9831 100644 --- a/plugins/javadoc/src/main/kotlin/org/jetbrains/dokka/javadoc/JavadocPageCreator.kt +++ b/plugins/javadoc/src/main/kotlin/org/jetbrains/dokka/javadoc/JavadocPageCreator.kt @@ -75,7 +75,7 @@ open class JavadocPageCreator( JavadocContentGroup( setOf(m.dri), JavadocContentKind.OverviewSummary, - m.jvmSourceSets.toContentSourceSets() + m.jvmSourceSets.toDisplaySourceSets() ) { title(m.name, m.brief(), "0.0.1", dri = setOf(m.dri), kind = ContentKind.Main) leafList(setOf(m.dri), @@ -94,7 +94,7 @@ open class JavadocPageCreator( JavadocContentGroup( setOf(p.dri), JavadocContentKind.PackageSummary, - p.jvmSourceSets.toContentSourceSets() + p.jvmSourceSets.toDisplaySourceSets() ) { title(p.name, p.brief(), "0.0.1", dri = setOf(p.dri), kind = ContentKind.Packages) val rootList = p.classlikes.groupBy { it::class }.map { (key, value) -> @@ -125,7 +125,7 @@ open class JavadocPageCreator( JavadocContentGroup( setOf(c.dri), JavadocContentKind.Class, - c.jvmSourceSets.toContentSourceSets() + c.jvmSourceSets.toDisplaySourceSets() ) { title( c.name.orEmpty(), @@ -235,7 +235,7 @@ open class JavadocPageCreator( sourceSets.toSet() ), dci = DCI(setOf(dri), JavadocContentKind.OverviewSummary), - sourceSets = sourceSets.toContentSourceSets(), + sourceSets = sourceSets.toDisplaySourceSets(), style = emptySet(), extra = PropertyContainer.empty() ) 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 40e4fa30..d99a571f 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 @@ -7,7 +7,7 @@ import org.jetbrains.dokka.links.Nullable import org.jetbrains.dokka.links.parent import org.jetbrains.dokka.model.* import org.jetbrains.dokka.pages.ContentPage -import org.jetbrains.dokka.model.ContentSourceSet +import org.jetbrains.dokka.model.DisplaySourceSet import org.jetbrains.dokka.pages.PageNode import org.jetbrains.dokka.pages.RootPageNode import org.jetbrains.dokka.plugability.DokkaContext @@ -64,7 +64,7 @@ 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<ContentSourceSet>, context: PageNode?): String { + override fun resolve(dri: DRI, sourceSets: Set<DisplaySourceSet>, context: PageNode?): String { return nodeIndex[dri]?.let { resolve(it, context) } ?: nodeIndex[dri.parent]?.takeIf { it is JavadocClasslikePageNode }?.let { val anchor = when (val anchorElement = (it as? JavadocClasslikePageNode)?.findAnchorableByDRI(dri)) { diff --git a/plugins/javadoc/src/main/kotlin/org/jetbrains/dokka/javadoc/pages/JavadocContentNodes.kt b/plugins/javadoc/src/main/kotlin/org/jetbrains/dokka/javadoc/pages/JavadocContentNodes.kt index 870d02f6..d1ccb73e 100644 --- a/plugins/javadoc/src/main/kotlin/org/jetbrains/dokka/javadoc/pages/JavadocContentNodes.kt +++ b/plugins/javadoc/src/main/kotlin/org/jetbrains/dokka/javadoc/pages/JavadocContentNodes.kt @@ -1,7 +1,7 @@ package org.jetbrains.dokka.javadoc.pages import org.jetbrains.dokka.links.DRI -import org.jetbrains.dokka.model.ContentSourceSet +import org.jetbrains.dokka.model.DisplaySourceSet import org.jetbrains.dokka.model.properties.PropertyContainer import org.jetbrains.dokka.pages.* @@ -12,7 +12,7 @@ enum class JavadocContentKind : Kind { abstract class JavadocContentNode( dri: Set<DRI>, kind: Kind, - override val sourceSets: Set<ContentSourceSet> + override val sourceSets: Set<DisplaySourceSet> ) : ContentNode { override val dci: DCI = DCI(dri, kind) override val style: Set<Style> = emptySet() @@ -33,7 +33,7 @@ interface JavadocListEntry { data class EmptyNode( val dri: DRI, val kind: Kind, - override val sourceSets: Set<ContentSourceSet>, + override val sourceSets: Set<DisplaySourceSet>, override val extra: PropertyContainer<ContentNode> = PropertyContainer.empty() ) : ContentNode { override val dci: DCI = DCI(setOf(dri), kind) @@ -41,7 +41,7 @@ data class EmptyNode( override fun withNewExtras(newExtras: PropertyContainer<ContentNode>): EmptyNode = copy(extra = newExtras) - override fun withSourceSets(sourceSets: Set<ContentSourceSet>): EmptyNode = + override fun withSourceSets(sourceSets: Set<DisplaySourceSet>): EmptyNode = copy(sourceSets = sourceSets) override fun hasAnyContent(): Boolean = false @@ -50,7 +50,7 @@ data class EmptyNode( data class JavadocContentGroup( val dri: Set<DRI>, val kind: Kind, - override val sourceSets: Set<ContentSourceSet>, + override val sourceSets: Set<DisplaySourceSet>, override val children: List<JavadocContentNode> ) : JavadocContentNode(dri, kind, sourceSets) { @@ -58,7 +58,7 @@ data class JavadocContentGroup( operator fun invoke( dri: Set<DRI>, kind: Kind, - sourceSets: Set<ContentSourceSet>, + sourceSets: Set<DisplaySourceSet>, block: JavaContentGroupBuilder.() -> Unit ): JavadocContentGroup = JavadocContentGroup(dri, kind, sourceSets, JavaContentGroupBuilder(sourceSets).apply(block).list) @@ -68,11 +68,11 @@ data class JavadocContentGroup( override fun withNewExtras(newExtras: PropertyContainer<ContentNode>): JavadocContentGroup = this - override fun withSourceSets(sourceSets: Set<ContentSourceSet>): JavadocContentGroup = + override fun withSourceSets(sourceSets: Set<DisplaySourceSet>): JavadocContentGroup = copy(sourceSets = sourceSets) } -class JavaContentGroupBuilder(val sourceSets: Set<ContentSourceSet>) { +class JavaContentGroupBuilder(val sourceSets: Set<DisplaySourceSet>) { val list = mutableListOf<JavadocContentNode>() } @@ -83,13 +83,13 @@ data class TitleNode( val parent: String?, val dri: Set<DRI>, val kind: Kind, - override val sourceSets: Set<ContentSourceSet> + override val sourceSets: Set<DisplaySourceSet> ) : JavadocContentNode(dri, kind, sourceSets) { override fun hasAnyContent(): Boolean = !title.isBlank() || !version.isBlank() || subtitle.isNotEmpty() override fun withNewExtras(newExtras: PropertyContainer<ContentNode>): TitleNode = this - override fun withSourceSets(sourceSets: Set<ContentSourceSet>): TitleNode = + override fun withSourceSets(sourceSets: Set<DisplaySourceSet>): TitleNode = copy(sourceSets = sourceSets) } @@ -108,12 +108,12 @@ data class RootListNode( val entries: List<LeafListNode>, val dri: Set<DRI>, val kind: Kind, - override val sourceSets: Set<ContentSourceSet>, + override val sourceSets: Set<DisplaySourceSet>, ) : JavadocContentNode(dri, kind, sourceSets) { override fun hasAnyContent(): Boolean = children.isNotEmpty() - override fun withSourceSets(sourceSets: Set<ContentSourceSet>): RootListNode = + override fun withSourceSets(sourceSets: Set<DisplaySourceSet>): RootListNode = copy(sourceSets = sourceSets) } @@ -123,11 +123,11 @@ data class LeafListNode( val entries: List<JavadocListEntry>, val dri: Set<DRI>, val kind: Kind, - override val sourceSets: Set<ContentSourceSet> + override val sourceSets: Set<DisplaySourceSet> ) : JavadocContentNode(dri, kind, sourceSets) { override fun hasAnyContent(): Boolean = children.isNotEmpty() - override fun withSourceSets(sourceSets: Set<ContentSourceSet>): LeafListNode = copy(sourceSets = sourceSets) + override fun withSourceSets(sourceSets: Set<DisplaySourceSet>): LeafListNode = copy(sourceSets = sourceSets) } @@ -160,7 +160,7 @@ class LinkJavadocListEntry( val name: String, val dri: Set<DRI>, val kind: Kind = ContentKind.Symbol, - val sourceSets: Set<ContentSourceSet> + val sourceSets: Set<DisplaySourceSet> ) : JavadocListEntry { override val stringTag: String @@ -170,7 +170,7 @@ class LinkJavadocListEntry( private var builtString: String? = null - fun build(body: (String, Set<DRI>, Kind, List<ContentSourceSet>) -> String) { + fun build(body: (String, Set<DRI>, Kind, List<DisplaySourceSet>) -> String) { builtString = body(name, dri, kind, sourceSets.toList()) } } @@ -189,7 +189,7 @@ data class JavadocSignatureContentNode( ) : JavadocContentNode(setOf(dri), kind, signatureWithoutModifiers.sourceSets) { override fun hasAnyContent(): Boolean = true - override fun withSourceSets(sourceSets: Set<ContentSourceSet>): JavadocSignatureContentNode { + override fun withSourceSets(sourceSets: Set<DisplaySourceSet>): JavadocSignatureContentNode { return copy(signatureWithoutModifiers = signatureWithoutModifiers.withSourceSets(sourceSets)) } } diff --git a/plugins/javadoc/src/main/kotlin/org/jetbrains/dokka/javadoc/renderer/SearchScriptsCreator.kt b/plugins/javadoc/src/main/kotlin/org/jetbrains/dokka/javadoc/renderer/SearchScriptsCreator.kt index 3c6bd2ae..cc1995eb 100644 --- a/plugins/javadoc/src/main/kotlin/org/jetbrains/dokka/javadoc/renderer/SearchScriptsCreator.kt +++ b/plugins/javadoc/src/main/kotlin/org/jetbrains/dokka/javadoc/renderer/SearchScriptsCreator.kt @@ -5,7 +5,7 @@ import org.jetbrains.dokka.javadoc.pages.* import org.jetbrains.dokka.javadoc.renderer.SearchRecord.Companion.allTypes import org.jetbrains.dokka.base.renderers.sourceSets import org.jetbrains.dokka.links.DRI -import org.jetbrains.dokka.model.ContentSourceSet +import org.jetbrains.dokka.model.DisplaySourceSet import org.jetbrains.dokka.model.Documentable import org.jetbrains.dokka.pages.* import org.jetbrains.dokka.utilities.formatToEndWithHtml @@ -182,7 +182,7 @@ class SearchScriptsCreator(private val locationProvider: JavadocLocationProvider private fun resolveUrlForSearchIndex( dri: DRI, - sourceSets: Set<ContentSourceSet>, + sourceSets: Set<DisplaySourceSet>, label: String ): String = locationProvider.resolve(dri, sourceSets).formatToEndWithHtml() + "#" + label |