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:
parent
68358201bf
commit
0f00887736
6 changed files with 96 additions and 8 deletions
|
@ -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())
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue