Skip to content

Commit b23ac4f

Browse files
authored
Fix invalid genindex.html file produced with translated docs (#12495)
1 parent 57bf4dd commit b23ac4f

File tree

4 files changed

+16
-3
lines changed

4 files changed

+16
-3
lines changed

CHANGES.rst

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -86,6 +86,9 @@ Bugs fixed
8686
* #12331: Resolve data-URI-image-extraction regression from v7.3.0 affecting
8787
builders without native support for data-URIs in their output format.
8888
Patch by James Addison.
89+
* #12494: Fix invalid genindex.html file produced with translated docs
90+
(regression in 7.1.0).
91+
Patch by Nicolas Peugnet.
8992

9093
Testing
9194
-------

sphinx/domains/std/__init__.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -272,7 +272,7 @@ def split_term_classifiers(line: str) -> tuple[str, str | None]:
272272
return term, first_classifier
273273

274274

275-
def make_glossary_term(env: BuildEnvironment, textnodes: Iterable[Node], index_key: str,
275+
def make_glossary_term(env: BuildEnvironment, textnodes: Iterable[Node], index_key: str | None,
276276
source: str, lineno: int, node_id: str | None, document: nodes.document,
277277
) -> nodes.term:
278278
# get a text-only representation of the term and register it
@@ -395,7 +395,7 @@ def run(self) -> list[Node]:
395395

396396
# use first classifier as a index key
397397
term = make_glossary_term(self.env, textnodes,
398-
first_classifier, source, lineno, # type: ignore[arg-type]
398+
first_classifier, source, lineno,
399399
node_id=None, document=self.state.document)
400400
term.rawsource = line
401401
system_messages.extend(sysmsg)

sphinx/transforms/i18n.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -411,7 +411,7 @@ def apply(self, **kwargs: Any) -> None:
411411
self.app, term or '', source, node.line, self.config, settings, # type: ignore[arg-type]
412412
)
413413
updater.patch = make_glossary_term(
414-
self.env, patch, first_classifier or '',
414+
self.env, patch, first_classifier,
415415
source, node.line, _id, self.document, # type: ignore[arg-type]
416416
)
417417
processed = True

tests/test_intl/test_intl.py

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -938,6 +938,16 @@ def wrap_nest(parenttag, childtag, keyword):
938938
start_tag2 = "<%s[^>]*>" % childtag
939939
return fr"{start_tag1}\s*{keyword}\s*{start_tag2}"
940940
expected_exprs = [
941+
wrap('h2', 'Symbols'),
942+
wrap('h2', 'C'),
943+
wrap('h2', 'E'),
944+
wrap('h2', 'F'),
945+
wrap('h2', 'M'),
946+
wrap('h2', 'N'),
947+
wrap('h2', 'R'),
948+
wrap('h2', 'S'),
949+
wrap('h2', 'T'),
950+
wrap('h2', 'V'),
941951
wrap('a', 'NEWSLETTER'),
942952
wrap('a', 'MAILING LIST'),
943953
wrap('a', 'RECIPIENTS LIST'),

0 commit comments

Comments
 (0)