korte

Template Engine for Multiplatform Kotlin

Лицензия

Лицензия

Категории

Категории

Данные
Группа

Группа

com.soywiz.korlibs.korte
Идентификатор

Идентификатор

korte-metadata
Последняя версия

Последняя версия

2.0.8
Дата

Дата

Тип

Тип

pom.sha512
Описание

Описание

korte
Template Engine for Multiplatform Kotlin
Ссылка на сайт

Ссылка на сайт

https://github.com/korlibs/korte
Система контроля версий

Система контроля версий

https://github.com/korlibs/korte

Скачать korte-metadata

Зависимости

Библиотека не имеет зависимостей. Это самодостаточное приложение, которое не зависит ни от каких других библиотек.

Модули Проекта

Данный проект не имеет модулей.

Korte

Korte

Template Engine for Multiplatform Kotlin

Build Status Maven Version Discord

Support korte

If you like korte, or want your company logo here, please consider becoming a sponsor ★,
in addition to ensure the continuity of the project, you will get exclusive content.

Info:

KorTE is an asynchronous templating engine for Multiplatform Kotlin 1.3+.

It is a non-strict super set of twig / django / atpl.js template engines and can support liquid templating engine as well with frontmatter.

It has out of the box support for ktor and vert.x.

It works on JVM and JS out of the box. And on Native with untyped model data or by making the models implement the DynamicType interface.

Because asynchrony is in its name and soul, it allows to call suspending methods from within your templates.

Documentation:

Live demo

Example

resources/views/_base.html

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

resources/views/_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 %}

resources/views/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 renderer = Templates(ResourceTemplateProvider("views"), cache = true)
val output = templates.render("index.html", mapOf("name" to "world"))
println(output)

class ResourceTemplateProvider(private val basePath: String) : TemplateProvider {
     override suspend fun get(template: String): String? {
         return this::class.java.classLoader.getResource(Paths.get(basePath, template).toString()).readText()
     }
 }
com.soywiz.korlibs.korte
Kotlin cORoutine Libraries for fullstack development - https://bintray.com/korlibs/korlibs - https://github.com/korlibs

Версии библиотеки

Версия
2.0.8
2.0.7