Add documentation for jinja-like comments in templates

This commit is contained in:
Eric Lapouyade 2022-04-16 12:18:07 +02:00
parent 6bfd2eb85a
commit 9b4e623c3c
3 changed files with 12 additions and 1 deletions

View File

@ -121,6 +121,17 @@ But use this instead in your docx template ::
This syntax is possible because MS Word considers each line as a new paragraph and
``{%p`` tags are not in the same paragraph in the second case.
Comments
........
You can add jinja-like comments in your template ::
{#p this is a comment as a paragraph #}
{#tr this is a comment as a table row #}
{#tc this is a comment as a table cell #}
See tests/templates/comments_tpl.docx for an example.
Multiple rendering
..................

View File

@ -1,6 +1,6 @@
from docxtpl import DocxTemplate
tpl = DocxTemplate('templates/comments.docx')
tpl = DocxTemplate('templates/comments_tpl.docx')
tpl.render({})
tpl.save('output/comments.docx')