409 | | Though there's no absolutely no constraints on a Jinja2 template, it helps to have an .xml or .html template be itself '''a well-formed XML document'''. |
410 | | |
411 | | **Never** go back to the bad old Clearsilver habits were sometimes the logic in those templates took advantage of the lack of well-formedness constraints, e.g. by conditionally inserting end/start pairs of tags. Such templates were hard to maintain, and you always have cleaner alternatives. |
412 | | |
413 | | The [Proposals/Jinja#jinjachecker jinjachecker] tool should also help you maintain well-formed templates. |
| 409 | Though there's absolutely no constraints on what text a Jinja2 template may contain, for templates that will produce HTML (or XML), it will be useful if the template is itself already '''a well-formed XML document'''. |
| 410 | |
| 411 | **Never** go back to the bad old habits from the ClearSilver time, were sometimes the logic in those templates took advantage of the lack of well-formedness constraints, e.g. by conditionally inserting end/start pairs of tags to split sequences. Such templates were hard to maintain, and you always have cleaner alternatives. |
| 412 | |
| 413 | The [Proposals/Jinja#jinjachecker jinjachecker] tool should also help you maintain well-formed templates by stripping off Jinja2 expressions and line statements before attempting to XML validate the document ([pypi:lxml] should be installed for this feature). |