diff options
| author | sebastian.sellmair <sebastian.sellmair@jetbrains.com> | 2020-08-17 10:49:41 +0200 |
|---|---|---|
| committer | Sebastian Sellmair <34319766+sellmair@users.noreply.github.com> | 2020-08-17 11:52:28 +0200 |
| commit | ef1bb10aca292e14d8deb35694243fd84fc75341 (patch) | |
| tree | 2aae938883e6c8d1b35948d2da947b0af955bd54 | |
| parent | a2be91ea289ddb1a8634c5fd252243f1b9ab7000 (diff) | |
| download | dokka-ef1bb10aca292e14d8deb35694243fd84fc75341.tar.gz dokka-ef1bb10aca292e14d8deb35694243fd84fc75341.tar.bz2 dokka-ef1bb10aca292e14d8deb35694243fd84fc75341.zip | |
Rename `ContentSourceSet` to `DisplaySourceSet`
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/ |
