korlibs-archive / korte Goto Github PK
View Code? Open in Web Editor NEWKotlin cORoutines Template Engine for Multiplatform Kotlin
Home Page: https://korlibs.soywiz.com/korte/
License: MIT License
Kotlin cORoutines Template Engine for Multiplatform Kotlin
Home Page: https://korlibs.soywiz.com/korte/
License: MIT License
As of right now, it appears there is no way to convert the subject
in the Ctx
to a LocalDate
to make comparisons in Kotlin.
fun testUser(): User? {
val x = """{
"key": "test user",
"firstName": "test",
"lastName": "test"
}"""
return Json.decodeFromString(User.serializer(), x)
}
@serializable
data class User(val key: String, val firstName: String, val lastName: String) :
DynamicType by DynamicType({
register(User::key)
register(User::firstName)
register(User::lastName)
})
i am exposing this function to use it in a expression where the user also has its properties exposed
evaluating testUser().key is working when testing on android but on IOS i am receiving a segmentation fault
Example case:
@Serializable data class Output(val value: String, val index: Int) : DynamicType<Output> by DynamicType({
register(Output::value)
register(Output::index)
})
val values = listOf(Output("Yes", 0))
val template = Template("{{values[0].value}}", TemplateConfig())
return template(this) //works on android. On IOS i am receiving a segmentation crash
hello:
- a
- b
world:
- c
- d
Hi,
any chance KorTE gets published on Maven Central?
I'm using Korte for a non-HTML template. The template engine is escaping values with htmlspecialchars
. I can work around it with RawString
, but it'd be nice if I could turn off the escaping globally, or provide an alternative or custom escaping mechanism.
Found a kotlin native problem here:
expect val Mapper2: ObjectMapper2
should be marked with @SharedImmutable
or @ThreadLocal
otherwise, we cannot use korte from a background thread.
@Test
fun testChunk2() {
assertEquals(
mapOf(
"layout" to "post",
"title" to "demo: 2D test demo lorem ipsum",
"title_es" to "lorem: ipsum sim de 2D te test",
"date" to "2009-05-05T10:45:00.000+02:00",
"author" to "abc def hij",
"tags" to listOf("lorem", "ipsum"),
"feature_image" to "/images/2009/ipsum.png",
"modified_time" to "2011-05-14T15:39:49.185+02:00",
"thumbnail" to "http://1.bp.example.com/-lorem/ipsum/sit/AMEN-demo/s72-c/test.png",
"blogger_id" to "tag:blogger.com,1999:blog-1212121212121212121212122.post-12121212121212121212121",
"blogger_orig_url" to "http://blog.example.es/2009/05/demo-loreim-ip-sit-demo.html"
),
Yaml.decode(
"""
layout: post
title: 'demo: 2D test demo lorem ipsum'
title_es: 'lorem: ipsum sim de 2D te test'
date: '2009-05-05T10:45:00.000+02:00'
author: abc def hij
tags:
- lorem
- ipsum
feature_image: /images/2009/ipsum.png
modified_time: '2011-05-14T15:39:49.185+02:00'
thumbnail: http://1.bp.example.com/-lorem/ipsum/sit/AMEN-demo/s72-c/test.png
blogger_id: tag:blogger.com,1999:blog-1212121212121212121212122.post-12121212121212121212121
blogger_orig_url: http://blog.example.es/2009/05/demo-loreim-ip-sit-demo.html
""".trimIndent()
)
)
}
The capture block is registred without endcapture same as extending example: https://docs.korge.org/korte/extending/#tags
Not working the tag: https://docs.korge.org/korte/tags/#capture
I was trying to access the latitude
and longitude
fields of a LatLng
instance on Android. While putting the entire object in my template rendered correctly (implicitly using the object's toString()
method) trying to access one of its fields didn't work.
Looking at the code here it appears that the JvmObjectMapper2
only attempts to invoke the getter when accessing a property; never trying to access the field directly in the absence of a getter. This line would indicate that the mapper considers a field a potential property, and the MyProperty
subclass contains everything needed to access a field, but the mapper itself never tries to access it (nor does any other class).
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.