aboutsummaryrefslogtreecommitdiff
path: root/plugins/base/src/main/kotlin/translators/documentables
diff options
context:
space:
mode:
Diffstat (limited to 'plugins/base/src/main/kotlin/translators/documentables')
-rw-r--r--plugins/base/src/main/kotlin/translators/documentables/DefaultPageCreator.kt111
-rw-r--r--plugins/base/src/main/kotlin/translators/documentables/PageContentBuilder.kt98
2 files changed, 104 insertions, 105 deletions
diff --git a/plugins/base/src/main/kotlin/translators/documentables/DefaultPageCreator.kt b/plugins/base/src/main/kotlin/translators/documentables/DefaultPageCreator.kt
index 439da560..232f6721 100644
--- a/plugins/base/src/main/kotlin/translators/documentables/DefaultPageCreator.kt
+++ b/plugins/base/src/main/kotlin/translators/documentables/DefaultPageCreator.kt
@@ -14,7 +14,7 @@ import org.jetbrains.kotlin.utils.addToStdlib.safeAs
import kotlin.reflect.KClass
import kotlin.reflect.full.isSubclassOf
-private typealias GroupedTags = Map<KClass<out TagWrapper>, List<Pair<PlatformData?, TagWrapper>>>
+private typealias GroupedTags = Map<KClass<out TagWrapper>, List<Pair<SourceSetData?, TagWrapper>>>
private val specialTags: Set<KClass<out TagWrapper>> =
setOf(Property::class, Description::class, Constructor::class, Receiver::class, Param::class, See::class)
@@ -68,8 +68,8 @@ open class DefaultPageCreator(
header(1) { text(m.name) }
}
+contentForComments(m)
- block("Packages", 2, ContentKind.Packages, m.packages, m.platformData.toSet()) {
- link(it.name, it.dri, kind = ContentKind.Main)
+ block("Packages", 2, ContentKind.Packages, m.packages, m.sourceSets.toSet()) {
+ link(it.name, it.dri)
}
// text("Index\n") TODO
// text("Link to allpage here")
@@ -80,10 +80,10 @@ open class DefaultPageCreator(
header(1) { text("Package ${p.name}") }
}
+contentForComments(p)
- +contentForScope(p, p.dri, p.platformData)
- block("Type aliases", 2, ContentKind.TypeAliases, p.typealiases, p.platformData.toSet()) {
+ +contentForScope(p, p.dri, p.sourceSets)
+ block("Type aliases", 2, ContentKind.TypeAliases, p.typealiases, p.sourceSets.toSet()) {
link(it.name, it.dri, kind = ContentKind.Main)
- platformDependentHint(it.dri, it.platformData.toSet(), kind = ContentKind.PlatformDependantHint) {
+ sourceSetDependentHint(it.dri, it.sourceSets.toSet(), kind = ContentKind.SourceSetDependantHint) {
+buildSignature(it)
contentForBrief(it)
}
@@ -93,47 +93,47 @@ open class DefaultPageCreator(
protected open fun contentForScope(
s: WithScope,
dri: DRI,
- platformData: List<PlatformData>
+ sourceSets: List<SourceSetData>
) = contentBuilder.contentFor(s as Documentable) {
- block("Types", 2, ContentKind.Classlikes, s.classlikes, platformData.toSet()) {
+ block("Types", 2, ContentKind.Classlikes, s.classlikes, sourceSets.toSet()) {
link(it.name ?: "", it.dri, kind = ContentKind.Main)
- platformDependentHint(it.dri, it.platformData.toSet(), kind = ContentKind.PlatformDependantHint) {
+ sourceSetDependentHint(it.dri, it.sourceSets.toSet(), kind = ContentKind.SourceSetDependantHint) {
+buildSignature(it)
contentForBrief(it)
}
}
- block("Functions", 2, ContentKind.Functions, s.functions, platformData.toSet()) {
+ block("Functions", 2, ContentKind.Functions, s.functions, sourceSets.toSet()) {
link(it.name, it.dri, kind = ContentKind.Main)
- platformDependentHint(it.dri, it.platformData.toSet(), kind = ContentKind.PlatformDependantHint) {
+ sourceSetDependentHint(it.dri, it.sourceSets.toSet(), kind = ContentKind.SourceSetDependantHint) {
+buildSignature(it)
contentForBrief(it)
}
}
- block("Properties", 2, ContentKind.Properties, s.properties, platformData.toSet()) {
+ block("Properties", 2, ContentKind.Properties, s.properties, sourceSets.toSet()) {
link(it.name, it.dri, kind = ContentKind.Main)
- platformDependentHint(it.dri, it.platformData.toSet(), kind = ContentKind.PlatformDependantHint) {
+ sourceSetDependentHint(it.dri, it.sourceSets.toSet(), kind = ContentKind.SourceSetDependantHint) {
+buildSignature(it)
contentForBrief(it)
}
}
s.safeAs<WithExtraProperties<Documentable>>()?.let { it.extra[InheritorsInfo] }?.let { inheritors ->
- val map = inheritors.value.map.filter { it.value.isNotEmpty() }
+ val map = inheritors.value.filter { it.value.isNotEmpty() }
if (map.values.any()) {
header(2) { text("Inheritors") }
+ContentTable(
emptyList(),
map.entries.flatMap { entry -> entry.value.map { Pair(entry.key, it) } }
.groupBy({ it.second }, { it.first }).map { (classlike, platforms) ->
- buildGroup(dri, platforms.toSet(), ContentKind.Inheritors) {
- link(
- classlike.classNames?.substringBeforeLast(".") ?: classlike.toString()
- .also { logger.warn("No class name found for DRI $classlike") }, classlike
- )
- }
- },
+ buildGroup(dri, platforms.toSet(), ContentKind.Inheritors) {
+ link(
+ classlike.classNames?.substringBeforeLast(".") ?: classlike.toString()
+ .also { logger.warn("No class name found for DRI $classlike") }, classlike
+ )
+ }
+ },
DCI(setOf(dri), ContentKind.Inheritors),
- platformData.toSet(),
+ sourceSets.toSet(),
style = emptySet()
)
}
@@ -146,13 +146,13 @@ open class DefaultPageCreator(
+buildSignature(e)
}
+contentForComments(e)
- +contentForScope(e, e.dri, e.platformData)
+ +contentForScope(e, e.dri, e.sourceSets)
}
protected open fun contentForClasslike(c: DClasslike) = contentBuilder.contentFor(c) {
group(kind = ContentKind.Cover) {
header(1) { text(c.name.orEmpty()) }
- platformDependentHint(c.dri, c.platformData.toSet()) {
+ sourceSetDependentHint(c.dri, c.sourceSets.toSet()) {
+buildSignature(c)
}
}
@@ -164,58 +164,57 @@ open class DefaultPageCreator(
2,
ContentKind.Constructors,
c.constructors.filter { it.extra[PrimaryConstructorExtra] == null },
- c.platformData.toSet()
+ c.sourceSets.toSet()
) {
link(it.name, it.dri, kind = ContentKind.Main)
- platformDependentHint(it.dri, it.platformData.toSet(), kind = ContentKind.PlatformDependantHint) {
+ sourceSetDependentHint(it.dri, it.sourceSets.toSet(), kind = ContentKind.SourceSetDependantHint) {
+buildSignature(it)
contentForBrief(it)
}
}
}
if (c is DEnum) {
- block("Entries", 2, ContentKind.Classlikes, c.entries, c.platformData.toSet()) {
+ block("Entries", 2, ContentKind.Classlikes, c.entries, c.sourceSets.toSet()) {
link(it.name, it.dri, kind = ContentKind.Main)
- platformDependentHint(it.dri, it.platformData.toSet(), kind = ContentKind.PlatformDependantHint) {
+ sourceSetDependentHint(it.dri, it.sourceSets.toSet(), kind = ContentKind.SourceSetDependantHint) {
+buildSignature(it)
contentForBrief(it)
}
}
}
- +contentForScope(c, c.dri, c.platformData)
+ +contentForScope(c, c.dri, c.sourceSets)
}
@Suppress("UNCHECKED_CAST")
- private inline fun <reified T : TagWrapper> GroupedTags.withTypeUnnamed(): PlatformDependent<T> =
- (this[T::class] as List<Pair<PlatformData, T>>?)
- ?.let { PlatformDependent.from(it) }.orEmpty()
+ private inline fun <reified T : TagWrapper> GroupedTags.withTypeUnnamed(): SourceSetDependent<T> =
+ (this[T::class] as List<Pair<SourceSetData, T>>?)?.toMap().orEmpty()
@Suppress("UNCHECKED_CAST")
- private inline fun <reified T : NamedTagWrapper> GroupedTags.withTypeNamed(): Map<String, PlatformDependent<T>> =
- (this[T::class] as List<Pair<PlatformData, T>>?)
+ private inline fun <reified T : NamedTagWrapper> GroupedTags.withTypeNamed(): Map<String, SourceSetDependent<T>> =
+ (this[T::class] as List<Pair<SourceSetData, T>>?)
?.groupBy { it.second.name }
- ?.mapValues { (_, v) -> PlatformDependent.from(v) }
+ ?.mapValues { (_, v) -> v.toMap() }
.orEmpty()
private inline fun <reified T : TagWrapper> GroupedTags.isNotEmptyForTag(): Boolean =
- this[T::class]?.isNotEmpty() ?: false
+ this[T::class]?.isNotEmpty() ?: false
protected open fun contentForComments(
d: Documentable
): List<ContentNode> {
- val tags: GroupedTags = d.documentation.allEntries.flatMap { (pd, doc) ->
- doc.children.asSequence().map { pd to it }
+ val tags: GroupedTags = d.documentation.flatMap { (pd, doc) ->
+ doc.children.asSequence().map { pd to it }.toList()
}.groupBy { it.second::class }
- val platforms = d.platformData
+ val platforms = d.sourceSets
fun DocumentableContentBuilder.contentForDescription() {
val description = tags.withTypeUnnamed<Description>()
if (description.any { it.value.root.children.isNotEmpty() }) {
platforms.forEach { platform ->
- description.getOrExpect(platform)?.also {
- group(platformData = setOf(platform)) {
+ description[platform]?.also {
+ group(sourceSets = setOf(platform)) {
comment(it.root)
}
}
@@ -232,16 +231,16 @@ open class DefaultPageCreator(
}
table(kind = ContentKind.Parameters) {
platforms.flatMap { platform ->
- val receiverRow = receiver.getOrExpect(platform)?.let {
- buildGroup(platformData = setOf(platform), kind = ContentKind.Parameters, styles = mainStyles + ContentStyle.KeyValue) {
+ val receiverRow = receiver[platform]?.let {
+ buildGroup(sourceSets = setOf(platform), kind = ContentKind.Parameters, styles = mainStyles + ContentStyle.KeyValue) {
text("<receiver>")
comment(it.root)
}
}
val paramRows = params.mapNotNull { (_, param) ->
- param.getOrExpect(platform)?.let {
- buildGroup(platformData = setOf(platform), kind = ContentKind.Parameters, styles = mainStyles + ContentStyle.KeyValue) {
+ param[platform]?.let {
+ buildGroup(sourceSets = setOf(platform), kind = ContentKind.Parameters, styles = mainStyles + ContentStyle.KeyValue) {
text(it.name, kind = ContentKind.Parameters)
comment(it.root)
}
@@ -263,8 +262,8 @@ open class DefaultPageCreator(
table(kind = ContentKind.Sample) {
platforms.flatMap { platform ->
seeAlsoTags.mapNotNull { (_, see) ->
- see.getOrExpect(platform)?.let {
- buildGroup(platformData = setOf(platform), kind = ContentKind.Comment, styles = mainStyles + ContentStyle.KeyValue) {
+ see[platform]?.let {
+ buildGroup(sourceSets = setOf(platform), kind = ContentKind.Comment, styles = mainStyles + ContentStyle.KeyValue) {
if (it.address != null) link(it.name, it.address!!, kind = ContentKind.Comment)
else text(it.name, kind = ContentKind.Comment)
comment(it.root)
@@ -282,7 +281,7 @@ open class DefaultPageCreator(
platforms.forEach { platformData ->
val content = samples.filter { it.value.isEmpty() || platformData in it.value }
if (content.isNotEmpty()) {
- group(platformData = setOf(platformData)) {
+ group(sourceSets = setOf(platformData)) {
header(4, kind = ContentKind.Comment) { text("Samples") }
content.forEach {
comment(Text(it.key))
@@ -294,13 +293,13 @@ open class DefaultPageCreator(
}
fun DocumentableContentBuilder.contentForUnnamedTags() {
- val unnamedTags: List<PlatformDependent<TagWrapper>> =
+ val unnamedTags: List<SourceSetDependent<TagWrapper>> =
tags.filterNot { (k, _) -> k.isSubclassOf(NamedTagWrapper::class) || k in specialTags }
- .map { (_, v) -> PlatformDependent.from(v) }
+ .map { (_, v) -> v.mapNotNull { (k,v) -> k?.let { it to v } }.toMap() }
platforms.forEach { platform ->
unnamedTags.forEach { pdTag ->
- pdTag.getOrExpect(platform)?.also { tag ->
- group(platformData = setOf(platform)) {
+ pdTag[platform]?.also { tag ->
+ group(sourceSets = setOf(platform)) {
header(4) { text(tag.toHeaderString()) }
comment(tag.root)
}
@@ -312,7 +311,7 @@ open class DefaultPageCreator(
return contentBuilder.contentFor(d) {
if (tags.isNotEmpty()) {
header(3) { text("Description") }
- platformDependentHint(platformData = platforms.toSet()) {
+ sourceSetDependentHint(sourceSets = platforms.toSet()) {
contentForDescription()
contentForSamples()
contentForParams()
@@ -324,11 +323,11 @@ open class DefaultPageCreator(
}
protected open fun DocumentableContentBuilder.contentForBrief(content: Documentable) {
- content.platformData.forEach { platform ->
+ content.sourceSets.forEach { platform ->
val root = content.documentation[platform]?.children?.firstOrNull()?.root
root?.let {
- group(platformData = setOf(platform), kind = ContentKind.BriefComment) {
+ group(sourceSets = setOf(platform), kind = ContentKind.BriefComment) {
text(it.docTagSummary(), kind = ContentKind.Comment)
}
}
@@ -338,7 +337,7 @@ open class DefaultPageCreator(
protected open fun contentForFunction(f: DFunction) = contentBuilder.contentFor(f) {
group(kind = ContentKind.Cover) {
header(1) { text(f.name) }
- platformDependentHint(f.dri, f.platformData.toSet()) {
+ sourceSetDependentHint(f.dri, f.sourceSets.toSet()) {
+buildSignature(f)
}
}
diff --git a/plugins/base/src/main/kotlin/translators/documentables/PageContentBuilder.kt b/plugins/base/src/main/kotlin/translators/documentables/PageContentBuilder.kt
index 6cb47b7f..3ed19afa 100644
--- a/plugins/base/src/main/kotlin/translators/documentables/PageContentBuilder.kt
+++ b/plugins/base/src/main/kotlin/translators/documentables/PageContentBuilder.kt
@@ -19,46 +19,46 @@ open class PageContentBuilder(
) {
fun contentFor(
dri: DRI,
- platformData: Set<PlatformData>,
+ sourceSets: Set<SourceSetData>,
kind: Kind = ContentKind.Main,
styles: Set<Style> = emptySet(),
extra: PropertyContainer<ContentNode> = PropertyContainer.empty(),
block: DocumentableContentBuilder.() -> Unit
): ContentGroup =
- DocumentableContentBuilder(dri, platformData, styles, extra)
+ DocumentableContentBuilder(dri, sourceSets, styles, extra)
.apply(block)
- .build(platformData, kind, styles, extra)
+ .build(sourceSets, kind, styles, extra)
fun contentFor(
d: Documentable,
kind: Kind = ContentKind.Main,
styles: Set<Style> = emptySet(),
extra: PropertyContainer<ContentNode> = PropertyContainer.empty(),
- platformData: Set<PlatformData> = d.platformData.toSet(),
+ sourceSets: Set<SourceSetData> = d.sourceSets.toSet(),
block: DocumentableContentBuilder.() -> Unit = {}
): ContentGroup =
- DocumentableContentBuilder(d.dri, platformData, styles, extra)
+ DocumentableContentBuilder(d.dri, sourceSets, styles, extra)
.apply(block)
- .build(platformData, kind, styles, extra)
+ .build(sourceSets, kind, styles, extra)
@ContentBuilderMarker
open inner class DocumentableContentBuilder(
val mainDRI: DRI,
- val mainPlatformData: Set<PlatformData>,
+ val mainPlatformData: Set<SourceSetData>,
val mainStyles: Set<Style>,
val mainExtra: PropertyContainer<ContentNode>
) {
protected val contents = mutableListOf<ContentNode>()
fun build(
- platformData: Set<PlatformData>,
+ sourceSets: Set<SourceSetData>,
kind: Kind,
styles: Set<Style>,
extra: PropertyContainer<ContentNode>
) = ContentGroup(
contents.toList(),
DCI(setOf(mainDRI), kind),
- platformData,
+ sourceSets,
styles,
extra
)
@@ -74,7 +74,7 @@ open class PageContentBuilder(
fun header(
level: Int,
kind: Kind = ContentKind.Main,
- platformData: Set<PlatformData> = mainPlatformData,
+ platformData: Set<SourceSetData> = mainPlatformData,
styles: Set<Style> = mainStyles,
extra: PropertyContainer<ContentNode> = mainExtra,
block: DocumentableContentBuilder.() -> Unit
@@ -88,11 +88,11 @@ open class PageContentBuilder(
fun text(
text: String,
kind: Kind = ContentKind.Main,
- platformData: Set<PlatformData> = mainPlatformData,
+ sourceSets: Set<SourceSetData> = mainPlatformData,
styles: Set<Style> = mainStyles,
extra: PropertyContainer<ContentNode> = mainExtra
) {
- contents += createText(text, kind, platformData, styles, extra)
+ contents += createText(text, kind, sourceSets, styles, extra)
}
fun buildSignature(d: Documentable) = signatureProvider.signature(d)
@@ -100,26 +100,26 @@ open class PageContentBuilder(
fun linkTable(
elements: List<DRI>,
kind: Kind = ContentKind.Main,
- platformData: Set<PlatformData> = mainPlatformData,
+ sourceSets: Set<SourceSetData> = mainPlatformData,
styles: Set<Style> = mainStyles,
extra: PropertyContainer<ContentNode> = mainExtra
) {
contents += ContentTable(
emptyList(),
elements.map {
- contentFor(it, platformData, kind, styles, extra) {
+ contentFor(it, sourceSets, kind, styles, extra) {
link(it.classNames ?: "", it)
}
},
DCI(setOf(mainDRI), kind),
- platformData, styles, extra
+ sourceSets, styles, extra
)
}
fun table(
dri: DRI = mainDRI,
kind: Kind = ContentKind.Main,
- platformData: Set<PlatformData> = mainPlatformData,
+ sourceSets: Set<SourceSetData> = mainPlatformData,
styles: Set<Style> = mainStyles,
extra: PropertyContainer<ContentNode> = mainExtra,
operation: DocumentableContentBuilder.() -> List<ContentGroup>
@@ -128,7 +128,7 @@ open class PageContentBuilder(
emptyList(),
operation(),
DCI(setOf(mainDRI), kind),
- platformData, styles, extra
+ sourceSets, styles, extra
)
}
@@ -137,7 +137,7 @@ open class PageContentBuilder(
level: Int,
kind: Kind = ContentKind.Main,
elements: Iterable<T>,
- platformData: Set<PlatformData> = mainPlatformData,
+ sourceSets: Set<SourceSetData> = mainPlatformData,
styles: Set<Style> = mainStyles,
extra: PropertyContainer<ContentNode> = mainExtra,
renderWhenEmpty: Boolean = false,
@@ -148,12 +148,12 @@ open class PageContentBuilder(
contents += ContentTable(
emptyList(),
elements.map {
- buildGroup(it.dri, it.platformData.toSet(), kind, styles, extra) {
+ buildGroup(it.dri, it.sourceSets.toSet(), kind, styles, extra) {
operation(it)
}
},
DCI(setOf(mainDRI), kind),
- platformData, styles, extra
+ sourceSets, styles, extra
)
}
}
@@ -163,17 +163,17 @@ open class PageContentBuilder(
prefix: String = "",
suffix: String = "",
separator: String = ", ",
- platformData: Set<PlatformData> = mainPlatformData, // TODO: children should be aware of this platform data
+ sourceSets: Set<SourceSetData> = mainPlatformData, // TODO: children should be aware of this platform data
operation: DocumentableContentBuilder.(T) -> Unit
) {
if (elements.isNotEmpty()) {
- if (prefix.isNotEmpty()) text(prefix, platformData = platformData)
+ if (prefix.isNotEmpty()) text(prefix, sourceSets = sourceSets)
elements.dropLast(1).forEach {
operation(it)
- text(separator, platformData = platformData)
+ text(separator, sourceSets = sourceSets)
}
operation(elements.last())
- if (suffix.isNotEmpty()) text(suffix, platformData = platformData)
+ if (suffix.isNotEmpty()) text(suffix, sourceSets = sourceSets)
}
}
@@ -181,15 +181,15 @@ open class PageContentBuilder(
text: String,
address: DRI,
kind: Kind = ContentKind.Main,
- platformData: Set<PlatformData> = mainPlatformData,
+ sourceSets: Set<SourceSetData> = mainPlatformData,
styles: Set<Style> = mainStyles,
extra: PropertyContainer<ContentNode> = mainExtra
) {
contents += ContentDRILink(
- listOf(createText(text, kind, platformData, styles, extra)),
+ listOf(createText(text, kind, sourceSets, styles, extra)),
address,
DCI(setOf(mainDRI), kind),
- platformData
+ sourceSets
)
}
@@ -197,99 +197,99 @@ open class PageContentBuilder(
text: String,
address: String,
kind: Kind = ContentKind.Main,
- platformData: Set<PlatformData> = mainPlatformData,
+ sourceSets: Set<SourceSetData> = mainPlatformData,
styles: Set<Style> = mainStyles,
extra: PropertyContainer<ContentNode> = mainExtra
) =
ContentResolvedLink(
- children = listOf(createText(text, kind, platformData, styles, extra)),
+ children = listOf(createText(text, kind, sourceSets, styles, extra)),
address = address,
extra = PropertyContainer.empty(),
dci = DCI(setOf(mainDRI), kind),
- platforms = platformData,
+ sourceSets = sourceSets,
style = emptySet()
)
fun link(
address: DRI,
kind: Kind = ContentKind.Main,
- platformData: Set<PlatformData> = mainPlatformData,
+ sourceSets: Set<SourceSetData> = mainPlatformData,
styles: Set<Style> = mainStyles,
extra: PropertyContainer<ContentNode> = mainExtra,
block: DocumentableContentBuilder.() -> Unit
) {
contents += ContentDRILink(
- contentFor(mainDRI, platformData, kind, styles, extra, block).children,
+ contentFor(mainDRI, sourceSets, kind, styles, extra, block).children,
address,
DCI(setOf(mainDRI), kind),
- platformData
+ sourceSets
)
}
fun comment(
docTag: DocTag,
kind: Kind = ContentKind.Comment,
- platformData: Set<PlatformData> = mainPlatformData,
+ sourceSets: Set<SourceSetData> = mainPlatformData,
styles: Set<Style> = mainStyles,
extra: PropertyContainer<ContentNode> = mainExtra
) {
val content = commentsConverter.buildContent(
docTag,
DCI(setOf(mainDRI), kind),
- platformData
+ sourceSets
)
- contents += ContentGroup(content, DCI(setOf(mainDRI), kind), platformData, styles, extra)
+ contents += ContentGroup(content, DCI(setOf(mainDRI), kind), sourceSets, styles, extra)
}
fun group(
dri: DRI = mainDRI,
- platformData: Set<PlatformData> = mainPlatformData,
+ sourceSets: Set<SourceSetData> = mainPlatformData,
kind: Kind = ContentKind.Main,
styles: Set<Style> = mainStyles,
extra: PropertyContainer<ContentNode> = mainExtra,
block: DocumentableContentBuilder.() -> Unit
) {
- contents += buildGroup(dri, platformData, kind, styles, extra, block)
+ contents += buildGroup(dri, sourceSets, kind, styles, extra, block)
}
fun buildGroup(
dri: DRI = mainDRI,
- platformData: Set<PlatformData> = mainPlatformData,
+ sourceSets: Set<SourceSetData> = mainPlatformData,
kind: Kind = ContentKind.Main,
styles: Set<Style> = mainStyles,
extra: PropertyContainer<ContentNode> = mainExtra,
block: DocumentableContentBuilder.() -> Unit
- ): ContentGroup = contentFor(dri, platformData, kind, styles, extra, block)
+ ): ContentGroup = contentFor(dri, sourceSets, kind, styles, extra, block)
- fun platformDependentHint(
+ fun sourceSetDependentHint(
dri: DRI = mainDRI,
- platformData: Set<PlatformData> = mainPlatformData,
+ sourceSets: Set<SourceSetData> = mainPlatformData,
kind: Kind = ContentKind.Main,
styles: Set<Style> = mainStyles,
extra: PropertyContainer<ContentNode> = mainExtra,
block: DocumentableContentBuilder.() -> Unit
) {
contents += PlatformHintedContent(
- buildGroup(dri, platformData, kind, styles, extra, block),
- platformData
+ buildGroup(dri, sourceSets, kind, styles, extra, block),
+ sourceSets
)
}
protected fun createText(
text: String,
kind: Kind,
- platformData: Set<PlatformData>,
+ sourceSets: Set<SourceSetData>,
styles: Set<Style>,
extra: PropertyContainer<ContentNode>
) =
- ContentText(text, DCI(setOf(mainDRI), kind), platformData, styles, extra)
+ ContentText(text, DCI(setOf(mainDRI), kind), sourceSets, styles, extra)
fun <T> platformText(
- value: PlatformDependent<T>,
- platforms: Set<PlatformData> = value.keys,
+ value: SourceSetDependent<T>,
+ platforms: Set<SourceSetData> = value.keys,
transform: (T) -> String
) = value.entries.filter { it.key in platforms }.forEach { (p, v) ->
- transform(v).takeIf { it.isNotBlank() }?.also { text(it, platformData = setOf(p)) }
+ transform(v).takeIf { it.isNotBlank() }?.also { text(it, sourceSets = setOf(p)) }
}
}
} \ No newline at end of file