casid / jte

Secure and speedy templates for Java and Kotlin.
https://jte.gg
Apache License 2.0
737 stars 54 forks source link

For Loops won't compile for Kotlin #320

Closed MataMercer closed 6 months ago

MataMercer commented 6 months ago

JTE version: 3.1.6 Lang: Kotlin 1.9.21

None of the for loops compile. Even if I copy for loop code from the docs, such as the following:

@for(i in 0..10)
<li>i is ${i}</li>
@endfor

My IDE says cannot resolve symbol 'i' and semicolons expected before the 0, after the 0 and after 10. Other than for loops, my JTE code works fine.

EDIT: It seems like JTE only takes Java syntax, not Kotlin, which is what I'm using for this project. Was there something I didn't configure? I'm using it with Javalin.

casid commented 6 months ago

@MataMercer could it be, that the file ending of your template is .jte?

If you want to use Kotlin expressions instead of Java expressions the templates need to end with .kte.

MataMercer commented 6 months ago

Yes it is. Oh thank you very much!