Add documentation for jinja-like comments in templates
This commit is contained in:
parent
6bfd2eb85a
commit
9b4e623c3c
@ -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
|
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.
|
``{%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
|
Multiple rendering
|
||||||
..................
|
..................
|
||||||
|
|
||||||
|
|||||||
@ -1,6 +1,6 @@
|
|||||||
from docxtpl import DocxTemplate
|
from docxtpl import DocxTemplate
|
||||||
|
|
||||||
tpl = DocxTemplate('templates/comments.docx')
|
tpl = DocxTemplate('templates/comments_tpl.docx')
|
||||||
|
|
||||||
tpl.render({})
|
tpl.render({})
|
||||||
tpl.save('output/comments.docx')
|
tpl.save('output/comments.docx')
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user