Skip to content

Commit 1a87a45

Browse files
committed
address comments
Signed-off-by: Michael Pollind <[email protected]>
1 parent 329aa4e commit 1a87a45

File tree

2 files changed

+8
-9
lines changed

2 files changed

+8
-9
lines changed

book/src/template_syntax.md

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -839,15 +839,15 @@ You can then call it with `{% call name(args) %}`, ending with `{% endcall %}`:
839839
840840
{% endmacro %}
841841
842-
{% call heading(s) %} {% endcall %}
842+
{% call heading(s) %}{% endcall %}
843843
```
844844

845845
You can place macros in a separate file and use them in your templates by using `{% import %}`:
846846

847847
```jinja
848848
{%- import "macro.html" as scope -%}
849849
850-
{% call scope::heading(s) %} {% endcall %}
850+
{% call scope::heading(s) %}{% endcall %}
851851
```
852852

853853
You can optionally specify the name of the macro in `endmacro`:
@@ -865,7 +865,7 @@ You can also specify arguments by their name (as defined in the macro):
865865
866866
{% endmacro %}
867867
868-
{% call heading(bold="something", arg="title") %} {% endcall%}
868+
{% call heading(bold="something", arg="title") %}{% endcall%}
869869
```
870870

871871
You can use whitespace characters around `=`:
@@ -914,9 +914,9 @@ Then if you don't pass a value for this argument, its default value will be used
914914

915915
```jinja
916916
{# We only specify `arg1`, so `arg2` will be "something" #}
917-
{% call heading(1) %} {% endcall %}
917+
{% call heading(1) %}{% endcall %}
918918
{# We specify both `arg1` and `arg2` so no default value is used #}
919-
{% call heading(1, 2) %} {% endcall %}
919+
{% call heading(1, 2) %}{% endcall %}
920920
```
921921

922922
### Call
@@ -958,7 +958,6 @@ Here is an example with a call block using arguments:
958958
<dd>{{ user.description }}</dd>
959959
</dl>
960960
{% endcall %}
961-
962961
```
963962

964963
## Calling Rust macros

testing/tests/calls.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -114,15 +114,15 @@ fn test_caller() {
114114
{%- macro test() -%}
115115
{{- caller() -}}
116116
{%- endmacro -%}
117-
{%- call() test() -%}
117+
{%- call() test() %}
118118
nested
119-
{%- endcall -%}
119+
{% endcall -%}
120120
"#,
121121
ext = "html"
122122
)]
123123
struct CallerEmpty {}
124124
let x = CallerEmpty {};
125-
assert_eq!(x.render().unwrap(), "nested");
125+
assert_eq!(x.render().unwrap(), "\nnested\n\n");
126126
}
127127

128128
#[test]

0 commit comments

Comments
 (0)