summaryrefslogtreecommitdiff
path: root/sphinx/writers/text.py
Commit message (Collapse)AuthorAgeFilesLines
* Allow multi-line object description signatures (#11011)TLouf2023-05-111-6/+81
| | | | | Co-authored-by: Adam Turner <9087854+aa-turner@users.noreply.github.com> Co-authored-by: Jean-François B <2589111+jfbu@users.noreply.github.com> Co-authored-by: TLouf <loufthomas@gmail.com>
* Partially revert "Disable localisation when SOURCE_DATE_EPOCH is set ↵Adam Turner2023-04-211-2/+2
| | | | | (#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-2/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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/
* Resolve lint errors from Ruff 0.0.261Adam Turner2023-04-051-2/+1
|
* Resolve lint errors from Ruff 0.0.260Adam Turner2023-03-311-1/+2
|
* Fix COM812Adam Turner2023-02-181-3/+3
|
* Resolve Ruff SIM114 violationsAdam Turner2023-02-151-1/+1
|
* Shrink 'any-generics' whitelist for 'writers' module (#10867)danieleades2023-01-021-2/+2
| | | Co-authored-by: Adam Turner <9087854+aa-turner@users.noreply.github.com>
* Run pyupgrade (#11070)Adam Turner2023-01-021-6/+4
|
* Use PEP 604 typesAdam Turner2023-01-011-5/+5
|
* Use PEP 595 typesAdam Turner2023-01-011-26/+25
|
* Insert ``from __future__ import annotations``Adam Turner2023-01-011-0/+2
|
* Collapse single line docstringsAdam Turner2022-02-201-2/+1
|
* Remove copyright and licence fieldsAdam Turner2022-02-201-3/+0
|
* Fix module docstring indentationAdam Turner2022-02-201-2/+2
|
* Fix module docstring first lineAdam Turner2022-02-201-2/+1
|
* Remove module titles in docstringsAdam Turner2022-02-191-3/+0
|
* address some unused loop control variables (B007)Daniel Eades2022-01-121-2/+2
|
* Migrate to Node.findall() from Node.traverse()Takeshi KOMIYA2022-01-031-1/+1
| | | | | | | | 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.
* Merge branch '4.3.x' into 4.xTakeshi KOMIYA2022-01-011-1/+1
|\
| * A happy new year!Takeshi KOMIYA2022-01-011-1/+1
| |
* | Fix flake8 warningsTakeshi KOMIYA2021-12-241-1/+1
| |
* | drop translator-specific unknown_visit callsJames Knight2021-12-051-3/+0
|/ | | | | | | | | | | | | | | | | | | | | | | Removes the need for various translators from raising a `NotImplementedError` exception when missing support for a specific node type. docutils will already raise [1][2] a `NotImplementedError` exception for these cases. This help reduce the implementation inside Sphinx as well as prevents the possible undesired replication of unknown-node handling with third-party extensions [3]. In most cases, generating a warning message for an unsupported node type can be preferred. Providing an indication that a node is not supported can be easier for a user of Sphinx to understand a limitation of a builder over a generic "not implemented" exception. This commit takes the logging call which is already used by `texinfo` and applies it to the `SphinxTranslator` base class -- which any Sphinx translator implementation can use. [1]: https://repo.or.cz/docutils.git/blob/d169015ee0f412cffd69b33654d8a119d99bc0f3:/docutils/nodes.py#l2048 [2]: https://repo.or.cz/docutils.git/blob/53716a13b48128af6045139d3cd2909f61e7ed8e:/docutils/nodes.py#l1897 [3]: https://github.com/sphinx-doc/sphinx/issues/9921 Signed-off-by: James Knight <james.d.knight@live.com>
* refactor: Node.traverse() will returns generator since 0.18Takeshi KOMIYA2021-10-101-1/+1
|
* Improve sphinx.writers.text docstringsLouis Maddox2021-07-181-18/+17
|
* Decl styling, update writersJakob Lykke Andersen2021-04-121-6/+24
| | | | | | Add test objects so all builders gets exposed to the new nodes. Make the fallback node post-transform change desc_inline as well. Make the html4, latex, and text writers handle desc_inline.
* refactor: Use PEP-526 based variable annotation (sphinx.writers)Takeshi KOMIYA2021-03-131-18/+17
|
* Merge branch '3.x'Takeshi KOMIYA2021-01-011-1/+1
|\
| * A happy new year!Takeshi KOMIYA2021-01-011-1/+1
| | | | | | | | | | | | | | .. note:: $ find sphinx tests LICENSE doc/conf.py -type f -exec sed -i '' -e 's/2007\-20../2007-2021/' {} \; $ git co sphinx/locale/**/*.js sphinx/templates/epub3/mimetype
* | Merge branch '3.x'Takeshi KOMIYA2020-11-121-4/+4
|\ \ | |/
| * Sort imports with isortFrançois Freitag2020-11-111-4/+3
| | | | | | | | | | | | | | | | | | | | | | | | Keep imports alphabetically sorted and their order homogeneous across Python source files. The isort project has more feature and is more active than the flake8-import-order plugin. Most issues caught were simply import ordering from the same module. Where imports were purposefully placed out of order, tag with isort:skip.
* | Merge branch '3.x'Takeshi KOMIYA2020-11-021-0/+3
|\ \ | |/
| * Don't remove substitution_reference nodes (fix #7953)Brecht Machiels2020-09-081-0/+3
| | | | | | | | | | SubstitutionDefinitionsRemover is now a SphinxPostTransform, only applied in the Sphinx builder, as was originally the case (see #4827).
* | Merge branch '3.x'Takeshi KOMIYA2020-07-241-1/+1
|\ \ | |/
| * fix typoTetsuo Koyama2020-07-191-1/+1
| |
* | Merge branch '3.x'Takeshi KOMIYA2020-07-051-1/+1
|\ \ | |/
| * Use chain.from_iterable in text.pyRam Rachum2020-06-171-1/+1
| |
* | Hello TYPE_CHECKING!Takeshi KOMIYA2020-03-071-3/+2
|/
* refactor: Update type annotations in sphinx.writers.*Takeshi KOMIYA2020-02-231-21/+21
|
* Merge branch '2.x' into 3.xTakeshi KOMIYA2020-02-181-1/+0
|\
| * Fix #7170: text: Remove debug printTakeshi KOMIYA2020-02-181-1/+0
| |
* | Merge branch '2.0'Takeshi KOMIYA2020-01-011-3/+3
|\ \ | |/
| * A happy new year!Takeshi KOMIYA2020-01-011-1/+1
| |
| * mypy: Enable disallow_incomplete_defs flag for type checkingTakeshi KOMIYA2019-12-301-3/+3
| |
* | Fix flake8 violationTakeshi KOMIYA2019-12-011-1/+1
| |
* | Merge branch '2.0'Takeshi KOMIYA2019-12-011-13/+20
|\ \ | |/
| * Fix #6867: text: extra spaces are inserted to hyphenated words on folding linesTakeshi KOMIYA2019-11-301-13/+20
| |
* | Merge branch '2.0'Takeshi KOMIYA2019-11-301-403/+205
|\ \ | |/
| * Migrate to py3 style type annotation: sphinx.writers.textTakeshi KOMIYA2019-11-261-407/+207
| |
* | Merge branch '2.0'Takeshi KOMIYA2019-07-131-1/+1
|\ \ | |/