summaryrefslogtreecommitdiff
path: root/sphinx/transforms
Commit message (Collapse)AuthorAgeFilesLines
* Partially revert "Disable localisation when SOURCE_DATE_EPOCH is set ↵Adam Turner2023-04-211-1/+1
| | | | | (#10949)" (#11343) This keeps some of the added tests, and avoids a full revert of ``sphinx.locale``.
* Disable localisation when ``SOURCE_DATE_EPOCH`` is set (#10949)James Addison2023-04-071-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This commit disables Sphinx's localisation features when reproducible builds are requested, as determined by a non-empty SOURCE_DATE_EPOCH_ environment variable. The `Reproducible Builds`_ project aims to provide confidence to consumers of packaged software that the artefacts they're downloading and installing have not been altered by the environment they were built in, and can be replicated at a later date if required. Builds of localised documentation using Sphinx currently account for a large category of reproducible build testing failures, because the builders intentionally use varying environment locales at build-time. This can affect the contents of the ``objects.inv`` file. During investigation, it turned out that many ``gettext``-localised values (particularly in Python modules under ``sphinx.domains``) were being translated at module-load-time and would not subsequently be re-localised. This creates two unusual effects: 1. Attempting to write a test case to build the same application in two different languages was not initially possible, as the first-loaded translation catalogue (as found in the ``sphinx.locale.translators`` global variable) would remain in-use for subsequent application builds under different locales. 2. Localisation of strings could vary depending on whether the relevant modules were loaded before or after the resource catalogues were populated. We fix this by performing all translations lazily so that module imports can occur in any order and localisation of inventory entries should occur only when translations of those items are requested. Localisation can then be disabled by configuring the ``gettext`` language to the ISO-639-3 'undetermined' code (``'und'``), as this should not have an associated translation catalogue. We also want to prevent ``gettext`` from attempting to determine the host's locale from environment variables (including ``LANGUAGE``). .. _SOURCE_DATE_EPOCH: https://reproducible-builds.org/docs/source-date-epoch/ .. _Reproducible Builds: https://www.reproducible-builds.org/
* Fix translator class check in ``SigElementFallbackTransform`` (#11283)picnixz2023-04-071-1/+5
|
* Enable 'nit-picky mode' for Sphinx's documentationAdam Turner2023-04-061-1/+1
| | | | | Fix several reference errors throughout the documentation and set ``nitpick_ignore`` in ``doc/conf.py``.
* Consider duplicate names when using image post transforms (#11113)aaron-cooper2023-04-031-1/+2
| | | Closes: #11110
* Split up logic in ``sphinx.transforms.i18n.Locale.apply`` (#11166)Jean Abou-Samra2023-03-151-242/+261
| | | | | | | Before, the apply method was one big 400-line chunk. This just splits it up into more manageable chunks by introducing a ``_NodeUpdater`` auxiliary class holding logic for updating various types of references. Co-authored-by: Adam Turner <9087854+AA-Turner@users.noreply.github.com>
* Get docname from env in ``sphinx.transforms.i18n`` (#11160)Jean Abou-Samra2023-03-051-6/+1
|
* Unescape quotation marks where possibleAdam Turner2023-02-181-1/+1
|
* Fix COM812Adam Turner2023-02-183-7/+7
|
* Resolve Ruff SIM114 violationsAdam Turner2023-02-152-12/+10
|
* Remove unneeded typing importsAdam Turner2023-01-231-6/+2
|
* Sort imports with Ruff's conventionAdam Turner2023-01-231-2/+5
|
* Adopt ``profile = "black"`` for ``isort``Adam Turner2023-01-071-2/+7
| | | | This allows using Ruff's import sorting fixers
* Move HTTP-date formatting utils to `utils.http_date`Adam Turner2023-01-031-1/+2
|
* Address SIM103 lints (#11052)danieleades2023-01-021-4/+1
| | | Co-authored-by: Adam Turner <9087854+AA-Turner@users.noreply.github.com>
* Use ``any`` to find elements in iterable (#11053)danieleades2023-01-022-9/+12
|
* Run pyupgrade (#11070)Adam Turner2023-01-024-13/+13
|
* Use PEP 604 typesAdam Turner2023-01-013-8/+8
|
* Use PEP 595 typesAdam Turner2023-01-017-39/+39
|
* Insert ``from __future__ import annotations``Adam Turner2023-01-017-0/+14
|
* Enable Ruff's pylint checksAdam Turner2022-12-292-4/+2
| | | | | Also fix two PLW0602 warnings (``global`` without assignment) and five PLW0120 warnings (else clause on loop without break).
* remove blanket 'noqas'Daniel Eades2022-12-161-4/+10
|
* Deactivate (provisorily) Python12-dev testing (#11035)Jean-François B2022-12-161-1/+2
| | | | | | | | | | | | | * fix flake8 warnings * Deactivate (provisorily) testing with 3.12-dev (refs: https://github.com/sphinx-doc/sphinx/pull/10995#issuecomment-1330310586 ) * Escape # in tox.ini for tox 4 compatibility ('du-latest' tests) Co-authored-by: Daniel Eades <danieleades@hotmail.com>
* Increase minimum Docutils to 0.18Adam Turner2022-09-271-7/+2
|
* Increase minimum Docutils to 0.17Adam Turner2022-09-272-10/+5
|
* Merge branch '5.x'Adam Turner2022-09-251-2/+2
|\ | | | | | | | | | | | | | | | | | | # Conflicts: # CHANGES # doc/conf.py # sphinx/__init__.py # sphinx/builders/html/__init__.py # sphinx/domains/python.py # tests/test_build_html.py
| * Fix highlighting lexersAdam Turner2022-09-251-2/+2
| | | | | | | | - Ensure `pycon3` is always normalised to `pycon`
* | Merge branch '5.x'Adam Turner2022-09-092-2/+4
|\ \ | |/ | | | | | | | | | | | | | | # Conflicts: # setup.py # sphinx/application.py # sphinx/environment/__init__.py # sphinx/ext/autodoc/directive.py # tests/test_build_html.py
| * Remove unneeded `noqa` lint suppression comments (#10772)danieleades2022-08-281-1/+1
| |
| * Further improve type annotations, reduce mypy whitelist (#10770)danieleades2022-08-281-1/+3
| | | | | | Co-authored-by: Adam Turner <9087854+aa-turner@users.noreply.github.com>
* | Merge branch '5.x' into masterJean-François B2022-06-301-0/+1
|\ \ | |/ | | | | | | | | | | | | Resolved merge conflicts: sphinx/ext/extlinks.py sphinx/ext/napoleon/docstring.py (and removed from the latter a now unused import for flake8 F401 compliance)
| * Fix #10579: i18n: UnboundLocalError is raised on translating raw directiveTakeshi KOMIYA2022-06-191-0/+1
| |
* | Remove deprecated items for Sphinx 6.0 (#10471)Adam Turner2022-06-161-20/+1
|/
* `rawsource` is deprecated in `docutils.nodes.Text`Adam Turner2022-04-221-1/+1
|
* Use docutils.__version_info__ directlyAdam Turner2022-04-221-1/+2
|
* Merge pull request #10107 from Jean-Abou-Samra/intl-warningsTakeshi KOMIYA2022-03-271-11/+33
|\ | | | | Implement #noqa for i18n
| * Close #3985: Implement #noqa for i18nJean Abou Samra2022-02-151-6/+28
| | | | | | | | | | | | | | | | | | | | | | | | | | | | When cross-references in the original paragraph and the translated paragraph do not match, a warning is emitted. It is useful, because it allows to catch mistakes, but it can also be an annoyance since sometimes it is expected that the cross-references will not match. For example, a reference that is repeated in the original text may need to be factored out for good style in the target language. Another example: if the translator needs to translate a universally understood term in the source language into a term that not everyone knows is the translation of this original term, adding a reference to the glossary can be warranted. This allows the translated message to start with '#noqa' in order to disable the warning.
| * Categorize warnings for inconsistent references in i18nJean Abou Samra2022-02-151-5/+5
| | | | | | | | | | This allows suppressing them using the suppress_warnings configuration variable.
* | Merge pull request #10118 from mgeier/image-converter-ignore-questionmarkTakeshi KOMIYA2022-03-241-3/+2
|\ \ | | | | | | ImageConverter: ignore '?' image URIs
| * | ImageConverter: ignore '?' image URIsMatthias Geier2022-01-181-3/+2
| |/
* | Collapse single line docstringsAdam Turner2022-02-207-14/+7
| |
* | Remove copyright and licence fieldsAdam Turner2022-02-207-21/+0
| |
* | Fix module docstring indentationAdam Turner2022-02-207-14/+14
| |
* | Fix module docstring first lineAdam Turner2022-02-207-14/+7
| |
* | Remove module titles in docstringsAdam Turner2022-02-197-21/+0
|/
* Merge pull request #10078 from ↵Takeshi KOMIYA2022-01-161-1/+1
|\ | | | | | | | | danieleades/refactor/unused-loop-control-variables address some unused loop control variables
| * address some unused loop control variables (B007)Daniel Eades2022-01-121-1/+1
| |
* | Skip "data:" URIs in ImageConverterMatthias Geier2022-01-131-0/+3
|/
* In translated docs, sort glossaries by translated termsJean Abou Samra2022-01-121-1/+21
| | | | | | | This is done by moving the sorting from the glossary directive to a transform operating after the i18n transform. Closes #9827
* Migrate to Node.findall() from Node.traverse()Takeshi KOMIYA2022-01-036-36/+36
| | | | | | | | Node.traverse() was marked as deprecated since docutils-0.18. Instead of it, Node.findall() has been added as successor of traverse(). This applies a patch to docutils-0.17 or older to be available Node.findall() and use it.