Rename templates to get syntax highlighting

This commit is contained in:
Hubert Van De Walle 2020-07-18 17:21:52 +02:00
parent fda355a690
commit cdfe1d14ef
13 changed files with 7 additions and 1 deletions

View File

@ -4,7 +4,13 @@ import com.soywiz.korte.TemplateProvider
class ResourceTemplateProvider : TemplateProvider { class ResourceTemplateProvider : TemplateProvider {
override suspend fun get(template: String): String? { override suspend fun get(template: String): String? {
val resource = "/templates/$template"
val tmp = when {
template.endsWith(".html") -> template.substringBefore(".html")
else -> template
}
val resource = "/templates/${tmp}.twig"
return this.javaClass.getResource(resource)?.readText() return this.javaClass.getResource(resource)?.readText()
} }
} }