test and doc whitespace control for expressions

This commit is contained in:
pantor
2020-08-12 19:57:20 +02:00
parent ed58da75a6
commit 1590bcebef
2 changed files with 7 additions and 2 deletions
+3 -2
View File
@@ -260,13 +260,14 @@ env.set_trim_blocks(true);
env.set_lstrip_blocks(true);
```
With both `trim_blocks` and `lstrip_blocks` enabled, you can put statements on their own lines. Furthermore, you can also strip whitespaces by hand. If you add a minus sign (`-`) to the start or end of a statement, the whitespaces before or after that block will be removed:
With both `trim_blocks` and `lstrip_blocks` enabled, you can put statements on their own lines. Furthermore, you can also strip whitespaces for both statements and expressions by hand. If you add a minus sign (`-`) to the start or end, the whitespaces before or after that block will be removed:
```.cpp
render("Hello {{- name -}} !", data); // "Hello Inja!"
render("{% if neighbour in guests -%} I was there{% endif -%} !", data); // Renders without any whitespaces
```
Stripping behind a statement also remove any newlines.
Stripping behind a statement or expression also removes any newlines.
### Callbacks