From fd6c34d92b7409d3aedd9416c7b06f9c48fe2631 Mon Sep 17 00:00:00 2001 From: Kamil Doległo Date: Wed, 15 May 2019 12:13:13 +0200 Subject: Fix SinceKotlin --- .../main/kotlin/Formats/StructuredFormatService.kt | 22 ++++++++++++---------- .../DokkaConfigurationTestImplementations.kt | 2 +- core/testdata/format/sinceKotlin.html | 2 +- core/testdata/format/sinceKotlin.md | 2 +- core/testdata/format/sinceKotlin.package.md | 6 ++---- core/testdata/format/sinceKotlinWide.package.md | 4 ++-- 6 files changed, 19 insertions(+), 19 deletions(-) (limited to 'core') diff --git a/core/src/main/kotlin/Formats/StructuredFormatService.kt b/core/src/main/kotlin/Formats/StructuredFormatService.kt index a6c1b57f..e088b46d 100644 --- a/core/src/main/kotlin/Formats/StructuredFormatService.kt +++ b/core/src/main/kotlin/Formats/StructuredFormatService.kt @@ -110,10 +110,8 @@ abstract class StructuredOutputBuilder(val to: StringBuilder, abstract fun appendText(text: String) open fun appendSinceKotlin(version: String) { - appendParagraph { appendText("Since: ") appendCode { appendText(version) } - } } open fun appendSectionWithTag(section: ContentSection) { @@ -279,9 +277,7 @@ abstract class StructuredOutputBuilder(val to: StringBuilder, } protected open fun appendPlatformsAsText(platforms: PlatformsData) { - if (platforms.isNotEmpty()) { - appendText(platforms.keys.joinToString(prefix = "(", postfix = ") ")) - } + appendPlatforms(platforms) } protected open fun appendPlatforms(platforms: PlatformsData) { @@ -757,15 +753,14 @@ abstract class StructuredOutputBuilder(val to: StringBuilder, appendTable("Name", "Summary") { appendTableBody { - for ((memberLocation, members) in membersMap) { - val platforms = effectivePlatformsForMembers(members) + for ((memberLocation, membersList) in membersMap) { + val platforms = effectivePlatformsForMembers(membersList) // val platforms = if (platformsBasedOnMembers) // members.flatMapTo(mutableSetOf()) { platformsOfItems(it.members) } + elementPlatforms // else // elementPlatforms - val summarized = computeSummarySignatures(members) - + val summarized = computeSummarySignatures(membersList) appendIndexRow(platforms) { appendTableCell { @@ -774,8 +769,15 @@ abstract class StructuredOutputBuilder(val to: StringBuilder, } // appendHeader(level = 4) { // appendParagraph { - appendLink(memberLocation) + appendLink(memberLocation) + + if (node.sinceKotlin != null) { + appendSinceKotlin(node.sinceKotlin.toString()) + } + if (membersList.singleOrNull()?.sinceKotlin != null){ + wrap(" (", ")"){ appendSinceKotlin(membersList.single().sinceKotlin.toString()) } + } // } // if (members.singleOrNull()?.kind != NodeKind.ExternalClass) { // appendPlatforms(platforms) diff --git a/core/src/test/kotlin/DokkaConfigurationTestImplementations.kt b/core/src/test/kotlin/DokkaConfigurationTestImplementations.kt index 19ec1e64..a6f427b1 100644 --- a/core/src/test/kotlin/DokkaConfigurationTestImplementations.kt +++ b/core/src/test/kotlin/DokkaConfigurationTestImplementations.kt @@ -65,7 +65,7 @@ class PassConfigurationImpl ( override val collectInheritedExtensionsFromLibraries: Boolean = false, override val analysisPlatform: Platform = Platform.DEFAULT, override val targets: List = emptyList(), - override val sinceKotlin: String = "1.0" + override val sinceKotlin: String? = null ): DokkaConfiguration.PassConfiguration { private val defaultLinks = run { val links = mutableListOf() diff --git a/core/testdata/format/sinceKotlin.html b/core/testdata/format/sinceKotlin.html index 12cdd87f..1173a8ab 100644 --- a/core/testdata/format/sinceKotlin.html +++ b/core/testdata/format/sinceKotlin.html @@ -14,7 +14,7 @@ -<init> +<init>Since: 1.1 Since1.1()

Useful

diff --git a/core/testdata/format/sinceKotlin.md b/core/testdata/format/sinceKotlin.md index 188784d6..e9b29229 100644 --- a/core/testdata/format/sinceKotlin.md +++ b/core/testdata/format/sinceKotlin.md @@ -8,5 +8,5 @@ Useful ### Constructors -| [<init>](-init-.md) | `Since1.1()`
Useful | +| [<init>](-init-.md)Since: `1.1` | `Since1.1()`
Useful | diff --git a/core/testdata/format/sinceKotlin.package.md b/core/testdata/format/sinceKotlin.package.md index eabf88d5..92197648 100644 --- a/core/testdata/format/sinceKotlin.package.md +++ b/core/testdata/format/sinceKotlin.package.md @@ -1,10 +1,8 @@ -[test](./index.md) +[test](../index.md) ## Package <root> -**Platform and version requirements:** Kotlin 1.1 - ### Types -| [Since1.1](-since1.1/index.md)
(Kotlin 1.1) | `class Since1.1`
Useful | +| [Since1.1](-since1.1/index.md) (Since: `1.1`) | `class Since1.1`
Useful | diff --git a/core/testdata/format/sinceKotlinWide.package.md b/core/testdata/format/sinceKotlinWide.package.md index d2c2b6d8..fd7d45aa 100644 --- a/core/testdata/format/sinceKotlinWide.package.md +++ b/core/testdata/format/sinceKotlinWide.package.md @@ -4,6 +4,6 @@ ### Types -| [Since1.1](-since1.1/index.md)
(Kotlin 1.1) | `class Since1.1`
Useful | -| [Since1.2](-since1.2/index.md)
(Kotlin 1.2) | `class Since1.2`
Useful also | +| [Since1.1](-since1.1/index.md) (Since: `1.1`) | `class Since1.1`
Useful | +| [Since1.2](-since1.2/index.md) (Since: `1.2`) | `class Since1.2`
Useful also | -- cgit