diff options
author | Simon Ogorodnik <Simon.Ogorodnik@jetbrains.com> | 2018-10-03 04:09:09 +0300 |
---|---|---|
committer | Simon Ogorodnik <Simon.Ogorodnik@jetbrains.com> | 2018-10-03 04:09:09 +0300 |
commit | 5719e5c5f7d90aa606421381a0e4e4ffbf1b9066 (patch) | |
tree | 5929458049dfbd6fe91833e1fcff61dee9ae1e02 /core/src/main | |
parent | 896776306e15f1e5bbdc771a3e58d0ffd8b45198 (diff) | |
download | dokka-5719e5c5f7d90aa606421381a0e4e4ffbf1b9066.tar.gz dokka-5719e5c5f7d90aa606421381a0e4e4ffbf1b9066.tar.bz2 dokka-5719e5c5f7d90aa606421381a0e4e4ffbf1b9066.zip |
Append notices platforms as header instead of tags
Diffstat (limited to 'core/src/main')
-rw-r--r-- | core/src/main/kotlin/Formats/KotlinWebsiteHtmlFormatService.kt | 15 | ||||
-rw-r--r-- | core/src/main/kotlin/Formats/StructuredFormatService.kt | 11 |
2 files changed, 20 insertions, 6 deletions
diff --git a/core/src/main/kotlin/Formats/KotlinWebsiteHtmlFormatService.kt b/core/src/main/kotlin/Formats/KotlinWebsiteHtmlFormatService.kt index 65c93e72..9ffefcab 100644 --- a/core/src/main/kotlin/Formats/KotlinWebsiteHtmlFormatService.kt +++ b/core/src/main/kotlin/Formats/KotlinWebsiteHtmlFormatService.kt @@ -125,10 +125,6 @@ open class KotlinWebsiteHtmlOutputBuilder( } private fun calculatePlatforms(platforms: Set<String>): Map<String, List<String>> { - - fun String.isKotlinVersion() = this.startsWith("Kotlin") - fun String.isJREVersion() = this.startsWith("JRE", ignoreCase=true) - val kotlinVersion = platforms.singleOrNull(String::isKotlinVersion)?.removePrefix("Kotlin ") val jreVersion = platforms.filter(String::isJREVersion).min()?.takeUnless { it.endsWith("6") } val targetPlatforms = platforms.filterNot { it.isKotlinVersion() || it.isJREVersion() } @@ -176,6 +172,13 @@ open class KotlinWebsiteHtmlOutputBuilder( to.append(" / ") } + override fun appendPlatformsAsText(platforms: Set<String>) { + appendHeader(5) { + to.append("For ") + platforms.filterNot { it.isJREVersion() }.joinTo(to) + } + } + override fun appendSampleBlockCode(language: String, imports: () -> Unit, body: () -> Unit) { div(to, "sample") { appendBlockCode(language) { @@ -226,3 +229,7 @@ class KotlinWebsiteHtmlFormatService @Inject constructor( override fun createOutputBuilder(to: StringBuilder, location: Location) = KotlinWebsiteHtmlOutputBuilder(to, location, generator, languageService, extension, impliedPlatforms, templateService) } + + +private fun String.isKotlinVersion() = this.startsWith("Kotlin") +private fun String.isJREVersion() = this.startsWith("JRE", ignoreCase=true)
\ No newline at end of file diff --git a/core/src/main/kotlin/Formats/StructuredFormatService.kt b/core/src/main/kotlin/Formats/StructuredFormatService.kt index 647f2dfb..4496d652 100644 --- a/core/src/main/kotlin/Formats/StructuredFormatService.kt +++ b/core/src/main/kotlin/Formats/StructuredFormatService.kt @@ -281,6 +281,13 @@ abstract class StructuredOutputBuilder(val to: StringBuilder, appendTableRow(block) } + protected open fun appendPlatformsAsText(platforms: Set<String>) { + if (platforms.isNotEmpty()) { + appendLine() + appendText(platforms.joinToString(prefix = "(", postfix = ")")) + } + } + protected open fun appendPlatforms(platforms: Set<String>) { if (platforms.isNotEmpty()) { appendLine() @@ -388,7 +395,7 @@ abstract class StructuredOutputBuilder(val to: StringBuilder, if (content.isEmpty()) continue appendAsPlatformDependentBlock(effectivePlatformsForMembers(origins)) { platforms -> if (groupByContent.count { !it.key.isEmpty() } > 1) { - appendPlatforms(platforms) + appendPlatformsAsText(platforms) } appendContent(content.summary) content.appendDescription() @@ -622,7 +629,7 @@ abstract class StructuredOutputBuilder(val to: StringBuilder, if (content.isEmpty()) continue appendAsPlatformDependentBlock(effectivePlatformsForMembers(origins)) { platforms -> if (groupByContent.keys.count { !it.isEmpty() } > 1) { - appendPlatforms(platforms) + appendPlatformsAsText(platforms) } appendContent(content) } |