aboutsummaryrefslogtreecommitdiff
path: root/plugins/base/src/main/kotlin/renderers
diff options
context:
space:
mode:
Diffstat (limited to 'plugins/base/src/main/kotlin/renderers')
-rw-r--r--plugins/base/src/main/kotlin/renderers/DefaultRenderer.kt24
-rw-r--r--plugins/base/src/main/kotlin/renderers/html/HtmlRenderer.kt48
-rw-r--r--plugins/base/src/main/kotlin/renderers/html/NavigationPage.kt4
3 files changed, 38 insertions, 38 deletions
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>
)