From 7fa258873eab770577879e9721c0864449ba1114 Mon Sep 17 00:00:00 2001 From: Simon Ogorodnik Date: Thu, 16 Feb 2017 21:28:16 +0300 Subject: Dokka now can detect and recognize SinceKotlin --- core/src/main/kotlin/Formats/StructuredFormatService.kt | 15 +++++++++++++++ 1 file changed, 15 insertions(+) (limited to 'core/src/main/kotlin/Formats') diff --git a/core/src/main/kotlin/Formats/StructuredFormatService.kt b/core/src/main/kotlin/Formats/StructuredFormatService.kt index 7896bcd8..1488a4f9 100644 --- a/core/src/main/kotlin/Formats/StructuredFormatService.kt +++ b/core/src/main/kotlin/Formats/StructuredFormatService.kt @@ -59,6 +59,13 @@ abstract class StructuredOutputBuilder(val to: StringBuilder, abstract fun appendText(text: String) + open fun appendSinceKotlin(version: String) { + appendParagraph { + appendText("Available since Kotlin: ") + appendCode { appendText(version) } + } + } + open fun appendSymbol(text: String) { appendText(text) } @@ -284,12 +291,14 @@ abstract class StructuredOutputBuilder(val to: StringBuilder, } item.appendOverrides() item.appendDeprecation() + item.appendSinceKotlin() } // All items have exactly the same documentation, so we can use any item to render it val item = items.first() item.details(NodeKind.OverloadGroupNote).forEach { appendContent(it.content) } + appendContent(item.content.summary) item.appendDescription() } @@ -312,6 +321,12 @@ abstract class StructuredOutputBuilder(val to: StringBuilder, } } + private fun DocumentationNode.appendSinceKotlin() { + val annotation = sinceKotlin ?: return + val value = annotation.detail(NodeKind.Parameter).detail(NodeKind.Value) + appendSinceKotlin(value.name) + } + private fun DocumentationNode.appendDeprecation() { if (deprecation != null) { val deprecationParameter = deprecation!!.details(NodeKind.Parameter).firstOrNull() -- cgit