Improve keybinding rendering under the text builder

Previously rendered as e.g. "CtrlShiftK"
develop
lethosor 2022-08-17 23:18:58 -04:00
parent fa8bceba93
commit 72de1873e0
No known key found for this signature in database
GPG Key ID: 76A269552F4F58C1
1 changed files with 2 additions and 0 deletions

@ -76,6 +76,8 @@ def render_dfhack_keybind(command, builder: sphinx.builders.Builder) -> List[nod
for keycmd, key, ctx in _KEYBINDS[command]: for keycmd, key, ctx in _KEYBINDS[command]:
n = make_labeled_paragraph('Keybinding', label_class=get_label_class(builder)) n = make_labeled_paragraph('Keybinding', label_class=get_label_class(builder))
for k in key: for k in key:
if builder.format == 'text':
k = '[{}]'.format(k)
n += nodes.inline(k, k, classes=['kbd']) n += nodes.inline(k, k, classes=['kbd'])
if keycmd != command: if keycmd != command:
n += nodes.inline(' -> ', ' -> ') n += nodes.inline(' -> ', ' -> ')