| 1 |
Custom Roles |
| 2 |
------------ |
| 3 |
|
| 4 |
* A role based on an existing role. |
| 5 |
|
| 6 |
.. role:: custom(literal) |
| 7 |
|
| 8 |
:custom:`one` :custom:`two` :custom:`three` |
| 9 |
|
| 10 |
* A new role. |
| 11 |
|
| 12 |
.. role:: customnew |
| 13 |
|
| 14 |
:customnew:`one two three` |
| 15 |
|
| 16 |
* A role with class attribute. |
| 17 |
|
| 18 |
.. role:: customclass |
| 19 |
:class: special |
| 20 |
|
| 21 |
:customclass:`interpreted text` |
| 22 |
|
| 23 |
* A language-switching role: |
| 24 |
|
| 25 |
.. role:: language-de |
| 26 |
|
| 27 |
Let's count in German :language-de:`eins zwei drei`. |
| 28 |
|
| 29 |
* A role with multiple class attributes, styled with raw directives: |
| 30 |
|
| 31 |
.. role:: customx |
| 32 |
:class: green sc language-en-GB |
| 33 |
|
| 34 |
.. raw:: latex |
| 35 |
|
| 36 |
\newcommand{\DUrolegreen}[1]{\textcolor{green}{#1}} |
| 37 |
\newcommand{\DUrolesc}[1]{\textsc{#1}} |
| 38 |
|
| 39 |
The following works in most browsers but does not validate |
| 40 |
(``<style>`` is only allowed in the document head):: |
| 41 |
|
| 42 |
.. raw:: html |
| 43 |
|
| 44 |
<style type="text/css"><!-- |
| 45 |
.green {color: green;} |
| 46 |
.sc {font-variant: small-caps;} |
| 47 |
--></style> |
| 48 |
|
| 49 |
:customx:`British colourful text in small-caps`. |