From 64414ce984bc86e09b8724adbd01f1cb2646c17e Mon Sep 17 00:00:00 2001 From: Dmitry Jemerov Date: Fri, 29 May 2015 13:52:43 +0200 Subject: apply code cleanup; fix couple of deprecations manually --- src/Kotlin/ContentBuilder.kt | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'src/Kotlin/ContentBuilder.kt') diff --git a/src/Kotlin/ContentBuilder.kt b/src/Kotlin/ContentBuilder.kt index 3dd5c00e..01feef34 100644 --- a/src/Kotlin/ContentBuilder.kt +++ b/src/Kotlin/ContentBuilder.kt @@ -138,14 +138,14 @@ fun DocumentationBuilder.functionBody(descriptor: DeclarationDescriptor, functio is JetDeclarationWithBody -> ContentBlockCode().let() { val bodyExpression = psiElement.getBodyExpression() when (bodyExpression) { - is JetBlockExpression -> bodyExpression.getText().trim("{", "}") + is JetBlockExpression -> bodyExpression.getText().removeSurrounding("{", "}") else -> bodyExpression.getText() } } else -> psiElement.getText() } - val lines = text.trimTrailing().split("\n").filterNot { it.length() == 0 } + val lines = text.trimEnd().split("\n".toRegex()).toTypedArray().filterNot { it.length() == 0 } val indent = lines.map { it.takeWhile { it.isWhitespace() }.count() }.min() ?: 0 val finalText = lines.map { it.drop(indent) }.join("\n") return ContentBlockCode("kotlin").let() { it.append(ContentText(finalText)); it } -- cgit