Skip to content

Commit

Permalink
Fix multiline sets and strings (#85)
Browse files Browse the repository at this point in the history
  • Loading branch information
joshuataylor committed Sep 1, 2022
1 parent 6cd21be commit 858b8e1
Show file tree
Hide file tree
Showing 5 changed files with 33 additions and 3 deletions.
2 changes: 1 addition & 1 deletion minijinja/src/lexer.rs
Expand Up @@ -124,7 +124,7 @@ fn tokenize_raw(
has_escapes = true;
true
}
(_, $delim) | (_, b'\r') | (_, b'\n') => false,
(_, $delim) => false,
_ => true,
})
.count();
Expand Down
6 changes: 5 additions & 1 deletion minijinja/tests/inputs/escape.txt
Expand Up @@ -5,4 +5,8 @@
{{'\'' ~ 'foo'}}
{{'\'' ~ x ~ '\''}}
{{"\'" ~ x ~ '\''}}
{{"\'" ~ x ~ '\''}}
{{"\'" ~ x ~ '\''}}
{{"
hello world"}}
{{"hello
world"}}
13 changes: 12 additions & 1 deletion minijinja/tests/inputs/set.txt
Expand Up @@ -21,4 +21,15 @@ Into Loop:

Conditional:
{% if true %}{% set foo = "was true" %}{% endif %}
{{ foo }}
{{ foo }}

Multiline:
{% set multiline = "
hello
world" %}
{{ multiline }}

Multiline:
{% set multiline = "hello
world" %}
{{ multiline }}
4 changes: 4 additions & 0 deletions minijinja/tests/snapshots/test_templates__vm@escape.txt.snap
Expand Up @@ -8,3 +8,7 @@ input_file: minijinja/tests/inputs/escape.txt
'hello'
'hello'

hello world
hello
world

11 changes: 11 additions & 0 deletions minijinja/tests/snapshots/test_templates__vm@set.txt.snap
Expand Up @@ -32,3 +32,14 @@ Conditional:

was true

Multiline:


hello
world

Multiline:

hello
world

0 comments on commit 858b8e1

Please sign in to comment.