| 44 | |
| 45 | It is also possible to pass "parameters" to included templates. |
| 46 | Those are not actually declared parameters, simply variables expected to be available in the template that can be set for the scope of one specific include. This works exactly like in Genshi, with a with statement: |
| 47 | |
| 48 | - Genshi |
| 49 | {{{#!html+genshi |
| 50 | <xi:include href="ticket_box.html" py:with="can_append = False; preview_mode = False"/> |
| 51 | }}} |
| 52 | - Jinja |
| 53 | {{{#!html+jinja |
| 54 | # with |
| 55 | # set can_append = false |
| 56 | # set preview_mode = false |
| 57 | # include "jticket_box.html" |
| 58 | # endwith |
| 59 | }}} |
| 60 | |
| 61 | See [http://jinja.pocoo.org/docs/dev/extensions/#with-statement with] doc. |
| 62 | |
| 63 | Caveat: note how the boolean constants slightly differ from Python, `False` becomes `false`, `True` becomes `true` and `None` is `none`. |