[ADD] report_py3o_index: Update TOC and other indices in Py3o reports #907
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This module fills in the document indexes (e.g. a Table of Content) in a generated py3o document.
This is to work around the missing feature first reported in 2012: https://bugs.documentfoundation.org/show_bug.cgi?id=44448
It uses the workaround given in https://ask.libreoffice.org/t/update-toc-via-command-line/52518 and other similar threads.
Note that to work, the macro has to be installed in libreoffice first.
This is done at module install.
It assumes the macro files are stored at
~/.config/libreoffice/4/user/basic/Standard
.If it fails, the function can be manually called with the real path using:
self.env["py3o.report"]._install_update_index_macro(real_path)
Make sure that this is correct as most failure paths of the macro application are silent.
Once this is done, py3o templates have an "has index" boolean.
If set, the macro is applied after generation (and before pdf conversion) to update all indices.