Skip to content

Commit 78c478a

Browse files
committed
Merge remote-tracking branch 'upstream/5.0.x' into lang-none-en
2 parents 479e482 + 004012b commit 78c478a

File tree

6 files changed

+36
-3
lines changed

6 files changed

+36
-3
lines changed

CHANGES

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,8 @@ Bugs fixed
2525
``autodoc_typehints="description"``
2626
* #8180: autodoc: Docstring metadata ignored for attributes
2727
* #10443: epub: EPUB builder can't detect the mimetype of .webp file
28+
* #10104: gettext: Duplicated locations are shown if 3rd party extension does
29+
not provide correct information
2830
* #10456: py domain: ``:meta:`` fields are displayed if docstring contains two
2931
or more meta-field
3032
* #9096: sphinx-build: the value of progress bar for paralle build is wrong

EXAMPLES

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ Documentation using the alabaster theme
4040
* `pytest <https://docs.pytest.org/>`__ (customized)
4141
* `python-apt <https://apt-team.pages.debian.net/python-apt/>`__
4242
* `PyVisfile <https://documen.tician.de/pyvisfile/>`__
43-
* `Requests <https://docs.python-requests.org/>`__
43+
* `Requests <https://requests.readthedocs.io/>`__
4444
* `searx <https://asciimoo.github.io/searx/>`__
4545
* `Spyder <https://docs.spyder-ide.org/>`__ (customized)
4646
* `Tablib <http://docs.python-tablib.org/>`__

doc/conf.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -109,7 +109,7 @@
109109

110110
intersphinx_mapping = {
111111
'python': ('https://docs.python.org/3/', None),
112-
'requests': ('https://docs.python-requests.org/en/latest/', None),
112+
'requests': ('https://requests.readthedocs.io/en/latest/', None),
113113
'readthedocs': ('https://docs.readthedocs.io/en/stable', None),
114114
}
115115

doc/usage/restructuredtext/directives.rst

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -592,6 +592,13 @@ __ https://pygments.org/docs/lexers
592592
593593
.. versionadded:: 1.3
594594
595+
.. rst:directive:option:: class: class names
596+
:type: a list of class names separated by spaces
597+
598+
The class name of the graph.
599+
600+
.. versionadded:: 1.4
601+
595602
.. rst:directive:option:: dedent: number
596603
:type: number or no value
597604
@@ -758,6 +765,9 @@ __ https://pygments.org/docs/lexers
758765
Added the ``diff``, ``lineno-match``, ``caption``, ``name``, and
759766
``dedent`` options.
760767

768+
.. versionchanged:: 1.4
769+
Added the ``class`` option.
770+
761771
.. versionchanged:: 1.5
762772
Added the ``start-at``, and ``end-at`` options.
763773

sphinx/builders/gettext.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,8 @@ def add(self, msg: str, origin: Union[Element, "MsgOrigin"]) -> None:
5757

5858
def __iter__(self) -> Generator[Message, None, None]:
5959
for message in self.messages:
60-
positions = [(source, line) for source, line, uuid in self.metadata[message]]
60+
positions = sorted(set((source, line) for source, line, uuid
61+
in self.metadata[message]))
6162
uuids = [uuid for source, line, uuid in self.metadata[message]]
6263
yield Message(message, positions, uuids)
6364

tests/test_build_gettext.py

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,9 +8,29 @@
88

99
import pytest
1010

11+
from sphinx.builders.gettext import Catalog, MsgOrigin
1112
from sphinx.util.osutil import cd
1213

1314

15+
def test_Catalog_duplicated_message():
16+
catalog = Catalog()
17+
catalog.add('hello', MsgOrigin('/path/to/filename', 1))
18+
catalog.add('hello', MsgOrigin('/path/to/filename', 1))
19+
catalog.add('hello', MsgOrigin('/path/to/filename', 2))
20+
catalog.add('hello', MsgOrigin('/path/to/yetanother', 1))
21+
catalog.add('world', MsgOrigin('/path/to/filename', 1))
22+
23+
assert len(list(catalog)) == 2
24+
25+
msg1, msg2 = list(catalog)
26+
assert msg1.text == 'hello'
27+
assert msg1.locations == [('/path/to/filename', 1),
28+
('/path/to/filename', 2),
29+
('/path/to/yetanother', 1)]
30+
assert msg2.text == 'world'
31+
assert msg2.locations == [('/path/to/filename', 1)]
32+
33+
1434
@pytest.mark.sphinx('gettext', srcdir='root-gettext')
1535
def test_build_gettext(app):
1636
# Generic build; should fail only when the builder is horribly broken.

0 commit comments

Comments
 (0)