Skip to content

Commit

Permalink
Close #8619: html: kbd role generates customizable HTML tags for comp…
Browse files Browse the repository at this point in the history
…ound keys
  • Loading branch information
tk0miya committed Dec 30, 2020
1 parent 21698c1 commit 8e5f4e5
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 3 deletions.
1 change: 1 addition & 0 deletions CHANGES
Expand Up @@ -19,6 +19,7 @@ Features added
* #8022: autodoc: autodata and autoattribute directives does not show right-hand
value of the variable if docstring contains ``:meta hide-value:`` in
info-field-list
* #8619: html: kbd role generates customizable HTML tags for compound keys
* #8132: Add :confval:`project_copyright` as an alias of :confval:`copyright`

Bugs fixed
Expand Down
3 changes: 2 additions & 1 deletion sphinx/builders/html/transforms.py
Expand Up @@ -28,7 +28,7 @@ class KeyboardTransform(SphinxPostTransform):
After::
<literal class="kbd">
<literal class="kbd compound">
<literal class="kbd">
Control
-
Expand All @@ -46,6 +46,7 @@ def run(self, **kwargs: Any) -> None:
if len(parts) == 1:
continue

node['classes'].append('compound')
node.pop()
while parts:
key = parts.pop(0)
Expand Down
4 changes: 2 additions & 2 deletions tests/test_markup.py
Expand Up @@ -244,7 +244,7 @@ def get(name):
# kbd role
'verify',
':kbd:`Control+X`',
('<p><kbd class="kbd docutils literal notranslate">'
('<p><kbd class="kbd compound docutils literal notranslate">'
'<kbd class="kbd docutils literal notranslate">Control</kbd>'
'+'
'<kbd class="kbd docutils literal notranslate">X</kbd>'
Expand All @@ -255,7 +255,7 @@ def get(name):
# kbd role
'verify',
':kbd:`M-x M-s`',
('<p><kbd class="kbd docutils literal notranslate">'
('<p><kbd class="kbd compound docutils literal notranslate">'
'<kbd class="kbd docutils literal notranslate">M</kbd>'
'-'
'<kbd class="kbd docutils literal notranslate">x</kbd>'
Expand Down

0 comments on commit 8e5f4e5

Please sign in to comment.