Remove all entries from ``pairindextypes`` before writing POT files. We want to run this just before writing output files, as the check to circumvent is in ``I18nBuilder.write_doc()``. As such, we link this to ``env-check-consistency``, even though it has nothing to do with the envi
(app, _env)
| 95 | |
| 96 | |
| 97 | def patch_pairindextypes(app, _env) -> None: |
| 98 | """Remove all entries from ``pairindextypes`` before writing POT files. |
| 99 | |
| 100 | We want to run this just before writing output files, as the check to |
| 101 | circumvent is in ``I18nBuilder.write_doc()``. |
| 102 | As such, we link this to ``env-check-consistency``, even though it has |
| 103 | nothing to do with the environment consistency check. |
| 104 | """ |
| 105 | if app.builder.name != 'gettext': |
| 106 | return |
| 107 | |
| 108 | # allow translating deprecated index entries |
| 109 | try: |
| 110 | from sphinx.domains.python import pairindextypes |
| 111 | except ImportError: |
| 112 | pass |
| 113 | else: |
| 114 | # Sphinx checks if a 'pair' type entry on an index directive is one of |
| 115 | # the Sphinx-translated pairindextypes values. As we intend to move |
| 116 | # away from this, we need Sphinx to believe that these values don't |
| 117 | # exist, by deleting them when using the gettext builder. |
| 118 | pairindextypes.clear() |
| 119 | |
| 120 | |
| 121 | def setup(app): |
nothing calls this directly
no test coverage detected
searching dependent graphs…