Skip to content

Releases: casid/jte

3.1.5

21 Nov 07:01
Compare
Choose a tag to compare

3.1.4

30 Oct 19:41
Compare
Choose a tag to compare
  • #290 Fix broken links in source code after documentation update (thanks to @marcospereira)
  • #292 Fix compilation error when multiple for-else with the same nesting depth are in the same template
  • #293 Allow to specify JVM target for kte templates via Gradle/Maven

3.1.3

20 Oct 19:00
Compare
Choose a tag to compare
  • #285 kte templates are generated with native Kotlin default parameters. Thanks to @marcospereira
  • #285 Bugfix: Default Content parameters work with binary templates
  • #288 Improved documentation generated with MkDocs, that now lives on https://jte.gg. Thanks to @marcospereira for making this happen!

3.1.2

07 Oct 04:36
Compare
Choose a tag to compare

3.1.1

03 Oct 08:32
Compare
Choose a tag to compare
  • #272 Add developmentMode configuration metadata property to spring-boot-starter, that was missing from the previous release. Thanks @schowave for spotting and fixing this!

3.1.0

03 Sep 07:26
Compare
Choose a tag to compare
  • #268 Bump Kotlin version from 1.8.10 to latest 1.9.10
  • #251 Spring Boot Starter improvements (Caution: productionProfileName is gone, you now need to explicitly set usePrecompiledTemplates)
  • #266 bugfix when mixing jte with kte templates

3.0.3

16 Aug 04:50
Compare
Choose a tag to compare
  • #255 empty String in attribute value does not remove the attribute
  • #254 fix dynamic attribute names when using $unsafe{} or a custom HTML policy
  • #242 add policy that fails if HTML attribute names contain a semicolon

3.0.2

28 Jul 16:47
Compare
Choose a tag to compare
  • #247 HTML smart attributes and HTML interceptor do not have side effects
  • #250 provide further information in unclosed tags error message
  • #250 declaration tags do not need to be closed

3.0.1

09 Jul 18:14
Compare
Choose a tag to compare
  • #243 ensures that method names generated by jte-models are valid Java. Thanks @chkl!
  • #243 add configuration options for jte-models to only add methods for some of the jte files. Thanks @chkl!
  • JSP to jte converter: Fix replace usages of converted JSPs with no parameters and only a body content
  • #237 better error message when a template is not found through DirectoryCodeResolver

3.0.0

19 Jun 20:48
Compare
Choose a tag to compare

We are happy to announce the release of jte 3. This version brings enhanced functionality, improved performance, and streamlined dependencies. Read on to discover what's new and improved in this release.

New Features:

1. Extension API:

Thanks to @edward3h, this release introduces a powerful extension API that allows you to generate custom content based on your template metadata. So far, there are two extensions ready to be used:

  • jte-native-resources creates GraalVM native image resources (previously part of jte core)
  • jte-models generates type safe model classes for each template.

For instance, using the jte-models extension will allow you to write code like this:

var templates = new StaticTemplates();
templates.helloWorld("Hi!").render(output);

We are very excited to see what other applications you're going to use this API for!

2. Enhanced Loop Syntax:

Loops now support an else branch that is executed if the loop did not iterate over any items. This provides convenient display of empty states. Here's an example:

<table>
  <tr>
    <td>Item</td>
    <td>Qty</td>
  </tr>
  @for(var item : groceryList)
    <tr>
      <td>${item.getName()}</td>
      <td>${item.getQuantity()}</td>
    </tr>
  @else
    <tr>
      <td colspan="2">You have forgotten your groceries list at home!</td>
    </tr>
  @endfor
</table>

A new version of the IntelliJ plugin supporting for-else has been released and is waiting for JetBrains approval. Big thanks to @bohdan-shulha for the idea and @kelunik to find a way to make this happen.

3. Optimized HTML Output Escaping:

We have improved the performance of HTML output escaping by replacing the OWASP Java Encoder with a custom, optimized version. This optimization not only boosts performance but also eliminates external dependencies back to zero. This ensures that jte remains fast and self-contained.

4. Improved UTF-8 Binary Output Performance:

We fine-tuned the performance of UTF-8 binary output. The latest benchmark results showcase significant enhancements in this area, resulting in faster and more efficient processing of UTF-8 binary output. The benchmark below uses UTF-8 binary output and HTML output escaping:

alt Template Benchmark

Breaking Changes:

1. Dropped Support for Java Versions < 17:

Starting from jte 3, support for Java versions below 17 has been discontinued. However, users who are still on older Java versions can continue to use jte 2, which will be maintained with necessary security patches as long as required.

2. Native Image Generation Extension:

Users who utilize the native image generation feature will need to migrate to the new extension provided in this release.

Old:

jte {
    generate()
    generateNativeImageResources = true
    binaryStaticContent = true
}

New:

jte {
    generate()
    jteExtension("gg.jte.nativeimage.NativeResourcesExtension")
    binaryStaticContent = true
}

3. Removed TemplateOutput Method:

The TemplateOutput#getWriter() method has been removed in this release. While we anticipate that this change will not affect most users, please be aware of this modification if you have relied on this method in your code. In case you created a custom TemplateOutput you can now safely remove this method from your implementation.

4. HTML tags in each template must be properly closed

Before jte 3, those were valid templates:
open-thing.jte

<div>

close-thing.jte

</div>

And could be used like this:

@template.open-thing()
Hello
@template.close-thing()

However, this resulted in brittle templates. Currently jte in Html mode checks at compile time, if a template is valid HTML. Since open-thing.jte and close-thing.jte can be compiled seperately, there's no way for the compiler to check if they are used correctly. We could do such a check at runtime, but this is quite against jte's design philosophy. We want to minimize runtime errors as much as possible and rather detect problems at compile time. So, with jte 3 open-thing.jte and close-thing.jte won't compile anymore.

Instead of two separate templates, one template with a content parameter can be used instead:

thing.jte

@import gg.jte.Content
@param Content content

<div>
  ${content}
</div>

And the usage will look like this:

@template.thing(content = @`
  Hello
`)

We believe this will result in templates, that will be better to maintain in the long run. Not only will this read better in IntelliJ, also users of such templates won't be able to forget a closing template anymore.

We are confident that these updates will enhance your experience with jte and provide a more efficient and powerful template engine for your Java or Kotlin projects. Thank you for your continued support and valuable feedback.

Happy templating!