KorTE is a asynchronous template engine for Multiplatform Kotlin 1.3.
It is a non-strict super set of twig / django / atpl.js template engines and can support liquid templaet engine too with frontmatter.
It has out of the box support for ktor and vert.x.
It works on JVM and JS out of the box. But can also work on Native when using untyped model data or making models to implement the DynamicType interface.
It allows to call suspend methods from within templates.
- ACE: https://korlibs.github.io/korte-samples/korte-sample-browser/web/
- OLD: https://korlibs.github.io/kor_samples/korte1/
<html><head></head><body>
{% block content %}default content{% endblock %}
</body></html>
{% extends "_base.html" %}
{% block content %}
<div>{% block left %}default left column{% endblock %}</div>
<div>{% block right %}default right column{% endblock %}</div>
{% endblock %}
{% extends "_two_columns.html" %}
{% block left %}
My left column. Hello {{ name|upper }}
{% endblock %}
{% block right %}
My prefix {{ parent() }} with additional content
{% endblock %}
val templates = Templates(resourcesVfs)
println(templates.render("index.html", mapOf("name" to "world")))