Skip to content

Commit

Permalink
Fix invalid genindex.html file produced with translated docs (#12495)
Browse files Browse the repository at this point in the history
  • Loading branch information
n-peugnet authored Jul 4, 2024
1 parent 57bf4dd commit b23ac4f
Show file tree
Hide file tree
Showing 4 changed files with 16 additions and 3 deletions.
3 changes: 3 additions & 0 deletions CHANGES.rst
Original file line number Diff line number Diff line change
Expand Up @@ -86,6 +86,9 @@ Bugs fixed
* #12331: Resolve data-URI-image-extraction regression from v7.3.0 affecting
builders without native support for data-URIs in their output format.
Patch by James Addison.
* #12494: Fix invalid genindex.html file produced with translated docs
(regression in 7.1.0).
Patch by Nicolas Peugnet.

Testing
-------
Expand Down
4 changes: 2 additions & 2 deletions sphinx/domains/std/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -272,7 +272,7 @@ def split_term_classifiers(line: str) -> tuple[str, str | None]:
return term, first_classifier


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

# use first classifier as a index key
term = make_glossary_term(self.env, textnodes,
first_classifier, source, lineno, # type: ignore[arg-type]
first_classifier, source, lineno,
node_id=None, document=self.state.document)
term.rawsource = line
system_messages.extend(sysmsg)
Expand Down
2 changes: 1 addition & 1 deletion sphinx/transforms/i18n.py
Original file line number Diff line number Diff line change
Expand Up @@ -411,7 +411,7 @@ def apply(self, **kwargs: Any) -> None:
self.app, term or '', source, node.line, self.config, settings, # type: ignore[arg-type]
)
updater.patch = make_glossary_term(
self.env, patch, first_classifier or '',
self.env, patch, first_classifier,
source, node.line, _id, self.document, # type: ignore[arg-type]
)
processed = True
Expand Down
10 changes: 10 additions & 0 deletions tests/test_intl/test_intl.py
Original file line number Diff line number Diff line change
Expand Up @@ -938,6 +938,16 @@ def wrap_nest(parenttag, childtag, keyword):
start_tag2 = "<%s[^>]*>" % childtag
return fr"{start_tag1}\s*{keyword}\s*{start_tag2}"
expected_exprs = [
wrap('h2', 'Symbols'),
wrap('h2', 'C'),
wrap('h2', 'E'),
wrap('h2', 'F'),
wrap('h2', 'M'),
wrap('h2', 'N'),
wrap('h2', 'R'),
wrap('h2', 'S'),
wrap('h2', 'T'),
wrap('h2', 'V'),
wrap('a', 'NEWSLETTER'),
wrap('a', 'MAILING LIST'),
wrap('a', 'RECIPIENTS LIST'),
Expand Down

0 comments on commit b23ac4f

Please sign in to comment.