diff options
Diffstat (limited to 'plugins/base/src/main/kotlin/translators/documentables')
-rw-r--r-- | plugins/base/src/main/kotlin/translators/documentables/DefaultPageCreator.kt | 22 | ||||
-rw-r--r-- | plugins/base/src/main/kotlin/translators/documentables/PageContentBuilder.kt | 3 |
2 files changed, 16 insertions, 9 deletions
diff --git a/plugins/base/src/main/kotlin/translators/documentables/DefaultPageCreator.kt b/plugins/base/src/main/kotlin/translators/documentables/DefaultPageCreator.kt index a70f22d8..c3621d1b 100644 --- a/plugins/base/src/main/kotlin/translators/documentables/DefaultPageCreator.kt +++ b/plugins/base/src/main/kotlin/translators/documentables/DefaultPageCreator.kt @@ -221,6 +221,9 @@ open class DefaultPageCreator( ?.mapValues { (_, v) -> PlatformDependent.from(v) } .orEmpty() + private inline fun <reified T : TagWrapper> GroupedTags.isNotEmptyForTag(): Boolean = + this[T::class]?.isNotEmpty() ?: false + protected open fun contentForComments( d: Documentable ): List<ContentNode> { @@ -244,11 +247,12 @@ open class DefaultPageCreator( } fun DocumentableContentBuilder.contentForParams() { - val receiver = tags.withTypeUnnamed<Receiver>() - val params = tags.withTypeNamed<Param>() - - if (params.isNotEmpty()) { - header(4, kind = ContentKind.Parameters) { text("Parameters") } + if (tags.isNotEmptyForTag<Param>()) { + val receiver = tags.withTypeUnnamed<Receiver>() + val params = tags.withTypeNamed<Param>() + platforms.forEach { + header(4, kind = ContentKind.Parameters, platformData = setOf(it)) { text("Parameters") } + } table(kind = ContentKind.Parameters) { platforms.flatMap { platform -> val receiverRow = receiver.getOrExpect(platform)?.let { @@ -274,9 +278,11 @@ open class DefaultPageCreator( } fun DocumentableContentBuilder.contentForSeeAlso() { - val seeAlsoTags = tags.withTypeNamed<See>() - if (seeAlsoTags.isNotEmpty()) { - header(4, kind = ContentKind.Comment) { text("See also") } + if (tags.isNotEmptyForTag<See>()) { + val seeAlsoTags = tags.withTypeNamed<See>() + platforms.forEach { + header(4, kind = ContentKind.Comment, platformData = setOf(it)) { text("See also") } + } table(kind = ContentKind.Comment) { platforms.flatMap { platform -> seeAlsoTags.mapNotNull { (_, see) -> diff --git a/plugins/base/src/main/kotlin/translators/documentables/PageContentBuilder.kt b/plugins/base/src/main/kotlin/translators/documentables/PageContentBuilder.kt index d9a78d0d..a99fc6b3 100644 --- a/plugins/base/src/main/kotlin/translators/documentables/PageContentBuilder.kt +++ b/plugins/base/src/main/kotlin/translators/documentables/PageContentBuilder.kt @@ -74,13 +74,14 @@ open class PageContentBuilder( fun header( level: Int, kind: Kind = ContentKind.Main, + platformData: Set<PlatformData> = mainPlatformData, styles: Set<Style> = mainStyles, extra: PropertyContainer<ContentNode> = mainExtra, block: DocumentableContentBuilder.() -> Unit ) { contents += ContentHeader( level, - contentFor(mainDRI, mainPlatformData, kind, styles, extra, block) + contentFor(mainDRI, platformData, kind, styles, extra, block) ) } |