Makes it possible to put templates in subdirectories

This commit is contained in:
Johan Maasing 2025-05-02 09:25:27 +02:00
parent 7e8aa018e9
commit e0922d5639
Signed by: johan
GPG key ID: FFD31BABEE2DEED2

View file

@ -309,10 +309,18 @@ public record TransitionNode(String message, String toState) {
### Meta ### Meta
The meta container holds information about the template file used to generate the output file. The meta container holds information about the template file used to generate the output file.
It holds the subdirectory below the given `templateDir` where the template was found. ```java
public record Meta(
List<String> templateDirectories,
String templateFile
) { }
```
* `templateDirectories` holds the subdirectory below the given `templateDir` where the template was found.
This is useful to generate e.g. java `package`statements like this: This is useful to generate e.g. java `package`statements like this:
```injectedfreemarker ```injectedfreemarker
<#list meta.templateDirectories>package <#items as dir>${dir}<#sep>.</#items>;</#list> <#list meta.templateDirectories>package <#items as dir>${dir}<#sep>.</#items>;</#list>
``` ```
* `templateFile` is the filename of the template (including the .ftl-ending) used to generate the output.