summaryrefslogtreecommitdiff
path: root/sphinx/writers/texinfo.py
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/
* Resolve ``flake8-return`` errorsAdam Turner2023-02-181-4/+3
|
* Fix pytest style issuesAdam Turner2023-02-181-1/+1
|
* Fix COM812Adam Turner2023-02-181-2/+2
|
* Shrink 'any-generics' whitelist for 'writers' module (#10867)danieleades2023-01-021-4/+7
| | | Co-authored-by: Adam Turner <9087854+aa-turner@users.noreply.github.com>
* Run pyupgrade (#11070)Adam Turner2023-01-021-18/+18
|
* Use PEP 604 typesAdam Turner2023-01-011-10/+10
|
* Use PEP 595 typesAdam Turner2023-01-011-25/+24
|
* Insert ``from __future__ import annotations``Adam Turner2023-01-011-0/+2
|
* remove blanket 'noqas'Daniel Eades2022-12-161-1/+3
|
* Remove unneeded `noqa` lint suppression comments (#10772)danieleades2022-08-281-1/+1
|
* Further improve type annotations, reduce mypy whitelist (#10770)danieleades2022-08-281-6/+6
| | | Co-authored-by: Adam Turner <9087854+aa-turner@users.noreply.github.com>
* Improve static typing strictness (#10569)danieleades2022-07-181-5/+5
|
* Merge branch '4.x'Takeshi KOMIYA2022-03-191-9/+1
|\
| * 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
| |
* | Merge branch '4.x'Takeshi KOMIYA2022-01-171-5/+5
|\ \ | |/
| * Update sphinx/writers/texinfo.pydanieleades2022-01-141-1/+1
| | | | | | Co-authored-by: Takeshi KOMIYA <i.tkomiya@gmail.com>
| * address some unused loop control variables (B007)Daniel Eades2022-01-121-5/+5
| |
* | Merge branch '4.x'Takeshi KOMIYA2022-01-031-2/+2
|\ \ | |/
| * Migrate to Node.findall() from Node.traverse()Takeshi KOMIYA2022-01-031-2/+2
| | | | | | | | | | | | | | | | 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.x'Takeshi KOMIYA2022-01-011-1/+1
|\ \ | |/
| * Merge branch '4.3.x' into 4.xTakeshi KOMIYA2022-01-011-1/+1
| |\
| | * A happy new year!Takeshi KOMIYA2022-01-011-1/+1
| | |
* | | Merge branch '4.x'Takeshi KOMIYA2022-01-011-4/+0
|\ \ \ | |/ /
| * | Merge branch '4.x' into drop-translator-specific-unknown_visit-callsTakeshi KOMIYA2021-12-241-5/+21
| |\ \ | | |/
| * | drop translator-specific unknown_visit callsJames Knight2021-12-051-4/+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>
* | | Fix #9962: texinfo: Do not use @definfoenclose to empasize stringTakeshi KOMIYA2021-12-191-7/+9
| | | | | | | | | | | | | | | | | | | | | | | | Since texinfo-6.8, `@definfoenclose` command has been deprecated. This stops to use it to reduce the deprecation warning. This also disables the customization the styles of emphasized text via the command.
* | | refactor: Remove RemovedInSphinx50Warning (partially)Takeshi KOMIYA2021-12-171-12/+2
| |/ |/|
* | refactor: texinfo: Remove CR char from outputTakeshi KOMIYA2021-12-111-4/+2
| | | | | | | | | | | | The CR character was added for readability of output. But it makes the texinfo writer a bit complicated. This removes it from output to keep our code simple (reducing conditions).
* | Merge branch '4.x' into fix-footnote-in-infoTakeshi KOMIYA2021-12-111-4/+16
|\ \
| * \ Merge branch '4.x' into texinfo-add-texinfo_emit_document_referencesTakeshi KOMIYA2021-12-111-1/+10
| |\ \
| | * | texinfo: improve variable in :samp: directivesMartin Liska2021-11-081-1/+10
| | |/ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The following snippet: Show :samp:`Samp with a {variable}.` Ends in .info as: Show ‘Samp with a `variable'.’ Which is suboptimal and @var{variable} should be rather used. That results in ‘Samp with a VARIABLE.’.
| * | texinfo: simplify reference emission.Martin Liska2021-11-121-3/+6
| |/ | | | | | | | | | | | | | | | | | | | | | | | | | | | | The commit adds a new config value 'texinfo_emit_document_references' that blocks the emission of inline references and make it better readable with legacy stand-alone reader ``info``. Before the change we emit: Default option value for @ref{e,,-Wshift-overflow3}. while with texinfo_emit_document_references == True: Default option value for -Wshift-overflow3. It addresses limitations mentioned in Sphinx' FAQ: https://www.sphinx-doc.org/en/master/faq.html#texinfo-info
* | texinfo: fix emission of @footnote directives.Martin Liska2021-07-121-3/+9
|/ | | | | | | | | | | | | Right now, labels are emitted as part of a @footnote directive. That results in e.g. Note1: (@footnote{@w{(1)} Future versions of GCC may zero-extend... }) which is incorrect and should be rather: Note1: (@footnote{Future versions of GCC may zero-extend...})
* Decl styling, handle desc_inline in manpage and texinfoJakob Lykke Andersen2021-04-121-6/+22
|
* refactor: Use PEP-526 based variable annotation (sphinx.writers)Takeshi KOMIYA2021-03-131-30/+24
|
* Merge branch '3.x'Takeshi KOMIYA2021-01-221-4/+3
|\
| * refactor: Remove meaningless variable: attrsTakeshi KOMIYA2021-01-161-4/+3
| | | | | | | | | | It would be better to use `name in node` and `node[name]` to check and access an attribute of the node instead of `node.attributes`.
* | Merge branch '3.x'Takeshi KOMIYA2021-01-161-11/+10
|\ \ | |/
| * refactor: Access config object from self directly in writersTakeshi KOMIYA2021-01-101-11/+10
| |
* | 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/+4
| | | | | | | | | | | | | | | | | | | | | | | | 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/+9
|\ \ | |/