diff --git a/CHANGES.rst b/CHANGES.rst index 0b512fe..03c8201 100644 --- a/CHANGES.rst +++ b/CHANGES.rst @@ -1,7 +1,9 @@ -0.15.0 (2021-12-20) +0.15.1 (2021-12-20) ------------------- - Multi-rendering with same DocxTemplate object is now possible see tests/multi_rendering.py +- fix #392 +- fix #398 0.14.1 (2021-10-01) ------------------- diff --git a/docs/index.rst b/docs/index.rst index 900c460..42e640a 100644 --- a/docs/index.rst +++ b/docs/index.rst @@ -110,6 +110,15 @@ 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. +Multiple rendering +.................. + +Since v0.15.0, it is possible to create ``DocxTemplate`` object once and call +``render(context)`` several times. Note that if you want to use replacement +methods like ``replace_media()``, ``replace_embedded()`` and/or ``replace_zipname()`` +during multiple rendering, you will have to call ``reset_replacements()`` +at rendering loop start. + Split and merge text .................... diff --git a/docxtpl/__init__.py b/docxtpl/__init__.py index bc11be4..8a64502 100644 --- a/docxtpl/__init__.py +++ b/docxtpl/__init__.py @@ -4,7 +4,7 @@ Created : 2015-03-12 @author: Eric Lapouyade """ -__version__ = '0.15.0' +__version__ = '0.15.1' # flake8: noqa from .inline_image import InlineImage diff --git a/tests/multi_rendering.py b/tests/multi_rendering.py index 7dec863..6822a6f 100644 --- a/tests/multi_rendering.py +++ b/tests/multi_rendering.py @@ -37,4 +37,4 @@ for document_data in documents_data: dest_file = document_data['dest_file'] context = document_data['context'] tpl.render(context) - tpl.save(f'output/{dest_file}') + tpl.save('output/%s' % dest_file)