summaryrefslogtreecommitdiff
path: root/sphinx/domains
Commit message (Collapse)AuthorAgeFilesLines
* Allow multi-line object description signatures (#11011)TLouf2023-05-114-11/+77
| | | | | 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>
* Warn on deprecated Python-specific index types (#11412)Adam Turner2023-05-091-9/+9
|
* Harmonise references to Sphinx versions (#11361)Adam Turner2023-04-271-1/+1
|
* Remove deprecated ``make_old_id`` functions (#11360)Adam Turner2023-04-275-87/+0
|
* 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/
* Add an option for displaying short ``Literal`` types (#11109)Adam Turner2023-04-051-0/+5
| | | | | | The new ``python_display_short_literal_types`` configuration option for the ``py`` domain controls display of PEP 586 ``Literal`` types. The 'short' format is inspired by PEP 604, using the bitwise OR operator to distinguish the possible legal values for the argument.
* Resolve lint errors from Ruff 0.0.260Adam Turner2023-03-311-1/+1
|
* Fix typos found by codespellDimitri Papadopoulos2023-03-272-2/+2
|
* Resolve lint errors from Ruff 0.0.257Adam Turner2023-03-181-5/+5
|
* Resolve ``flake8-return`` errorsAdam Turner2023-02-185-53/+31
|
* Fix COM812Adam Turner2023-02-1810-70/+70
|
* Add ``content_offset`` parameter to ``nested_parse_with_titles`` (#11147)Jeremy Maitin-Shepard2023-02-152-10/+8
| | | | | | | | | | | | | | | | | | | | | | | Previously, ``nested_parse_with_titles`` always passed ``0`` as the input offset when invoking ``nested_parse``. When parsing the content of a directive, as is a common use case for ``nested_parse_with_titles``, this leads to incorrect source file/line number information, as it does not take into account the directive's ``content_offset``, which is always non-zero. This issue affects *all* object descriptions due to GH-10887. It also affects the ``sphinx.ext.ifconfig`` extension. The ``py:module`` and ``js:module`` directives employed a workaround for this issue, by wrapping the calls to ``nested_parse_with_title`` with ``switch_source_input``. That worked, but was more complicated (and likely less efficient) than necessary. This commit adds an optional ``content_offset`` parameter to ``nested_parse_with_titles``, and fixes callers to pass the appropriate content offset when needed. This commit eliminates the now-unnecessary calls to ``switch_source_input`` and instead specifies the correct ``content_offset``.
* Resolve Ruff SIM114 violationsAdam Turner2023-02-153-26/+19
|
* Adopt ``profile = "black"`` for ``isort``Adam Turner2023-01-073-16/+48
| | | | This allows using Ruff's import sorting fixers
* Update ruff configurationAdam Turner2023-01-031-1/+1
|
* De-glob mypy whitelist for 'sphinx.domains.*' (#11064)danieleades2023-01-0210-89/+148
| | | Co-authored-by: Adam Turner <9087854+AA-Turner@users.noreply.github.com>
* Use PEP 604 display for ``typing.Optional`` and ``typing.Union`` (#11072)Adam Turner2023-01-021-0/+24
|
* Use ``re`` flagsAdam Turner2023-01-022-10/+10
|
* Run pyupgrade (#11070)Adam Turner2023-01-029-326/+323
|
* Use PEP 604 typesAdam Turner2023-01-019-117/+112
|
* Use PEP 595 typesAdam Turner2023-01-0111-305/+302
|
* Insert ``from __future__ import annotations``Adam Turner2023-01-0111-0/+22
|
* remove blanket 'noqas'Daniel Eades2022-12-164-15/+30
|
* Run the ``pyupgrade`` toolAdam Turner2022-10-172-19/+19
|
* Use ``ast.parse`` from the standard libraryAdam Turner2022-10-171-2/+1
|
* Merge branch '5.x'Adam Turner2022-10-161-4/+11
|\ | | | | | | | | | | | | | | # Conflicts: # .github/workflows/main.yml # CHANGES # sphinx/__init__.py # sphinx/domains/c.py
| * Fix disabling cross-references in pre-v3 C domain (#10890)Adam Turner2022-10-051-1/+2
| |
| * Extend cross referencing options with values (#10883)Martin Liška2022-10-021-4/+11
| | | | | | | | | | | | | | | | This change means that text following `=`, `[=`, or ` ` is ignored when searching for a corresponding option directive to an option cross reference role. These are commonly used options, for example `--profile=path`, `--profile[=path]` or `--profile path`. Co-authored-by: Adam Turner <9087854+AA-Turner@users.noreply.github.com>
* | Remove support for parsing pre-v3 syntax in the C domain (#10901)Adam Turner2022-10-091-78/+2
| |
* | Merge branch '5.x'Adam Turner2022-09-306-4/+15
|\ \ | |/ | | | | | | # Conflicts: # sphinx/locale/__init__.py
| * Merge branch '5.2.x' into 5.xAdam Turner2022-09-305-3/+8
| |\ | | | | | | | | | | | | | | | # Conflicts: # CHANGES # sphinx/__init__.py
| | * Finer grained control over domain ToC entries (#10886)Adam Turner2022-09-305-3/+8
| | | | | | | | | | | | | | | - Implement `:nocontentsentry:` flag - Use `:nocontentsentry:` in docs - Add domain object table of contents configuration option
| * | extend option directive syntaxMartin Liska2022-09-271-1/+7
| |/ | | | | | | One can cross-reference an option value: :option:`--module=foobar`.
* | Drop Python 3.7Adam Turner2022-09-272-24/+11
| |
* | Clean up after dropping Python 3.6Adam Turner2022-09-271-1/+1
| |
* | Merge branch '5.x'Adam Turner2022-09-273-3/+5
|\ \ | |/
| * Restore anchor links to top of module docstringAdam Turner2022-09-272-2/+4
| |
| * Fix mypy violations for v0.981 (#10875)Adam Turner2022-09-271-1/+1
| |
* | Merge branch '5.x'Adam Turner2022-09-251-3/+3
|\ \ | |/ | | | | | | | | | | | | | | | | # Conflicts: # CHANGES # doc/conf.py # sphinx/__init__.py # sphinx/builders/html/__init__.py # sphinx/domains/python.py # tests/test_build_html.py
| * Docstring clarifications (#9877)Arthur Milchior2022-09-241-3/+3
| | | | | | | | | | Co-authored-by: Jakob Lykke Andersen <jakobandersen@users.noreply.github.com> Co-authored-by: Takeshi KOMIYA <i.tkomiya@gmail.com> Co-authored-by: Adam Turner <9087854+AA-Turner@users.noreply.github.com>
| * Warn on using the `:property:` flag with `.. py:method::` (#10852)Adam Turner2022-09-231-0/+2
| |
* | Merge branch '5.x'Adam Turner2022-09-236-15/+133
|\ \ | |/ | | | | | | | | # Conflicts: # setup.py # sphinx/__init__.py
| * Add contents entries for domain objects (#10807)Adam Turner2022-09-135-14/+127
| | | | | | | | | | | | | | | | | | - Add entries in the table of contents for domain objects (e.g. `py:function`, `rst:role`, etc). Supported domains are Javascript, Python, and reStructuredText. - Support content in `py:module` and `js:module` directives. - Add the `noindexentry` and `noindex` flags to more domains. - Add `toc_object_entries_show_parents` configuration setting - Update documentation and tests
| * Fix mypy errorAdam Turner2022-09-121-1/+6
| |
* | Merge branch '5.x'Adam Turner2022-09-093-16/+28
|\ \ | |/ | | | | | | | | | | | | | | # Conflicts: # setup.py # sphinx/application.py # sphinx/environment/__init__.py # sphinx/ext/autodoc/directive.py # tests/test_build_html.py
| * Allow `:ref:` role to be used with definitions and fields (#10781)Jeremy Maitin-Shepard2022-09-061-5/+14
| |
| * Fix more strict static typing errors (#10681)danieleades2022-08-282-10/+13
| |
| * Remove unneeded `noqa` lint suppression comments (#10772)danieleades2022-08-281-1/+1
| |
* | Merge branch '5.x'Jean-François B2022-08-062-40/+100
|\ \ | |/