Opened 7 years ago

Closed 7 years ago

Last modified 7 years ago

#28468 closed Uncategorized (invalid)

Template braces within {% include ... with="..." %} are not evaluated

Reported by: Liquid Scorpio Owned by: nobody
Component: Template system Version: 1.11
Severity: Normal Keywords:
Cc: Triage Stage: Unreviewed
Has patch: no Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: no UI/UX: no

Description

I am not sure if this is a bug or limitation, I will add here anyways.

Consider following code inside a django template:

{% include 'partials/_message.html' with 
            message_title="Unauthorised"
            message_body="You need <strong>{{ perm_name }}</strong> permission to access the content." %}

The issue is related to the output rendered in browser for *message_body* when {% include %} is executed.

Expected output:

You need read permission to access the content.

Actual output:

You need {{ perm_name }} permission to access the content.

Notes

While the included template evaluates the passed in <strong> tag, it does not evaluate the variable {{ perm_name }} and outputs it verbatim.

Change History (3)

comment:1 by Aymeric Augustin, 7 years ago

I think the current behavior is the expected behavior.

"You need <strong>{{ perm_name }}</strong> permission to access the content." is a string literal.

comment:2 by Tim Graham, 7 years ago

Resolution: invalid
Status: newclosed
Summary: Template braces within {% with %} are not evaluatedTemplate braces within {% include ... with="..." %} are not evaluated

comment:3 by Liquid Scorpio, 7 years ago

Fair Enough. However, any suggested approach to get the desired output?

Note: See TracTickets for help on using tickets.
Back to Top