Skip to content
Kotlin cORoutines Template Engine for Multiplatform Kotlin
Branch: master
Clone or download
Latest commit 7461aa4 Mar 24, 2019
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
@old Vertx support Mar 23, 2019
buildSrc Small adjustments Mar 22, 2019
docs
gradle/wrapper Go back to gradle 5.2.1 since 5.3 is marking dependencies as runtime Mar 23, 2019
korte-korio WIP Make KorTE dependency-less (except for the kotlin runtime) Mar 24, 2019
korte-ktor Some fixes Mar 24, 2019
korte-vertx WIP Make KorTE dependency-less (except for the kotlin runtime) Mar 24, 2019
korte Improved error reporting Mar 24, 2019
.gitignore 1.0.0-alpha-1 Mar 22, 2019
.travis.yml Support kotlin native for classes implementing the DynamicType interface Mar 22, 2019
LICENSE Ktor support Mar 22, 2019
README.md Update Live Demo Mar 23, 2019
README.md.old Update README.md Mar 23, 2019
build.gradle WIP Make KorTE dependency-less (except for the kotlin runtime) Mar 24, 2019
gradle.properties 1.1.1 - Concurrency quickfix Mar 24, 2019
gradlew Go back to gradle 5.2.1 since 5.3 is marking dependencies as runtime Mar 23, 2019
gradlew.bat Go back to gradle 5.2.1 since 5.3 is marking dependencies as runtime Mar 23, 2019
gradlew_linux
gradlew_win Some improvements Mar 22, 2019
gradlew_wine Some improvements Mar 22, 2019
publish Some improvements Mar 22, 2019
publish_local Some improvements Mar 22, 2019
settings.gradle 1.0.0-alpha-1 Mar 22, 2019
travis_win.bat

README.md

Kotlin cORoutines Template Engine

Build Status Maven Version

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.

Documentation:

Live demo

Example

_base.html

<html><head></head><body>
{% block content %}default content{% endblock %}
</body></html>

_two_columns.html

{% extends "_base.html" %}
{% block content %}
    <div>{% block left %}default left column{% endblock %}</div>
    <div>{% block right %}default right column{% endblock %}</div>
{% endblock %}

index.html

{% extends "_two_columns.html" %}
{% block left %}
    My left column. Hello {{ name|upper }}
{% endblock %}
{% block right %}
    My prefix {{ parent() }} with additional content
{% endblock %}

code.kt

val templates = Templates(resourcesVfs)
println(templates.render("index.html", mapOf("name" to "world")))
You can’t perform that action at this time.