aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorsebastian.sellmair <sebastian.sellmair@jetbrains.com>2020-08-13 09:59:39 +0200
committerSebastian Sellmair <34319766+sellmair@users.noreply.github.com>2020-08-17 11:52:28 +0200
commitf6ac2b0f0a0183171aa2f6806ec67d8d21692a36 (patch)
treea912d7ba4d7d368b9a3683a6cf290ca135ee231a
parent86fcfb73d2d5124ae7748a80db29bdbb68607be4 (diff)
downloaddokka-f6ac2b0f0a0183171aa2f6806ec67d8d21692a36.tar.gz
dokka-f6ac2b0f0a0183171aa2f6806ec67d8d21692a36.tar.bz2
dokka-f6ac2b0f0a0183171aa2f6806ec67d8d21692a36.zip
Implement `ContentSourceSet`
-rw-r--r--core/src/main/kotlin/model/Documentable.kt1
-rw-r--r--core/src/main/kotlin/pages/ContentNodes.kt45
-rw-r--r--core/src/main/kotlin/pages/ContentSourceSet.kt61
-rw-r--r--core/src/main/kotlin/pages/PageNodes.kt15
-rw-r--r--core/src/main/kotlin/transformers/documentation/DocumentableTransformer.kt3
-rw-r--r--core/src/main/kotlin/transformers/pages/PageTransformer.kt14
-rw-r--r--core/src/test/kotlin/model/CompositeSourceSetIDTest.kt58
-rw-r--r--core/src/test/kotlin/model/ContentSourceSetTest.kt61
-rw-r--r--plugins/base/src/main/kotlin/renderers/DefaultRenderer.kt25
-rw-r--r--plugins/base/src/main/kotlin/renderers/html/HtmlRenderer.kt58
-rw-r--r--plugins/base/src/main/kotlin/renderers/html/NavigationPage.kt4
-rw-r--r--plugins/base/src/main/kotlin/resolvers/local/BaseLocationProvider.kt9
-rw-r--r--plugins/base/src/main/kotlin/resolvers/local/DefaultLocationProvider.kt3
-rw-r--r--plugins/base/src/main/kotlin/resolvers/local/LocationProvider.kt4
-rw-r--r--plugins/base/src/main/kotlin/resolvers/local/MultimoduleLocationProvider.kt4
-rw-r--r--plugins/base/src/main/kotlin/transformers/pages/comments/DocTagToContentConverter.kt42
-rw-r--r--plugins/base/src/main/kotlin/transformers/pages/samples/SamplesTransformer.kt2
-rw-r--r--plugins/base/src/main/kotlin/transformers/pages/sourcelinks/SourceLinksTransformer.kt2
-rw-r--r--plugins/base/src/main/kotlin/translators/documentables/DefaultPageCreator.kt2
-rw-r--r--plugins/base/src/main/kotlin/translators/documentables/PageContentBuilder.kt28
-rw-r--r--plugins/gfm/src/main/kotlin/GfmPlugin.kt47
-rw-r--r--plugins/javadoc/src/main/kotlin/org/jetbrains/dokka/javadoc/JavadocPageCreator.kt15
-rw-r--r--plugins/javadoc/src/main/kotlin/org/jetbrains/dokka/javadoc/location/JavadocLocationProvider.kt4
-rw-r--r--plugins/javadoc/src/main/kotlin/org/jetbrains/dokka/javadoc/pages/JavadocContentNodes.kt23
-rw-r--r--plugins/javadoc/src/main/kotlin/org/jetbrains/dokka/javadoc/renderer/KorteJavadocRenderer.kt2
-rw-r--r--plugins/javadoc/src/main/kotlin/org/jetbrains/dokka/javadoc/renderer/SearchScriptsCreator.kt57
26 files changed, 414 insertions, 175 deletions
diff --git a/core/src/main/kotlin/model/Documentable.kt b/core/src/main/kotlin/model/Documentable.kt
index 3f91e3cb..33c29ea3 100644
--- a/core/src/main/kotlin/model/Documentable.kt
+++ b/core/src/main/kotlin/model/Documentable.kt
@@ -14,6 +14,7 @@ abstract class Documentable : WithChildren<Documentable> {
abstract val documentation: SourceSetDependent<DocumentationNode>
abstract val sourceSets: Set<DokkaSourceSet>
abstract val expectPresentInSet: DokkaSourceSet?
+ abstract override val children: List<Documentable>
override fun toString(): String =
"${javaClass.simpleName}($dri)"
diff --git a/core/src/main/kotlin/pages/ContentNodes.kt b/core/src/main/kotlin/pages/ContentNodes.kt
index 5129dfcf..b82c023f 100644
--- a/core/src/main/kotlin/pages/ContentNodes.kt
+++ b/core/src/main/kotlin/pages/ContentNodes.kt
@@ -1,6 +1,8 @@
package org.jetbrains.dokka.pages
import org.jetbrains.dokka.DokkaConfiguration.DokkaSourceSet
+import org.jetbrains.dokka.DokkaSourceSetID
+import org.jetbrains.dokka.Platform
import org.jetbrains.dokka.links.DRI
import org.jetbrains.dokka.model.WithChildren
import org.jetbrains.dokka.model.properties.PropertyContainer
@@ -10,9 +12,10 @@ data class DCI(val dri: Set<DRI>, val kind: Kind) {
override fun toString() = "$dri[$kind]"
}
+
interface ContentNode : WithExtraProperties<ContentNode>, WithChildren<ContentNode> {
val dci: DCI
- val sourceSets: Set<DokkaSourceSet>
+ val sourceSets: Set<ContentSourceSet>
val style: Set<Style>
fun hasAnyContent(): Boolean
@@ -25,7 +28,7 @@ interface ContentNode : WithExtraProperties<ContentNode>, WithChildren<ContentNo
data class ContentText(
val text: String,
override val dci: DCI,
- override val sourceSets: Set<DokkaSourceSet>,
+ override val sourceSets: Set<ContentSourceSet>,
override val style: Set<Style> = emptySet(),
override val extra: PropertyContainer<ContentNode> = PropertyContainer.empty()
) : ContentNode {
@@ -36,7 +39,7 @@ data class ContentText(
// TODO: Remove
data class ContentBreakLine(
- override val sourceSets: Set<DokkaSourceSet>,
+ override val sourceSets: Set<ContentSourceSet>,
override val dci: DCI = DCI(emptySet(), ContentKind.Empty),
override val style: Set<Style> = emptySet(),
override val extra: PropertyContainer<ContentNode> = PropertyContainer.empty()
@@ -51,7 +54,7 @@ data class ContentHeader(
override val children: List<ContentNode>,
val level: Int,
override val dci: DCI,
- override val sourceSets: Set<DokkaSourceSet>,
+ override val sourceSets: Set<ContentSourceSet>,
override val style: Set<Style>,
override val extra: PropertyContainer<ContentNode> = PropertyContainer.empty()
) : ContentComposite {
@@ -67,7 +70,7 @@ data class ContentCodeBlock(
override val children: List<ContentNode>,
val language: String,
override val dci: DCI,
- override val sourceSets: Set<DokkaSourceSet>,
+ override val sourceSets: Set<ContentSourceSet>,
override val style: Set<Style>,
override val extra: PropertyContainer<ContentNode> = PropertyContainer.empty()
) : ContentCode {
@@ -78,7 +81,7 @@ data class ContentCodeInline(
override val children: List<ContentNode>,
val language: String,
override val dci: DCI,
- override val sourceSets: Set<DokkaSourceSet>,
+ override val sourceSets: Set<ContentSourceSet>,
override val style: Set<Style>,
override val extra: PropertyContainer<ContentNode> = PropertyContainer.empty()
) : ContentCode {
@@ -93,7 +96,7 @@ data class ContentDRILink(
override val children: List<ContentNode>,
val address: DRI,
override val dci: DCI,
- override val sourceSets: Set<DokkaSourceSet>,
+ override val sourceSets: Set<ContentSourceSet>,
override val style: Set<Style> = emptySet(),
override val extra: PropertyContainer<ContentNode> = PropertyContainer.empty()
) : ContentLink {
@@ -105,7 +108,7 @@ data class ContentResolvedLink(
override val children: List<ContentNode>,
val address: String,
override val dci: DCI,
- override val sourceSets: Set<DokkaSourceSet>,
+ override val sourceSets: Set<ContentSourceSet>,
override val style: Set<Style> = emptySet(),
override val extra: PropertyContainer<ContentNode> = PropertyContainer.empty()
) : ContentLink {
@@ -119,7 +122,7 @@ data class ContentEmbeddedResource(
val address: String,
val altText: String?,
override val dci: DCI,
- override val sourceSets: Set<DokkaSourceSet>,
+ override val sourceSets: Set<ContentSourceSet>,
override val style: Set<Style> = emptySet(),
override val extra: PropertyContainer<ContentNode> = PropertyContainer.empty()
) : ContentLink {
@@ -139,7 +142,7 @@ data class ContentTable(
val header: List<ContentGroup>,
override val children: List<ContentGroup>,
override val dci: DCI,
- override val sourceSets: Set<DokkaSourceSet>,
+ override val sourceSets: Set<ContentSourceSet>,
override val style: Set<Style>,
override val extra: PropertyContainer<ContentNode> = PropertyContainer.empty()
) : ContentComposite {
@@ -151,7 +154,7 @@ data class ContentList(
override val children: List<ContentNode>,
val ordered: Boolean,
override val dci: DCI,
- override val sourceSets: Set<DokkaSourceSet>,
+ override val sourceSets: Set<ContentSourceSet>,
override val style: Set<Style>,
override val extra: PropertyContainer<ContentNode> = PropertyContainer.empty()
) : ContentComposite {
@@ -162,7 +165,7 @@ data class ContentList(
data class ContentGroup(
override val children: List<ContentNode>,
override val dci: DCI,
- override val sourceSets: Set<DokkaSourceSet>,
+ override val sourceSets: Set<ContentSourceSet>,
override val style: Set<Style>,
override val extra: PropertyContainer<ContentNode> = PropertyContainer.empty()
) : ContentComposite {
@@ -182,7 +185,7 @@ data class ContentDivergentGroup(
) : ContentComposite {
data class GroupID(val name: String)
- override val sourceSets: Set<DokkaSourceSet>
+ override val sourceSets: Set<ContentSourceSet>
get() = children.flatMap { it.sourceSets }.distinct().toSet()
override fun withNewExtras(newExtras: PropertyContainer<ContentNode>): ContentDivergentGroup =
@@ -195,7 +198,7 @@ data class ContentDivergentInstance(
val divergent: ContentNode,
val after: ContentNode?,
override val dci: DCI,
- override val sourceSets: Set<DokkaSourceSet>,
+ override val sourceSets: Set<ContentSourceSet>,
override val style: Set<Style>,
override val extra: PropertyContainer<ContentNode> = PropertyContainer.empty()
) : ContentComposite {
@@ -208,7 +211,7 @@ data class ContentDivergentInstance(
data class PlatformHintedContent(
val inner: ContentNode,
- override val sourceSets: Set<DokkaSourceSet>
+ override val sourceSets: Set<ContentSourceSet>
) : ContentComposite {
override val children = listOf(inner)
@@ -235,7 +238,17 @@ enum class ContentKind : Kind {
companion object {
private val platformTagged =
- setOf(Constructors, Functions, Properties, Classlikes, Packages, Source, TypeAliases, Inheritors, Extensions)
+ setOf(
+ Constructors,
+ Functions,
+ Properties,
+ Classlikes,
+ Packages,
+ Source,
+ TypeAliases,
+ Inheritors,
+ Extensions
+ )
fun shouldBePlatformTagged(kind: Kind): Boolean = kind in platformTagged
}
diff --git a/core/src/main/kotlin/pages/ContentSourceSet.kt b/core/src/main/kotlin/pages/ContentSourceSet.kt
new file mode 100644
index 00000000..0ff87edb
--- /dev/null
+++ b/core/src/main/kotlin/pages/ContentSourceSet.kt
@@ -0,0 +1,61 @@
+package org.jetbrains.dokka.pages
+
+import org.jetbrains.dokka.DokkaConfiguration.DokkaSourceSet
+import org.jetbrains.dokka.DokkaSourceSetID
+import org.jetbrains.dokka.Platform
+
+
+data class ContentSourceSet(
+ val sourceSetIDs: CompositeSourceSetID,
+ val displayName: String,
+ val analysisPlatform: Platform
+) {
+ constructor(sourceSet: DokkaSourceSet) : this(
+ sourceSetIDs = CompositeSourceSetID(sourceSet.sourceSetID),
+ displayName = sourceSet.displayName,
+ analysisPlatform = sourceSet.analysisPlatform
+ )
+
+ operator fun contains(sourceSetID: DokkaSourceSetID): Boolean {
+ return sourceSetID in sourceSetIDs
+ }
+
+ operator fun contains(sourceSet: DokkaSourceSet): Boolean {
+ return sourceSet.sourceSetID in this
+ }
+}
+
+
+//TODO NOW: Test
+data class CompositeSourceSetID(
+ private val children: Set<DokkaSourceSetID>
+) {
+ constructor(sourceSetIDs: Iterable<DokkaSourceSetID>) : this(sourceSetIDs.toSet())
+ constructor(sourceSetId: DokkaSourceSetID) : this(setOf(sourceSetId))
+
+ init {
+ require(children.isNotEmpty()) { "Expected at least one source set id" }
+ }
+
+ val merged = DokkaSourceSetID(
+ moduleName = children.map { it.moduleName }.reduce { acc, s -> "$acc+$s" },
+ sourceSetName = children.map { it.sourceSetName }.reduce { acc, s -> "$acc+$s" }
+ )
+
+ val all: List<DokkaSourceSetID> = listOf(merged, *children.toTypedArray())
+
+ operator fun contains(sourceSetId: DokkaSourceSetID): Boolean {
+ return sourceSetId in all
+ }
+
+ operator fun contains(sourceSet: DokkaSourceSet): Boolean {
+ return sourceSet.sourceSetID in this
+ }
+}
+
+
+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/pages/PageNodes.kt b/core/src/main/kotlin/pages/PageNodes.kt
index 71ec8597..d49f9911 100644
--- a/core/src/main/kotlin/pages/PageNodes.kt
+++ b/core/src/main/kotlin/pages/PageNodes.kt
@@ -5,8 +5,9 @@ import org.jetbrains.dokka.model.Documentable
import org.jetbrains.dokka.model.WithChildren
import java.util.*
-interface PageNode: WithChildren<PageNode> {
+interface PageNode : WithChildren<PageNode> {
val name: String
+ override val children: List<PageNode>
fun modified(
name: String = this.name,
@@ -14,7 +15,7 @@ interface PageNode: WithChildren<PageNode> {
): PageNode
}
-interface ContentPage: PageNode {
+interface ContentPage : PageNode {
val content: ContentNode
val dri: Set<DRI>
val documentable: Documentable?
@@ -29,11 +30,11 @@ interface ContentPage: PageNode {
): ContentPage
}
-abstract class RootPageNode: PageNode {
+abstract class RootPageNode : PageNode {
val parentMap: Map<PageNode, PageNode> by lazy {
IdentityHashMap<PageNode, PageNode>().apply {
fun process(parent: PageNode) {
- parent.children.forEach { child ->
+ parent.children.forEach { child ->
put(child, parent)
process(child)
}
@@ -171,11 +172,11 @@ class MultimoduleRootPageNode(
embeddedResources: List<String>,
children: List<PageNode>
) =
- if (name == this.name && content === this.content && embeddedResources === this.embeddedResources && children shallowEq this.children) this
- else MultimoduleRootPageNode(name, dri, content, embeddedResources)
+ if (name == this.name && content === this.content && embeddedResources === this.embeddedResources && children shallowEq this.children) this
+ else MultimoduleRootPageNode(name, dri, content, embeddedResources)
}
-inline fun <reified T: PageNode> PageNode.children() = children.filterIsInstance<T>()
+inline fun <reified T : PageNode> PageNode.children() = children.filterIsInstance<T>()
private infix fun <T> List<T>.shallowEq(other: List<T>) =
this === other || (this.size == other.size && (this zip other).all { (a, b) -> a === b })
diff --git a/core/src/main/kotlin/transformers/documentation/DocumentableTransformer.kt b/core/src/main/kotlin/transformers/documentation/DocumentableTransformer.kt
index 3eb4704e..d0570c7a 100644
--- a/core/src/main/kotlin/transformers/documentation/DocumentableTransformer.kt
+++ b/core/src/main/kotlin/transformers/documentation/DocumentableTransformer.kt
@@ -1,8 +1,9 @@
package org.jetbrains.dokka.transformers.documentation
import org.jetbrains.dokka.model.DModule
+import org.jetbrains.dokka.model.Documentable
import org.jetbrains.dokka.plugability.DokkaContext
interface DocumentableTransformer {
operator fun invoke(original: DModule, context: DokkaContext): DModule
-} \ No newline at end of file
+}
diff --git a/core/src/main/kotlin/transformers/pages/PageTransformer.kt b/core/src/main/kotlin/transformers/pages/PageTransformer.kt
index 218d9821..086f6d22 100644
--- a/core/src/main/kotlin/transformers/pages/PageTransformer.kt
+++ b/core/src/main/kotlin/transformers/pages/PageTransformer.kt
@@ -1,7 +1,19 @@
package org.jetbrains.dokka.transformers.pages
+import org.jetbrains.dokka.pages.ContentNode
import org.jetbrains.dokka.pages.RootPageNode
interface PageTransformer {
operator fun invoke(input: RootPageNode): RootPageNode
-} \ No newline at end of file
+}
+
+object SourceSetMergePageTransformer : PageTransformer {
+ override fun invoke(input: RootPageNode): RootPageNode {
+
+ return input.transformContentPagesTree { contentPage ->
+ val content: ContentNode = contentPage.content
+ TODO()
+ }
+ }
+
+}
diff --git a/core/src/test/kotlin/model/CompositeSourceSetIDTest.kt b/core/src/test/kotlin/model/CompositeSourceSetIDTest.kt
new file mode 100644
index 00000000..68af259d
--- /dev/null
+++ b/core/src/test/kotlin/model/CompositeSourceSetIDTest.kt
@@ -0,0 +1,58 @@
+package model
+
+import org.jetbrains.dokka.DokkaSourceSetID
+import org.jetbrains.dokka.pages.CompositeSourceSetID
+import kotlin.test.*
+
+class CompositeSourceSetIDTest {
+
+ @Test
+ fun `constructor fails with empty collection`() {
+ assertFailsWith<IllegalArgumentException>("Expected no construction of empty `CompositeSourceSetID`") {
+ CompositeSourceSetID(emptyList())
+ }
+ }
+
+ @Test
+ fun `merged for single source set`() {
+ val sourceSetID = DokkaSourceSetID("module", "sourceSet")
+ val composite = CompositeSourceSetID(sourceSetID)
+
+ assertEquals(
+ composite.merged, sourceSetID,
+ "Expected merged source set id to be equal to single child"
+ )
+ }
+
+ @Test
+ fun `merged with multiple source sets`() {
+ val composite = CompositeSourceSetID(
+ listOf(DokkaSourceSetID("m1", "s1"), DokkaSourceSetID("m2", "s2"), DokkaSourceSetID("m3", "s3"))
+ )
+
+ assertEquals(
+ DokkaSourceSetID("m1+m2+m3", "s1+s2+s3"), composite.merged,
+ "Expected merged source set id to concatenate source sets"
+ )
+ }
+
+ @Test
+ fun `contains with child sourceSetID`() {
+ val composite = CompositeSourceSetID(listOf(DokkaSourceSetID("m1", "s1"), DokkaSourceSetID("m2", "s2")))
+
+ assertFalse(
+ DokkaSourceSetID("m3", "s3") in composite,
+ "Expected source set id not being contained in composite"
+ )
+
+ assertTrue(
+ DokkaSourceSetID("m1", "s1") in composite,
+ "Expected child source set id being contained in composite"
+ )
+
+ assertTrue(
+ DokkaSourceSetID("m1+m2", "s1+s2") in composite,
+ "Expected merged source set id being contained in composite"
+ )
+ }
+}
diff --git a/core/src/test/kotlin/model/ContentSourceSetTest.kt b/core/src/test/kotlin/model/ContentSourceSetTest.kt
new file mode 100644
index 00000000..cb17bcba
--- /dev/null
+++ b/core/src/test/kotlin/model/ContentSourceSetTest.kt
@@ -0,0 +1,61 @@
+package model
+
+import org.jetbrains.dokka.DokkaSourceSetID
+import org.jetbrains.dokka.Platform
+import org.jetbrains.dokka.pages.CompositeSourceSetID
+import org.jetbrains.dokka.pages.ContentSourceSet
+import org.jetbrains.dokka.pages.sourceSetIDs
+import kotlin.test.Test
+import kotlin.test.assertFalse
+import kotlin.test.assertTrue
+
+class ContentSourceSetTest {
+ @Test
+ fun `contains sourceSetId`() {
+ val contentSourceSet = ContentSourceSet(
+ sourceSetIDs = CompositeSourceSetID(listOf(DokkaSourceSetID("m1", "s1"), DokkaSourceSetID("m2", "s2"))),
+ displayName = "displayName",
+ analysisPlatform = Platform.common
+ )
+
+ assertFalse(
+ DokkaSourceSetID("m3", "s3") in contentSourceSet,
+ "Expected source set id not being contained in content source set"
+ )
+
+ assertTrue(
+ DokkaSourceSetID("m1", "s1") in contentSourceSet,
+ "Expected source set id being contained in content source set"
+ )
+
+ assertTrue(
+ DokkaSourceSetID("m1+m2", "s1+s2") in contentSourceSet,
+ "Expected merged source set being contained in content source set"
+ )
+ }
+
+ @Test
+ fun `Iterable contains sourceSetId`() {
+
+ val contentSourceSet = ContentSourceSet(
+ sourceSetIDs = CompositeSourceSetID(listOf(DokkaSourceSetID("m1", "s1"), DokkaSourceSetID("m2", "s2"))),
+ displayName = "displayName",
+ analysisPlatform = Platform.common
+ )
+
+ assertFalse(
+ DokkaSourceSetID("m3", "s3") in listOf(contentSourceSet).sourceSetIDs,
+ "Expected source set id not being contained in content source set"
+ )
+
+ assertTrue(
+ DokkaSourceSetID("m1", "s1") in listOf(contentSourceSet).sourceSetIDs,
+ "Expected source set id being contained in content source set"
+ )
+
+ assertTrue(
+ DokkaSourceSetID("m1+m2", "s1+s2") in listOf(contentSourceSet).sourceSetIDs,
+ "Expected merged source set being contained in content source set"
+ )
+ }
+}
diff --git a/plugins/base/src/main/kotlin/renderers/DefaultRenderer.kt b/plugins/base/src/main/kotlin/renderers/DefaultRenderer.kt
index afee1b33..84be6df0 100644
--- a/plugins/base/src/main/kotlin/renderers/DefaultRenderer.kt
+++ b/plugins/base/src/main/kotlin/renderers/DefaultRenderer.kt
@@ -4,7 +4,6 @@ import kotlinx.coroutines.Dispatchers
import kotlinx.coroutines.coroutineScope
import kotlinx.coroutines.launch
import kotlinx.coroutines.runBlocking
-import org.jetbrains.dokka.DokkaConfiguration.DokkaSourceSet
import org.jetbrains.dokka.base.DokkaBase
import org.jetbrains.dokka.base.resolvers.local.LocationProvider
import org.jetbrains.dokka.pages.*
@@ -30,7 +29,7 @@ abstract class DefaultRenderer<T>(
abstract fun T.buildList(
node: ContentList,
pageContext: ContentPage,
- sourceSetRestriction: Set<DokkaSourceSet>? = null
+ sourceSetRestriction: Set<ContentSourceSet>? = null
)
abstract fun T.buildNewLine()
@@ -38,7 +37,7 @@ abstract class DefaultRenderer<T>(
abstract fun T.buildTable(
node: ContentTable,
pageContext: ContentPage,
- sourceSetRestriction: Set<DokkaSourceSet>? = null
+ sourceSetRestriction: Set<ContentSourceSet>? = null
)
abstract fun T.buildText(textNode: ContentText)
@@ -50,13 +49,13 @@ abstract class DefaultRenderer<T>(
open fun T.buildPlatformDependent(
content: PlatformHintedContent,
pageContext: ContentPage,
- sourceSetRestriction: Set<DokkaSourceSet>?
+ sourceSetRestriction: Set<ContentSourceSet>?
) = buildContentNode(content.inner, pageContext)
open fun T.buildGroup(
node: ContentGroup,
pageContext: ContentPage,
- sourceSetRestriction: Set<DokkaSourceSet>? = null
+ sourceSetRestriction: Set<ContentSourceSet>? = null
) =
wrapGroup(node, pageContext) { node.children.forEach { it.build(this, pageContext, sourceSetRestriction) } }
@@ -69,7 +68,7 @@ abstract class DefaultRenderer<T>(
open fun T.buildLinkText(
nodes: List<ContentNode>,
pageContext: ContentPage,
- sourceSetRestriction: Set<DokkaSourceSet>? = null
+ sourceSetRestriction: Set<ContentSourceSet>? = null
) {
nodes.forEach { it.build(this, pageContext, sourceSetRestriction) }
}
@@ -85,7 +84,7 @@ abstract class DefaultRenderer<T>(
open fun T.buildHeader(
node: ContentHeader,
pageContext: ContentPage,
- sourceSetRestriction: Set<DokkaSourceSet>? = null
+ sourceSetRestriction: Set<ContentSourceSet>? = null
) {
buildHeader(node.level, node) { node.children.forEach { it.build(this, pageContext, sourceSetRestriction) } }
}
@@ -93,14 +92,14 @@ abstract class DefaultRenderer<T>(
open fun ContentNode.build(
builder: T,
pageContext: ContentPage,
- sourceSetRestriction: Set<DokkaSourceSet>? = null
+ sourceSetRestriction: Set<ContentSourceSet>? = null
) =
builder.buildContentNode(this, pageContext, sourceSetRestriction)
open fun T.buildContentNode(
node: ContentNode,
pageContext: ContentPage,
- sourceSetRestriction: Set<DokkaSourceSet>? = null
+ sourceSetRestriction: Set<ContentSourceSet>? = null
) {
if (sourceSetRestriction == null || node.sourceSets.any { it in sourceSetRestriction }) {
when (node) {
@@ -178,8 +177,8 @@ abstract class DefaultRenderer<T>(
protected fun ContentDivergentGroup.groupDivergentInstances(
pageContext: ContentPage,
- beforeTransformer: (ContentDivergentInstance, ContentPage, DokkaSourceSet) -> String,
- afterTransformer: (ContentDivergentInstance, ContentPage, DokkaSourceSet) -> String
+ beforeTransformer: (ContentDivergentInstance, ContentPage, ContentSourceSet) -> String,
+ afterTransformer: (ContentDivergentInstance, ContentPage, ContentSourceSet) -> String
): Map<SerializedBeforeAndAfter, List<InstanceWithSource>> =
children.flatMap { instance ->
instance.sourceSets.map { sourceSet ->
@@ -195,6 +194,6 @@ abstract class DefaultRenderer<T>(
}
internal typealias SerializedBeforeAndAfter = Pair<String, String>
-internal typealias InstanceWithSource = Pair<ContentDivergentInstance, DokkaSourceSet>
+internal typealias InstanceWithSource = Pair<ContentDivergentInstance, ContentSourceSet>
-fun ContentPage.sourceSets() = this.content.sourceSets \ No newline at end of file
+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 88d2539d..c533836a 100644
--- a/plugins/base/src/main/kotlin/renderers/html/HtmlRenderer.kt
+++ b/plugins/base/src/main/kotlin/renderers/html/HtmlRenderer.kt
@@ -5,7 +5,6 @@ import kotlinx.coroutines.launch
import kotlinx.coroutines.runBlocking
import kotlinx.html.*
import kotlinx.html.stream.createHTML
-import org.jetbrains.dokka.DokkaConfiguration.DokkaSourceSet
import org.jetbrains.dokka.Platform
import org.jetbrains.dokka.base.DokkaBase
import org.jetbrains.dokka.base.renderers.DefaultRenderer
@@ -111,7 +110,7 @@ open class HtmlRenderer(
page.content.withDescendants().flatMap { it.sourceSets }.distinct().forEach {
button(classes = "platform-tag platform-selector") {
attributes["data-active"] = ""
- attributes["data-filter"] = it.sourceSetID.toString()
+ attributes["data-filter"] = it.sourceSetIDs.merged.toString()
when (it.analysisPlatform.key) {
"common" -> classes = classes + "common-like"
"native" -> classes = classes + "native-like"
@@ -157,7 +156,7 @@ open class HtmlRenderer(
override fun FlowContent.buildPlatformDependent(
content: PlatformHintedContent,
pageContext: ContentPage,
- sourceSetRestriction: Set<DokkaSourceSet>?
+ sourceSetRestriction: Set<ContentSourceSet>?
) =
buildPlatformDependent(
content.sourceSets.filter {
@@ -169,7 +168,7 @@ open class HtmlRenderer(
)
private fun FlowContent.buildPlatformDependent(
- nodes: Map<DokkaSourceSet, Collection<ContentNode>>,
+ nodes: Map<ContentSourceSet, Collection<ContentNode>>,
pageContext: ContentPage,
extra: PropertyContainer<ContentNode> = PropertyContainer.empty(),
styles: Set<Style> = emptySet()
@@ -186,17 +185,17 @@ open class HtmlRenderer(
attributes["data-toggle-list"] = "data-toggle-list"
contents.forEachIndexed { index, pair ->
button(classes = "platform-bookmark") {
- attributes["data-filterable-current"] = pair.first.sourceSetID.toString()
- attributes["data-filterable-set"] = pair.first.sourceSetID.toString()
+ attributes["data-filterable-current"] = pair.first.sourceSetIDs.merged.toString()
+ attributes["data-filterable-set"] = pair.first.sourceSetIDs.merged.toString()
if (index == 0) attributes["data-active"] = ""
- attributes["data-toggle"] = pair.first.sourceSetID.toString()
+ attributes["data-toggle"] = pair.first.sourceSetIDs.merged.toString()
when (pair.first.analysisPlatform.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.sourceSetID.toString()
+ attributes["data-toggle"] = pair.first.sourceSetIDs.merged.toString()
text(pair.first.displayName)
}
}
@@ -209,9 +208,9 @@ open class HtmlRenderer(
}
private fun contentsForSourceSetDependent(
- nodes: Map<DokkaSourceSet, Collection<ContentNode>>,
+ nodes: Map<ContentSourceSet, Collection<ContentNode>>,
pageContext: ContentPage,
- ): List<Pair<DokkaSourceSet, String>> {
+ ): List<Pair<ContentSourceSet, String>> {
var counter = 0
return nodes.toList().map { (sourceSet, elements) ->
sourceSet to createHTML(prettyPrint = false).div {
@@ -220,15 +219,15 @@ open class HtmlRenderer(
}
}.stripDiv()
}.groupBy(
- Pair<DokkaSourceSet, String>::second,
- Pair<DokkaSourceSet, String>::first
+ Pair<ContentSourceSet, String>::second,
+ Pair<ContentSourceSet, String>::first
).entries.flatMap { (html, sourceSets) ->
sourceSets.filterNot {
sourceSetDependencyMap[it].orEmpty().any { dependency -> sourceSets.contains(dependency) }
}.map {
it to createHTML(prettyPrint = false).div(classes = "content sourceset-depenent-content") {
if (counter++ == 0) attributes["data-active"] = ""
- attributes["data-togglable"] = it.sourceSetID.toString()
+ attributes["data-togglable"] = it.sourceSetIDs.merged.toString()
unsafe {
+html
}
@@ -260,10 +259,10 @@ open class HtmlRenderer(
consumer.onTagContentUnsafe {
+createHTML().div("divergent-group") {
attributes["data-filterable-current"] = groupedDivergent.keys.joinToString(" ") {
- it.sourceSetID.toString()
+ it.sourceSetIDs.merged.toString()
}
attributes["data-filterable-set"] = groupedDivergent.keys.joinToString(" ") {
- it.sourceSetID.toString()
+ it.sourceSetIDs.merged.toString()
}
val divergentForPlatformDependent = groupedDivergent.map { (sourceSet, elements) ->
@@ -309,14 +308,14 @@ open class HtmlRenderer(