optimize Ktxt2 export

This commit is contained in:
2021-10-29 15:48:51 -04:00
parent f3460ab58f
commit 678ae27230

View File

@@ -71,9 +71,12 @@
(+= sourceText source)
(dictSet interp.variables "source" source)
(+= outputText
(let [escapedOutput
(output.replace "\"" "\\\"")]
(interp.evalKiss "\"${escapedOutput}\""))))
// Don't run the expensive "evalKiss" if there is no interpolation in the block!
(if (= -1 (output.indexOf "\$"))
output
(let [escapedOutput
(output.replace "\"" "\\\"")]
(interp.evalKiss "\"${escapedOutput}\"")))))
(otherwise)))
[sourceText outputText]))