Skip to content

Commit

Permalink
Update changelog & readme
Browse files Browse the repository at this point in the history
  • Loading branch information
michaeljones committed Feb 1, 2022
1 parent 3d34f4d commit b127cf8
Show file tree
Hide file tree
Showing 2 changed files with 26 additions and 2 deletions.
10 changes: 10 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,10 +1,20 @@
# Changelog

## Unreleased

- Added support for '{[ name ]}' syntax to allow for inserting string builder values into the
template using the underlying `append_builder` call instead of the `append` functon that we use
for strings.

Thank you to @michallepicki for the suggestion.

## 0.6.0

- 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.

## 0.5.0

- Added --version flag to executable to print out current version.
Expand Down
18 changes: 16 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -44,15 +44,29 @@ Alpha. The error messages are poor and there will be plenty of flaws and oversig

The syntax is inspired by [Jinja](https://jinja.palletsprojects.com/).

### Value
### String Value

You can use `{{ name }}` syntax to insert the value of name into the rendered template. The
You can use `{{ name }}` syntax to insert the value of `name` into the rendered template. The
function generated from the template will have a labelled argument matching the identifier used.

```jinja
{{ name }}
```

### String Builder Value

You can use `{[ name ]}` syntax to insert a string builder value into the rendered template. This
has the advantage of using
[string_builder.append_builder](https://hexdocs.pm/gleam_stdlib/gleam/string_builder.html#append_builder)
in the rendered template and so it more efficient for inserting content that is already in a
`string_builder`. This can be used to insert content from another template.

The function generated from the template will have a labelled argument matching the identifier used.

```jinja
{[ name ]}
```

### If

You can use `{% %}` blocks to create an if-statement using the `if`, `else` and `endif` keywords.
Expand Down

0 comments on commit b127cf8

Please sign in to comment.