casid / jte

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

jte 3.0 #230

Closed casid closed 1 year ago

casid commented 1 year ago

We're planning to release the next major jte version. So far, we have the following ideas:

What do you think? Do you have other ideas we should incorporate in this release?

agentgt commented 1 year ago

I'm not a user of Jte but I have played with lots of templating engines and one of the things I think Rocker got right is the ability to refer to a template as a type. JStachio inherently relies on this as well.

For example in JStachio and Rocker there is no:

JStachio.render("someTemplateName");

This is similar to the points brought up in #131 and arguably it belongs there.

So I'm wondering if you provide an interface like:

    interface TemplateReference<PARAM> {
      public String templateName(); // name() is not chosen because we might use enum
    }

    <P> void TemplateEngine.render(TemplateReference<P> template, P param, Output o)

Then you somehow generate those TemplateReferences.

That being said generating code and then having someone reference the symbol of that code is painful which is exactly the case with Rocker. ie red squiggle because the IDE doesn't see the class. You can fix this with proper classpath setup but its annoying.

casid commented 1 year ago

@agentgt the ability to do that was implemented in #224.

casid commented 1 year ago

jte 3 is finally out, closing this now!