You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The templating syntax is quite nice and really safe (meaning there is no way it would conflict with escaping some other language). However, it is also quite tedious to write and read. Here is my proposal to change the syntax:
Current Syntax
IF Example:
{{@if {{WSL}} == "yes"}}
alias explorer='explorer.exe'
{{@fi}}
I know that the current syntax is heavily inspired by handlebars, though I don't quite remember why we introduced the @ sign, which seems a bit unnecessary to me.
Proposed Syntax
I think we can borrow again from a well-established templating system (that itself is inspired by Jinja and Django): https://github.com/Keats/tera
{% if WSL == "yes" %}
alias explorer='explorer.exe'
{% endif %}
We could also consider using Tera for this. This would remove a lot of documentation and maintenance work from the project and give us lot's more features like for loops etc.
The text was updated successfully, but these errors were encountered:
I also do not remember why we chose @ but i guess it was to make parsing it somewhat easier.
Proposed Syntax
I wanted to get ride of your custom templating for some time now, as it is not the most robust and feature rich implementation.
I thought about adding support for multiple templating languages, which then could be chosen during runtime by:
Setting the template variable on the dotfile entry in the profile (e.g. template: terra)
Setting the correct file extension on the template file (e.g. test.txt => test.txt.terra). This extension would then get removed during the deployment.
The only problem with that is, that we need to find a way to let those template engines access the system environment (maybe some of them have already build in functions for that).
The templating syntax is quite nice and really safe (meaning there is no way it would conflict with escaping some other language). However, it is also quite tedious to write and read. Here is my proposal to change the syntax:
Current Syntax
IF Example:
I know that the current syntax is heavily inspired by handlebars, though I don't quite remember why we introduced the
@
sign, which seems a bit unnecessary to me.Proposed Syntax
I think we can borrow again from a well-established templating system (that itself is inspired by Jinja and Django): https://github.com/Keats/tera
More examples: https://tera.netlify.app/docs/#control-structures
We could also consider using Tera for this. This would remove a lot of documentation and maintenance work from the project and give us lot's more features like for loops etc.
The text was updated successfully, but these errors were encountered: