1
0
Fork 0
mirror of https://github.com/ethauvin/kobalt.git synced 2025-04-26 08:27:12 -07:00

Better Java template.

This commit is contained in:
Cedric Beust 2016-02-27 19:08:37 -08:00
parent 68358201bf
commit 0f00887736
6 changed files with 96 additions and 8 deletions

View file

@ -0,0 +1,19 @@
package com.beust.kobalt.internal
import com.github.mustachejava.DefaultMustacheFactory
import java.io.*
class Mustache {
companion object {
fun generateFile(mustacheIns: InputStream, createdFile: File, map: Map<String, Any>) {
val sw = StringWriter()
val pw = PrintWriter(sw)
var mf = DefaultMustacheFactory()
mf.compile(InputStreamReader(mustacheIns), "kobalt").execute(pw, map).flush()
with(createdFile) {
parentFile.mkdirs()
writeText(sw.toString())
}
}
}
}