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

preserve quotes between nodes in native env #1086

Merged
merged 1 commit into from
Oct 22, 2019
Merged

Conversation

davidism
Copy link
Member

@davidism davidism commented Oct 22, 2019

closes #1020

Due to the way the lexer works, '{{ a }}', '{{ b }}' would get parsed as the nodes ', {{ a }}, ', ', {{ b }}, '. native_concat would get called on the intermediate node ', ', which parses to a string, which drops the quotes.

Now, if literal_eval results in a string, it is re-quoted except for the top-level concat in Template.render. The original quote character is preserved. This carries the quotes through to the final call to literal_eval, so quotes around expressions are preserved.

cc @jctanner @mkrizek

@davidism davidism added this to the 2.11.0 milestone Oct 22, 2019
@davidism davidism merged commit 6e50bbd into master Oct 22, 2019
@davidism davidism deleted the native-string-literal branch October 22, 2019 20:33
mkrizek added a commit to mkrizek/ansible that referenced this pull request Oct 23, 2019
Fixes ansible#58527

Updates our copy of native_concat to include changes introduced in
pallets/jinja#1086.
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Nov 13, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Jinja2 NativeEnvironment dropping single quotes between elements in template to render
1 participant