Don't cache includes

This commit is contained in:
Shadowfacts 2017-08-06 14:59:19 -04:00
parent 461549eb92
commit 750ab89482
Signed by: shadowfacts
GPG Key ID: 94A5AB95422746E5
1 changed files with 3 additions and 3 deletions

View File

@ -29,7 +29,7 @@ val _env = bindings["_env"] as net.shadowfacts.ekt.EKT.TemplateEnvironment
val _result = StringBuilder() val _result = StringBuilder()
fun echo(it: Any) { _result.append(it) } fun echo(it: Any) { _result.append(it) }
fun include(include: String) { fun include(include: String) {
val env = net.shadowfacts.ekt.EKT.TemplateEnvironment(include, _env) val env = net.shadowfacts.ekt.EKT.TemplateEnvironment(include, _env, cacheDir = null)
echo(net.shadowfacts.ekt.EKT.render(env, env.include)) echo(net.shadowfacts.ekt.EKT.render(env, env.include))
} }
""" """
@ -139,12 +139,12 @@ _result.toString()
constructor(name: String, templateDir: File, includeDir: File, cacheDir: File?, init: DataProvider.() -> Unit): constructor(name: String, templateDir: File, includeDir: File, cacheDir: File?, init: DataProvider.() -> Unit):
this(name, templateDir, includeDir, cacheDir, DataProvider.init(init)) this(name, templateDir, includeDir, cacheDir, DataProvider.init(init))
constructor(name: String, parent: TemplateEnvironment) { constructor(name: String, parent: TemplateEnvironment, cacheDir: File? = parent.cacheDir) {
this.rootName = parent.rootName this.rootName = parent.rootName
this.name = name this.name = name
this.templateDir = parent.templateDir this.templateDir = parent.templateDir
this.includeDir = parent.includeDir this.includeDir = parent.includeDir
this.cacheDir = parent.cacheDir this.cacheDir = cacheDir
this.data = parent.data this.data = parent.data
} }