Skip to content

Commit

Permalink
Merge remote-tracking branch 'upstream/5.0.x' into lang-none-en
Browse files Browse the repository at this point in the history
  • Loading branch information
AA-Turner committed May 28, 2022
2 parents 479e482 + 004012b commit 78c478a
Show file tree
Hide file tree
Showing 6 changed files with 36 additions and 3 deletions.
2 changes: 2 additions & 0 deletions CHANGES
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,8 @@ Bugs fixed
``autodoc_typehints="description"``
* #8180: autodoc: Docstring metadata ignored for attributes
* #10443: epub: EPUB builder can't detect the mimetype of .webp file
* #10104: gettext: Duplicated locations are shown if 3rd party extension does
not provide correct information
* #10456: py domain: ``:meta:`` fields are displayed if docstring contains two
or more meta-field
* #9096: sphinx-build: the value of progress bar for paralle build is wrong
Expand Down
2 changes: 1 addition & 1 deletion EXAMPLES
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ Documentation using the alabaster theme
* `pytest <https://docs.pytest.org/>`__ (customized)
* `python-apt <https://apt-team.pages.debian.net/python-apt/>`__
* `PyVisfile <https://documen.tician.de/pyvisfile/>`__
* `Requests <https://docs.python-requests.org/>`__
* `Requests <https://requests.readthedocs.io/>`__
* `searx <https://asciimoo.github.io/searx/>`__
* `Spyder <https://docs.spyder-ide.org/>`__ (customized)
* `Tablib <http://docs.python-tablib.org/>`__
Expand Down
2 changes: 1 addition & 1 deletion doc/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,7 @@

intersphinx_mapping = {
'python': ('https://docs.python.org/3/', None),
'requests': ('https://docs.python-requests.org/en/latest/', None),
'requests': ('https://requests.readthedocs.io/en/latest/', None),
'readthedocs': ('https://docs.readthedocs.io/en/stable', None),
}

Expand Down
10 changes: 10 additions & 0 deletions doc/usage/restructuredtext/directives.rst
Original file line number Diff line number Diff line change
Expand Up @@ -592,6 +592,13 @@ __ https://pygments.org/docs/lexers
.. versionadded:: 1.3
.. rst:directive:option:: class: class names
:type: a list of class names separated by spaces
The class name of the graph.
.. versionadded:: 1.4
.. rst:directive:option:: dedent: number
:type: number or no value
Expand Down Expand Up @@ -758,6 +765,9 @@ __ https://pygments.org/docs/lexers
Added the ``diff``, ``lineno-match``, ``caption``, ``name``, and
``dedent`` options.

.. versionchanged:: 1.4
Added the ``class`` option.

.. versionchanged:: 1.5
Added the ``start-at``, and ``end-at`` options.

Expand Down
3 changes: 2 additions & 1 deletion sphinx/builders/gettext.py
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,8 @@ def add(self, msg: str, origin: Union[Element, "MsgOrigin"]) -> None:

def __iter__(self) -> Generator[Message, None, None]:
for message in self.messages:
positions = [(source, line) for source, line, uuid in self.metadata[message]]
positions = sorted(set((source, line) for source, line, uuid
in self.metadata[message]))
uuids = [uuid for source, line, uuid in self.metadata[message]]
yield Message(message, positions, uuids)

Expand Down
20 changes: 20 additions & 0 deletions tests/test_build_gettext.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,29 @@

import pytest

from sphinx.builders.gettext import Catalog, MsgOrigin
from sphinx.util.osutil import cd


def test_Catalog_duplicated_message():
catalog = Catalog()
catalog.add('hello', MsgOrigin('/path/to/filename', 1))
catalog.add('hello', MsgOrigin('/path/to/filename', 1))
catalog.add('hello', MsgOrigin('/path/to/filename', 2))
catalog.add('hello', MsgOrigin('/path/to/yetanother', 1))
catalog.add('world', MsgOrigin('/path/to/filename', 1))

assert len(list(catalog)) == 2

msg1, msg2 = list(catalog)
assert msg1.text == 'hello'
assert msg1.locations == [('/path/to/filename', 1),
('/path/to/filename', 2),
('/path/to/yetanother', 1)]
assert msg2.text == 'world'
assert msg2.locations == [('/path/to/filename', 1)]


@pytest.mark.sphinx('gettext', srcdir='root-gettext')
def test_build_gettext(app):
# Generic build; should fail only when the builder is horribly broken.
Expand Down

0 comments on commit 78c478a

Please sign in to comment.