Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix multiline sets and strings #85

Merged
merged 1 commit into from Sep 1, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
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