From 2ceff9c41cff42b7fb3ffe75ea36a7c570f3615b Mon Sep 17 00:00:00 2001 From: Simon Ogorodnik Date: Fri, 17 Feb 2017 17:40:32 +0300 Subject: Fix for GH-136 GH-137 Blank lines inside code blocks are not preserved --- core/src/main/kotlin/Formats/StructuredFormatService.kt | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) (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..0e2085c9 100644 --- a/core/src/main/kotlin/Formats/StructuredFormatService.kt +++ b/core/src/main/kotlin/Formats/StructuredFormatService.kt @@ -144,12 +144,9 @@ abstract class StructuredOutputBuilder(val to: StringBuilder, is ContentBlockSampleCode, is ContentBlockCode -> { content as ContentBlockCode fun ContentBlockCode.appendBlockCodeContent() { - for ((index, contentNode) in this.children.withIndex()) { - appendContent(contentNode) - if (index < this.children.size - 1) { - to.append("\n") - } - } + children + .dropWhile { it is ContentText && it.text.isBlank() } + .forEach { appendContent(it) } } when (content) { is ContentBlockSampleCode -> -- cgit