feat: predefine custom template functions
Opened this issue · 2 comments
Is your feature request related to a problem? Please describe.
Since the template language allows custom inline / simple and more advanced functions, it would be cool to
have some "general" way of adding template functions. (For example generate UUIDv4)
Describe the solution you'd like
It could be like "environment", a way of adding various functions to the templating language.
They should be prepended to any templating execution to have "global" custom functions.
We like the idea of defining custom template functions per project to allow reuse and plan to implement this in the future.
Support for UUIDv4 will hopefully be added to the template language directly, so this may be supported much sooner.
Kreya 1.3.0 (released just now) ships the newest version of Scriban, which supports the math.uuid
function: https://github.com/scriban/scriban/blob/master/doc/builtins.md#mathuuid