diff options
author | Simon Ogorodnik <Simon.Ogorodnik@jetbrains.com> | 2017-02-09 17:14:34 +0300 |
---|---|---|
committer | Simon Ogorodnik <Simon.Ogorodnik@jetbrains.com> | 2017-02-09 17:14:34 +0300 |
commit | 4517ce588431fc6080bad24d947c53c8d82fcaa0 (patch) | |
tree | 9da781c2849fcd1e0d251a03e425c6b27111aa7c | |
parent | cf4bb4673730cc0787784380fc986efec8f8e9fb (diff) | |
download | dokka-4517ce588431fc6080bad24d947c53c8d82fcaa0.tar.gz dokka-4517ce588431fc6080bad24d947c53c8d82fcaa0.tar.bz2 dokka-4517ce588431fc6080bad24d947c53c8d82fcaa0.zip |
Removed leading newline
4 files changed, 2 insertions, 8 deletions
diff --git a/core/src/main/kotlin/Samples/DefaultSampleProcessingService.kt b/core/src/main/kotlin/Samples/DefaultSampleProcessingService.kt index e9cf5e18..1eb0c114 100644 --- a/core/src/main/kotlin/Samples/DefaultSampleProcessingService.kt +++ b/core/src/main/kotlin/Samples/DefaultSampleProcessingService.kt @@ -42,9 +42,8 @@ open class DefaultSampleProcessingService return ContentBlockSampleCode().apply { append(ContentText("//Source not found: $functionName")) } } - val text = processSampleBody(psiElement) - - val lines = text.trimEnd().split("\n") + val text = processSampleBody(psiElement).trim { it == '\n' || it == '\r' }.trimEnd() + val lines = text.split("\n") val indent = lines.filter(String::isNotBlank).map { it.takeWhile(Char::isWhitespace).count() }.min() ?: 0 val finalText = lines.map { it.drop(indent) }.joinToString("\n") diff --git a/core/src/test/kotlin/model/CommentTest.kt b/core/src/test/kotlin/model/CommentTest.kt index 0d6a3374..0d919128 100644 --- a/core/src/test/kotlin/model/CommentTest.kt +++ b/core/src/test/kotlin/model/CommentTest.kt @@ -160,19 +160,16 @@ line two""", toTestString()) |} |[/code] |[code lang=kotlin] - | |if (true) { | println(property) |} |[/code] |[code lang=kotlin] - | |if (true) { | println(property) |} |[/code] |[code lang=kotlin] - | |if (true) { | println(property) |} diff --git a/core/testdata/format/website-samples/newLinesInSamples.md b/core/testdata/format/website-samples/newLinesInSamples.md index 9d3af798..448725c3 100644 --- a/core/testdata/format/website-samples/newLinesInSamples.md +++ b/core/testdata/format/website-samples/newLinesInSamples.md @@ -14,7 +14,6 @@ layout: api fun main(args: Array<String>) { //sampleStart - val words = listOf("a", "abc", "ab", "def", "abcd") val byLength = words.groupBy { it.length } diff --git a/core/testdata/format/website-samples/sampleWithAsserts.md b/core/testdata/format/website-samples/sampleWithAsserts.md index e5284258..98d7df33 100644 --- a/core/testdata/format/website-samples/sampleWithAsserts.md +++ b/core/testdata/format/website-samples/sampleWithAsserts.md @@ -14,7 +14,6 @@ layout: api fun main(args: Array<String>) { //sampleStart - println(a()) // Hello, Work println("a() == b() is ${a() == b()}") // true //sampleEnd |