| 441 | # Html escaping is not to be confused with for example url escaping. |
| 442 | 'escape01': ('{{ var }}',{ "var": "< > & \" \' # = % $" }, "< > & " ' # = % $" ), |
| 443 | 'escape02': ('{{ var }}',{ "var": "this & that" }, "this & that" ), |
| 444 | |
| 445 | # Strings are compared unescaped. |
| 446 | 'escape03': ('{% ifequal var \"this & that\" %}yes{% endifequal %}',{ "var": "this & that" }, "yes" ), |
| 447 | |
| 448 | # Arguments to filters are 'safe' and manipulate their input unescaped. |
| 449 | 'escape04': ('{{ var|cut:\"&\" }}',{ "var": "this & that" }, "this that" ), |
| 450 | 'escape05': ('{{ varList|join:\" & \" }}',{ "var": ("Tom", "Dick", "Harry") }, "Tom & Dick & Harry" ), |
| 451 | |
| 452 | # Literal strings are safe. |
| 453 | 'escape06': ('{{ \"this & that\" }}',{}, "this & that" ), |
| 454 | |
| 455 | # Iterating outputs safe characters. |
| 456 | 'escape07': ('{% for letter in list %}{{ letter }},{% endfor %}',{}, "K,&,R," ), |
| 457 | |
| 458 | # Escape requirement survives lookup. |
| 459 | 'escape08': ('{{ var.key }}',{ "var": {"key": "this & that" } }, "this & that" ), |
| 460 | |