Review comments

This commit is contained in:
Adam Turner 2022-06-01 18:10:55 +01:00
parent 91f90a5fb5
commit efdbe06eea
2 changed files with 2 additions and 3 deletions

View File

@ -42,8 +42,7 @@ class KeyboardTransform(SphinxPostTransform):
matcher = NodeMatcher(nodes.literal, classes=["kbd"]) matcher = NodeMatcher(nodes.literal, classes=["kbd"])
# this list must be pre-created as during iteration new nodes # this list must be pre-created as during iteration new nodes
# are added which match the condition in the NodeMatcher. # are added which match the condition in the NodeMatcher.
nodes_to_expand: List[nodes.literal] = list(self.document.findall(matcher)) for node in list(self.document.findall(matcher)): # type: nodes.literal
for node in nodes_to_expand: # type: nodes.literal
parts = self.pattern.split(node[-1].astext()) parts = self.pattern.split(node[-1].astext())
if len(parts) == 1 or self.is_multiwords_key(parts): if len(parts) == 1 or self.is_multiwords_key(parts):
continue continue

View File

@ -52,7 +52,7 @@ def test_missing_reference_conditional_pending_xref(app, status, warning):
@pytest.mark.sphinx('html', testroot='transforms-post_transforms-keyboard', @pytest.mark.sphinx('html', testroot='transforms-post_transforms-keyboard',
freshenv=True) freshenv=True)
def test_keyboard_issue_10495(app): def test_keyboard_hyphen_spaces(app):
"""Regression test for issue 10495, we want no crash.""" """Regression test for issue 10495, we want no crash."""
app.build() app.build()
assert "spanish" in (app.outdir / 'index.html').read_text(encoding='utf8') assert "spanish" in (app.outdir / 'index.html').read_text(encoding='utf8')