diff --git a/src/main/kotlin/net/shadowfacts/ekt/EKT.kt b/src/main/kotlin/net/shadowfacts/ekt/EKT.kt index ab75f2f..cd22154 100644 --- a/src/main/kotlin/net/shadowfacts/ekt/EKT.kt +++ b/src/main/kotlin/net/shadowfacts/ekt/EKT.kt @@ -20,7 +20,7 @@ object EKT { "#" to { s -> s + "/*" } ) - private val startStringRegex = Regex("(?:^|[^\\\\])([:=#])]\n?") + private val startStringRegex = Regex("(?:^|[^\\\\])([:=#])]") private val endStringRegex = Regex("\\[([:=#])") private val scriptPrefix = """ @@ -38,7 +38,7 @@ _result.toString() fun render(template: String, data: Map, dumpGeneratedScript: File? = null): String { @Suppress("NAME_SHADOWING") var template = template - template = template.replace("\"", "\\\"").replace("$", "\${'$'}") + template = template.replace("$", "\${'$'}") template = ":]$template[:" template = template.replace(startStringRegex, { val c = it.groups[1]!!.value diff --git a/src/test/kotlin/net/shadowfacts/ekt/Test.kt b/src/test/kotlin/net/shadowfacts/ekt/Test.kt index 96fbb11..65ede03 100644 --- a/src/test/kotlin/net/shadowfacts/ekt/Test.kt +++ b/src/test/kotlin/net/shadowfacts/ekt/Test.kt @@ -7,7 +7,9 @@ import java.io.File */ fun main(args: Array) { val res = EKT.render(File("template.ekt"), mapOf( - "value" to 11 + "title" to "EKT Test", + "body" to "some test content", + "value" to 42 ), dumpGeneratedScript = File("script.kts")) File("result.txt").apply {