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

Add Jinja render filter #122

Merged
merged 8 commits into from
Nov 5, 2024
Merged

Add Jinja render filter #122

merged 8 commits into from
Nov 5, 2024

Conversation

uwefladrich
Copy link
Owner

Implements #121

Add a filter that allows rendering within a Jinja expression using the current context. This is needed to solve, for example, the following example:

- base.context:
    foo: "me"
    bar: !noparse "{{ foo }}"

- when: "{{ bar == 'me' }}"
  base.echo:
    msg: Hi!

which does not render the when clause expression as expected (i.e. base.echo is not executed.

@uwefladrich
Copy link
Owner Author

uwefladrich commented Nov 5, 2024

For clarity: Using the new render filter like

- base.context:
    foo: "me"
    bar: !noparse "{{ foo }}"

- when: "{{ bar|render == 'me' }}"
  base.echo:
    msg: Hi!

would solve the problem.

@uwefladrich uwefladrich self-assigned this Nov 5, 2024
@uwefladrich uwefladrich merged commit dd6d4e0 into master Nov 5, 2024
19 checks passed
@uwefladrich uwefladrich deleted the fix/when-clause-noparse branch November 5, 2024 13:13
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant