summaryrefslogtreecommitdiff
path: root/sphinx/util/nodes.py
Commit message (Collapse)AuthorAgeFilesLines
* Warn on deprecated Python-specific index types (#11412)Adam Turner2023-05-091-10/+14
|
* Fix COM812Adam Turner2023-02-181-5/+5
|
* Add ``content_offset`` parameter to ``nested_parse_with_titles`` (#11147)Jeremy Maitin-Shepard2023-02-151-2/+3
| | | | | | | | | | | | | | | | | | | | | | | 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-151-1/+1
|
* Handle exceptions for ``get_node_source`` and ``get_node_line``Adam Turner2023-01-101-3/+7
|
* Restore Sphinx 5 ``nodes.Element`` copying behaviourAdam Turner2023-01-101-0/+15
|
* Suppress ``ValueError`` in ``apply_source_workaround`` (#11092)Adam Turner2023-01-051-1/+3
|
* De-glob mypy whitelist for 'sphinx.domains.*' (#11064)danieleades2023-01-021-1/+1
| | | Co-authored-by: Adam Turner <9087854+AA-Turner@users.noreply.github.com>
* Shrink mypy whitelist for 'util.nodes' module (#11061)danieleades2023-01-021-4/+4
|
* Run pyupgrade (#11070)Adam Turner2023-01-021-5/+5
|
* Use PEP 604 typesAdam Turner2023-01-011-9/+9
|
* Use PEP 595 typesAdam Turner2023-01-011-11/+10
|
* Insert ``from __future__ import annotations``Adam Turner2023-01-011-1/+4
|
* Enable Ruff's pylint checksAdam Turner2022-12-291-2/+1
| | | | | 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-1/+3
|
* Run the ``pyupgrade`` toolAdam Turner2022-10-171-1/+1
|
* Increase minimum Docutils to 0.18Adam Turner2022-09-271-24/+2
|
* Increase minimum Docutils to 0.17Adam Turner2022-09-271-19/+3
|
* Improve static typing strictness (#10569)danieleades2022-07-181-2/+3
|
* Remove redundant static typing casts (#10612)danieleades2022-07-021-2/+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
|
* Migrate to Node.findall() from Node.traverse()Takeshi KOMIYA2022-01-031-11/+12
| | | | | | | | 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.
* i18n: meta strings are not translated with docutils-0.18Takeshi KOMIYA2022-01-021-2/+9
| | | | | | | i18n feature for meta strings does not work if docutils-0.18 used. Note: Since docutils-0.18, patch for meta directive is no longer needed because it uses a picklable meta nodes; ``docutils.nodes.meta``.
* A happy new year!Takeshi KOMIYA2022-01-011-1/+1
|
* Fix #9947: i18n: topic directive having a bullet list can't be translatableTakeshi KOMIYA2021-12-101-0/+5
| | | | | | It seems docutils does not fill the topic node with the source info when a topic directive has a bullet list. As a workaround, This fills the source info of them.
* Support docutils-0.18: Consume iterator of Element.traverse()Takeshi KOMIYA2021-10-271-2/+2
| | | | | | | Since 0.18, Element.traverse() returns an iterator instead of intermediate object. As a result, the return value is always considered as truthy value. And it becomes fragile when the caller modifies the doctree on the loop.
* Check complete ancestry of text nodes for smartquotes eligibility.Justin Turner Arthur2021-08-211-7/+9
| | | | Fixes sphinx-doc/sphinx#9564.
* Improve sphinx.util.nodes docstringsLouis Maddox2021-07-181-5/+5
|
* refactor: Add Optional to type annotationsTakeshi KOMIYA2021-05-031-9/+12
|
* refactor: use raw Type for type annotationsTakeshi KOMIYA2021-04-041-1/+1
|
* refactor: Use PEP-526 based variable annotation (sphinx.util)Takeshi KOMIYA2021-03-101-2/+2
|
* Fix #7199: py domain: Add a new confval: python_use_unqualified_type_namesTakeshi KOMIYA2021-03-061-3/+3
| | | | | | Add a new config variable: python_use_unqualified_type_names. If enabled, it goes to suppress the module name of the python reference if it can be resolved.
* Filter pending_xref_condition node on failed resolutionTakeshi KOMIYA2021-03-061-0/+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-12-141-38/+38
|\ \ | |/
| * refactor with pyupgradeTakeshi KOMIYA2020-11-251-38/+38
| | | | | | | | | | | | Run `pyupgrade --py3-only --keep-percent-format` to refine our code. Note: --keep-percent-format is required to keep translations available.
* | Merge branch '3.x'Takeshi KOMIYA2020-11-121-2/+1
|\ \ | |/
| * Sort imports with isortFrançois Freitag2020-11-111-2/+2
| | | | | | | | | | | | | | | | | | | | | | | | 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-07-241-0/+1
|\ \ | |/
| * i18n: process math_block as a literal nodeVictor "multun" Collod2020-07-161-0/+1
| |
* | Close #7784: i18n: The alt text for image is translated by defaultTakeshi KOMIYA2020-07-191-6/+10
| | | | | | | | | | Make alt text for image translatable by default without settings of gettext_additional_targets.
* | Merge tag 'v3.1.1'Takeshi KOMIYA2020-07-051-1/+1
|\ \ | |/
| * Fix #7803: Fix typo in import-block for type annotationTakeshi KOMIYA2020-06-091-1/+1
| |
* | Merge branch '3.x'Takeshi KOMIYA2020-06-041-1/+2
|\ \ | |/
| * Merge branch '3.0.x' into 3.xTakeshi KOMIYA2020-06-031-1/+2
| |\