Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Close #8619: html: kbd role generates customizable HTML tags for compound keys #8620

Merged
merged 1 commit into from
Dec 31, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
1 change: 1 addition & 0 deletions CHANGES
Original file line number Diff line number Diff line change
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
Original file line number Diff line number Diff line change
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
Original file line number Diff line number Diff line change
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