-
Breaking change: Templates now use the
StringTree
type from the standard library instead of theStringBuilder
type which has been deprecated. This means that projects usingmatcha
should usegleam_stdlib >= 0.42.0
.Generated template modules now expose a
render_tree
function instead ofrender_builder
. They continue to expose arender
function as before.Thank you to @diemogebhardt for implementing this.
-
Changed to only generating the
.gleam
output if the.matcha
file has a newer modified timestamp than the.gleam
file. This avoids constantly regenerating the output files which in turn avoids messing up the formatting if the output file had been formatted.Thank you to @perrygeo for noticing and fixing the issue.
-
Switched from
structopt
toclap
for command line options parsing. This should be transparent to the user.
- Changed to use
type
keyword inStringBuilder
import in the generated Gleam code as suits recent versions of the Gleam compiler.
-
Support
{> fn
and{> pub fn
syntax for declaring private and public functions within the template file. This allows better locality of helper functions and easy access to template behaviour.Template files which only have function declarations and no meaningful template content will not have the
render
andrender_builder
methods so they can be used library modules with just helper functions.
-
Breaking change: No longer includes
gleam/list
import for templates that don't use thefor
syntax. This is to avoid the import potentially be unused. If you usegleam/list
for other things in your template then you'll have to explicitly import it.Thank you to @lpil for reporting the issue.
-
Fixed build for MacOS arm64.
Thank you to @michallepicki for noticing and fixing the issue.
-
Breaking change: Rename the project to 'matcha' to remove the double-barrelled nature of the previous name and avoid the clash with the
.tea
extension name. -
Breaking change: The template files should now have a
.matcha
suffix instead of.tea
.
-
Breaking change: Rename the project to 'green-tea' as the previous name was essentially 'templates' which is too plain and generic to be comfortable using.
-
Breaking change: The template files should now have a
.tea
suffix instead of.gleamx
. This might change again as there is a "Tea" language already.
-
Support arbitrary Gleam syntax in value, if-condition and for-loop source locations. This means that more work can be done by the compiled template file rather than having to preprocess data before rendering the template.
The template system does not parse the Gleam expressions and so will allow invalid Gleam syntax to be added which will cause an error with the Gleam compiler.
Thank you to @lpil for the suggestion.
-
Add comment to generated files to indicate that they are auto-generated and ideally should not be edited.
Thank you to @lpil for the suggestion.
-
Use non-zero exit code for process if any error is encountered. Basic behaviour that was missing.
Thank you to @lpil for the suggestion.
- Breaking change: all parameters to the template must now be declared using the
{> with ... as ...
syntax. The template generation will no longer try to automatically deduce parameters from the template contents. Being explicit allows us to include static content from imported modules without the generation getting confused about what is a parameter and what is an import.
-
Added support for '{[ name ]}' syntax to allow for inserting string builder values into the template using the underlying
append_builder
call instead of theappend
functon that we use for strings.Thank you to @michallepicki for the suggestion.
-
Added support for 'for .. as .. in ..' syntax to allow associating a type with the items in the list being iterated.
Thank you to @lpil for the suggestion.
- Added --version flag to executable to print out current version.
-
Automatic release builds uploaded to GitHub.
Thanks to @michallepicki.
- Improve error reporting
- Added suggestions when encountering an unexpected token
- Added colours to error output
- Added 'verbose' flag for printed output of processed files
-
Improve error reporting
Some errors now including code snippets highlighting the problem.
- Basic functionality