diff options
author | Simon Ogorodnik <sem-oro@yandex.ru> | 2017-02-28 12:24:31 +0300 |
---|---|---|
committer | Simon Ogorodnik <sem-oro@yandex.ru> | 2017-02-28 12:24:31 +0300 |
commit | 6276fd0e68085c9b0994f8f947bf904b9b285b34 (patch) | |
tree | 8a725f2d4113bad7f0479677f49d619566601541 /core/src/main/kotlin | |
parent | d43d47b9486bbd7e926cf1a3fc6372f2a457a5e5 (diff) | |
download | dokka-6276fd0e68085c9b0994f8f947bf904b9b285b34.tar.gz dokka-6276fd0e68085c9b0994f8f947bf904b9b285b34.tar.bz2 dokka-6276fd0e68085c9b0994f8f947bf904b9b285b34.zip |
Split data tags for kotlin-website format
Diffstat (limited to 'core/src/main/kotlin')
-rw-r--r-- | core/src/main/kotlin/Formats/KotlinWebsiteFormatService.kt | 17 |
1 files changed, 14 insertions, 3 deletions
diff --git a/core/src/main/kotlin/Formats/KotlinWebsiteFormatService.kt b/core/src/main/kotlin/Formats/KotlinWebsiteFormatService.kt index 0444a25a..e5657091 100644 --- a/core/src/main/kotlin/Formats/KotlinWebsiteFormatService.kt +++ b/core/src/main/kotlin/Formats/KotlinWebsiteFormatService.kt @@ -3,6 +3,7 @@ package org.jetbrains.dokka import com.google.inject.Inject import com.google.inject.name.Named import org.jetbrains.dokka.Utilities.impliedPlatformsName +import org.jetbrains.kotlin.utils.addToStdlib.ifNotEmpty open class KotlinWebsiteOutputBuilder(to: StringBuilder, @@ -147,9 +148,19 @@ open class KotlinWebsiteOutputBuilder(to: StringBuilder, } override fun appendIndexRow(platforms: Set<String>, block: () -> Unit) { - if (platforms.isNotEmpty()) - wrap("<tr data-platform=\"${platforms.joinToString()}\">", "</tr>", block) - else + if (platforms.isNotEmpty()) { + fun String.isKotlinVersion() = this.startsWith("Kotlin") + fun String.isJREVersion() = this.startsWith("JRE") + val kotlinVersion = platforms.singleOrNull(String::isKotlinVersion) + val jreVersion = platforms.singleOrNull(String::isJREVersion) + val targetPlatforms = platforms.filterNot { it.isKotlinVersion() || it.isJREVersion() } + + val kotlinVersionAttr = kotlinVersion?.let { " data-kotlin-version=\"$it\"" } ?: "" + val jreVersionAttr = jreVersion?.let { " data-jre-version=\"$it\"" } ?: "" + val platformsAttr = targetPlatforms.ifNotEmpty { " data-platform=\"${targetPlatforms.joinToString()}\"" } ?: "" + + wrap("<tr$platformsAttr$kotlinVersionAttr$jreVersionAttr>", "</tr>", block) + } else appendTableRow(block) } } |