Skip to content

Commit 89d08ab

Browse files
committed
[TASK] Overhaul text roles reference page
The page was a two-line summary plus a tabbed snippet dump with no explanation of what each role does or when to use it. Give :abbr:, :path:, :file:, and :issue: their own entries with rendered examples, and add a callout on the backslash-escaping gotcha (`\Vendor\Ext\Class` silently drops its backslashes; :file:/:php:/:php-short: are exceptions). Point to the pages that already cover :guilabel:/:kbd:, :composer:/:t3ext:, :t3src:, and the code roles instead of duplicating them here. Cross-reference the backslash callout from InlineCode.rst's existing plain-literal example, and reword CodingGuidelines.rst's GUI section to lead with "use :guilabel: for any visible label" instead of only covering click-path separators, adding a single-label example to match. Not verified with the Docker render pipeline: this environment has no network access to resolve docs.typo3.org's intersphinx inventory. Assisted-by: Claude Sonnet 5 <noreply@anthropic.com> Signed-off-by: Lina Wolf
1 parent ab28c93 commit 89d08ab

4 files changed

Lines changed: 136 additions & 28 deletions

File tree

Documentation/Advanced/CodingGuidelines.rst

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -272,9 +272,10 @@ For this to work, `ext_core` must be defined in :file:`Settings.cfg`:
272272
Referring to GUI elements
273273
=========================
274274

275-
If you describe something that needs to be selected from a menu or other GUI
276-
element or clicked one after the other, use *>* as separator and use
277-
:ref:`text role guilabel <text-roles>`.
275+
Use :ref:`text role guilabel <text-roles>` for any label that is visible in
276+
the GUI: a backend module, a tab, a button, a field, or a menu entry. If you
277+
describe several of these being selected or clicked one after the other, use
278+
`>` as separator inside a single :rst:`:guilabel:`.
278279

279280
.. important::
280281

@@ -296,6 +297,13 @@ How it looks:
296297
How it looks:
297298
Click on :guilabel:`ADMIN TOOLS > Extensions` in the backend.
298299

300+
.. code-block:: rst
301+
302+
Manage extensions in the :guilabel:`Extension Manager` module.
303+
304+
How it looks:
305+
Manage extensions in the :guilabel:`Extension Manager` module.
306+
299307

300308
.. index::
301309
reST; Keystrokes

Documentation/Reference/ReStructuredText/Code/InlineCode.rst

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -94,8 +94,11 @@ those cases a plain literal reads more honestly:
9494
9595
* When you are talking about a concept rather than naming a specific,
9696
resolvable class — for example "a PreviewRenderer" used generically,
97-
not `\Vendor\Ext\PreviewRenderer` — a plain literal fits better, since
98-
there is no single class the infobox could point to.
97+
not `\\Vendor\\Ext\\PreviewRenderer` — a plain literal fits better,
98+
since there is no single class the infobox could point to. Note the
99+
doubled backslashes: unlike :rst:`:php:`, a plain literal drops a
100+
single backslash instead of printing it — see
101+
`Supported named inline text roles <https://docs.typo3.org/permalink/h2document:text-roles-backslash>`_.
99102

100103
* Headlines are the one place to leave roles out entirely, including
101104
:rst:`:php:`/:rst:`:php-short:` — use plain backticks there even for

Documentation/Reference/ReStructuredText/InlineMarkup/TextRoles/Index.rst

Lines changed: 120 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -7,26 +7,132 @@
77
Supported named inline text roles
88
=================================
99

10-
In general we support any text roles in reStructuredText that were previously
11-
supported by Sphinx.
10+
A named inline text role marks up a short piece of text inline, in the
11+
middle of a sentence. Write the role name surrounded by colons
12+
(:rst:`:role-name:`), immediately followed — with no space — by the text
13+
it applies to, enclosed in backticks. Some roles expect that text to
14+
follow a particular syntax, for example a link target, an issue number,
15+
or a fully-qualified class name.
1216

13-
The TYPO3 Documentation Rendering Container also supports the
17+
In general we support any text roles in reStructuredText that were
18+
previously supported by Sphinx. The TYPO3 Documentation Rendering
19+
Container also supports the
1420
`Docutils Standard Text Roles <https://docutils.sourceforge.io/docs/ref/rst/roles.html#standard-roles>`_
15-
except for `:raw:`, as that could pose security issues.
21+
except for :rst:`:raw:`, as that could pose security issues.
1622

17-
.. seealso::
23+
The roles below are the ones most commonly used across TYPO3
24+
documentation that are not already covered on their own page.
1825

19-
* `Basic inline markup (bold, italic etc.) <https://docs.typo3.org/permalink/h2document:rest-bold-italic>`_
20-
* `Inline code with or without overlays <https://docs.typo3.org/permalink/h2document:inline-code>`_
21-
for roles like `:php:`, `:typoscript:`, etc.
22-
* `Links in ReStructured Text <https://docs.typo3.org/permalink/h2document:how-to-document-hyperlinks>`_
26+
.. _text-roles-backslash:
27+
28+
.. attention::
29+
30+
For most roles, a lone backslash inside the backticks is treated as
31+
an escape character and silently disappears from the output instead
32+
of being printed. This trips people up in Windows paths and PHP
33+
namespaces:
34+
35+
.. code-block:: rst
36+
37+
`\Vendor\Ext\MyClass` renders as: VendorExtMyClass
38+
`\\Vendor\\Ext\\MyClass` renders as: \Vendor\Ext\MyClass
39+
40+
Double every backslash you want to keep. :rst:`:file:`, :rst:`:php:`
41+
and :rst:`:php-short:` are exceptions -- they take the text verbatim,
42+
so a single backslash there already prints as-is. If you are not
43+
sure how a given role handles it, check the rendered output rather
44+
than assuming.
45+
46+
.. index:: reST roles; abbr
47+
.. _text-roles-abbr:
48+
49+
`:abbr:`
50+
========
51+
52+
Marks a piece of text as an abbreviation or acronym. Write the
53+
abbreviation followed by its expansion in parentheses; the expansion is
54+
shown as a tooltip on hover and is not printed inline.
55+
56+
.. code-block:: rst
57+
58+
:abbr:`LIFO (last-in, first-out)`
59+
60+
How it looks:
61+
:abbr:`LIFO (last-in, first-out)`
62+
63+
.. index:: reST roles; path
64+
.. _text-roles-path:
65+
66+
`:path:`
67+
========
68+
69+
Refers to a directory or folder path, as opposed to a specific file. Use
70+
:ref:`:file: <text-roles-file>` instead when the path ends in a file name.
71+
72+
.. code-block:: rst
2373
24-
.. tabs::
74+
The extension stores its data in :path:`public/fileadmin`.
2575
26-
.. group-tab:: Output
76+
How it looks:
77+
The extension stores its data in :path:`public/fileadmin`.
2778

28-
.. include:: _snippets/_text-roles.rst.txt
79+
.. index:: reST roles; file
80+
.. _text-roles-file:
2981

30-
.. group-tab:: reST
82+
`:file:`
83+
========
3184

32-
.. literalinclude:: _snippets/_text-roles.rst.txt
85+
Refers to a specific file, including its name and, if helpful, its path.
86+
Use :ref:`:path: <text-roles-path>` instead when referring to a directory
87+
rather than a single file.
88+
89+
.. code-block:: rst
90+
91+
Edit :file:`config/system/settings.php` to change the setting.
92+
93+
How it looks:
94+
Edit :file:`config/system/settings.php` to change the setting.
95+
96+
.. index:: reST roles; issue
97+
.. _text-roles-issue:
98+
99+
`:issue:`
100+
=========
101+
102+
Links to an issue on `TYPO3 Forge <https://forge.typo3.org>`_ by its
103+
number. By default the link text is `forge#<number>`; pass a custom link
104+
text before the number in angle brackets to show different text instead.
105+
106+
.. code-block:: rst
107+
108+
See also :issue:`102056` or :issue:`this issue <99508>`.
109+
110+
How it looks:
111+
See also :issue:`102056` or :issue:`this issue <99508>`.
112+
113+
.. _text-roles-elsewhere:
114+
115+
More text roles, documented on their own pages
116+
==============================================
117+
118+
A few text roles are common enough, or involved enough, to have a full
119+
page to themselves rather than a short entry here:
120+
121+
* :rst:`:guilabel:` for GUI labels — backend modules, tabs, buttons,
122+
fields — and click paths through them, and :rst:`:kbd:` for keyboard
123+
shortcuts — see
124+
`Referring to GUI elements and keystrokes <https://docs.typo3.org/permalink/h2document:rest-refer-to-gui-elements>`_.
125+
* :rst:`:composer:` and :rst:`:t3ext:` for linking Composer packages and
126+
TER extensions — see
127+
`Linking Composer packages and TYPO3 extensions <https://docs.typo3.org/permalink/h2document:linking-extensions>`_.
128+
* :rst:`:t3src:` for linking source files of the TYPO3 Core — see
129+
`Linking source files of the TYPO3 Core <https://docs.typo3.org/permalink/h2document:linking-core-source>`_.
130+
* :rst:`:php:`, :rst:`:php-short:`, :rst:`:typoscript:` and other code
131+
roles with an infobox — see
132+
`Inline code with or without infoboxes <https://docs.typo3.org/permalink/h2document:inline-code>`_.
133+
134+
.. seealso::
135+
136+
* `Basic inline markup (bold, italic etc.) <https://docs.typo3.org/permalink/h2document:rest-bold-italic>`_
137+
* `Links in ReStructured Text <https://docs.typo3.org/permalink/h2document:how-to-document-hyperlinks>`_
138+
* `Docutils: Interpreted Text Roles <http://docutils.sourceforge.io/docs/ref/rst/roles.html>`_

Documentation/Reference/ReStructuredText/InlineMarkup/TextRoles/_snippets/_text-roles.rst.txt

Lines changed: 0 additions & 9 deletions
This file was deleted.

0 commit comments

Comments
 (0)