Skip to content

Commit 32a22af

Browse files
committed
🎨 Rearrange gui documentation
* Add style for kbd role
1 parent 338d2c8 commit 32a22af

File tree

3 files changed

+50
-49
lines changed

3 files changed

+50
-49
lines changed

docs/_static/css/cusy.css

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
.accelerator {
2+
text-decoration: underline;
3+
}

docs/conf.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -155,6 +155,9 @@
155155
# If true, `todo` and `todoList` produce output, else they produce nothing.
156156
todo_include_todos = False
157157

158+
html_css_files = [
159+
"css/cusy.css",
160+
]
158161

159162
# -- Options for HTML output -------------------------------------------
160163

docs/document/sphinx/ui-elements.rst

Lines changed: 44 additions & 49 deletions
Original file line numberDiff line numberDiff line change
@@ -1,52 +1,47 @@
11
UI elements and interactions
22
============================
33

4-
.. rst:role:: guilabel
5-
6-
Labels that are presented as part of an interactive user interface should be
7-
marked with :rst:role:`guilabel`. Any label used in the interface should be
8-
identified with this role, including labels for buttons, window titles,
9-
field names, menu and menu selection names, and even values in selection
10-
lists.
11-
12-
A keyboard shortcut for GUI labelling can be inserted with an ampersand (&);
13-
this will underline the following letter in the output.
14-
15-
:guilabel:`&Cancel` is achieved, for example, with the following distinction:
16-
17-
.. code-block:: rest
18-
19-
:guilabel:`&Cancel`
20-
21-
.. note::
22-
If you want to insert an ampersand, you can simply double it.
23-
24-
.. rst:role:: kbd
25-
26-
This represents a sequence of keystrokes. The form of the key sequence may
27-
depend on platform- or application-specific conventions. If there are no
28-
corresponding conventions, the names of modifier keys should be written out
29-
to improve accessibility. Also, do not reference a specific keyboard label.
30-
31-
You can achieve :kbd:`Ctrl-s`, for example, with the following markup:
32-
33-
.. code-block:: rest
34-
35-
:kbd:`Ctrl-s`
36-
37-
.. rst:role:: menuselection
38-
39-
A menu selection should be marked with the ``menuselection`` role. This is
40-
used to mark a complete sequence, including submenu selections and selections
41-
of specific operations or any subsequences. The names of the individual
42-
selections should be separated by ``-->``.
43-
44-
:menuselection:`View --> Cell Toolba r--> Slideshow` is achieved, for
45-
example, with the following markup:
46-
47-
.. code-block:: rest
48-
49-
:menuselection:`View --> Cell Toolbar --> Slideshow`
50-
51-
:rst:role:`menuselection`, just like :rst:role:`guilabel`, also supports
52-
keyboard shortcuts with an ampersand (&).
4+
Sphinx provides three different roles for the documentation of the user
5+
interface and its interactions: ``guilabel``, ``kbd`` and ``menuselection``:
6+
7+
.. list-table::
8+
:header-rows: 1
9+
10+
* - Input
11+
- Output
12+
- Annotations
13+
* - .. code-block:: rest
14+
15+
:guilabel:`Cancel`
16+
- :guilabel:`Cancel`
17+
- Any label used in the user interface can be labelled with this role,
18+
including the labels of buttons, window titles, field, menu and menu
19+
selection names and values in selection lists.
20+
* - .. code-block:: rest
21+
22+
:guilabel:`&Cancel`
23+
- :guilabel:`&Cancel`
24+
- Keyboard shortcuts for GUI labelling can be inserted with an et character
25+
(``&``); this leads to underlining of the following letter in the output.
26+
27+
.. note::
28+
If you want to insert an et character, you can simply double it.
29+
* - .. code-block:: rest
30+
31+
:kbd:`Ctrl-s`
32+
- :kbd:`Ctrl-s`
33+
- This represents a sequence of keystrokes. The form of the key sequence
34+
may depend on platform or application-specific conventions. The names of
35+
modifier keys should be written out in full to improve accessibility.
36+
Keyboard labelling should be referenced.
37+
* - .. code-block:: rest
38+
39+
:menuselection:`File --> Save`
40+
- :menuselection:`File --> Save`
41+
- A menu selection is labelled with the ``menuselection`` role. This marks
42+
the complete sequence, including the selection of submenus, specific
43+
operations or any sub-sequences. The names of the individual selections
44+
are separated by ``-->``.
45+
46+
Like :rst:role:`guilabel`, :rst:role:`menuselection` supports keyboard
47+
shortcuts with an et character (``&``).

0 commit comments

Comments
 (0)