| Author: | David Goodger |
|---|---|
| Author: | Mark Nodine (for doctrip-specific implementation) |
| Contact: | goodger@users.sourceforge.net (mark.nodine@mot.com) |
| Revision: | 1.11 |
| Date: | 2005-04-19 |
| Copyright: | This document has been placed in the public domain. |
This document describes the interpreted text roles implemented in the reference reStructuredText parser.
Interpreted text uses backquotes (`) around the text. An explicit role marker may optionally appear before or after the text, delimited with colons. For example:
This is `interpreted text` using the default role. This is :title:`interpreted text` using an explicit role.
A default role may be defined by applications of reStructuredText; it is used if no explicit :role: prefix or suffix is given. The "default default role" is :title-reference:.
See the Interpreted Text section in the reStructuredText Markup Specification for syntax details.
No customization is currently allowed.
| Aliases: | None |
|---|---|
| DTD Element: | emphasis |
Implements emphasis. These are equivalent:
*text* :emphasis:`text`
| Aliases: | None |
|---|---|
| DTD Element: | literal |
Implements inline literal text. These are equivalent:
``text`` :literal:`text`
Care must be taken with backslash-escapes though. These are not equivalent:
``text \ and \ backslashes`` :literal:`text \ and \ backslashes`
The backslashes in the first line are preserved (and do nothing), whereas the backslashes in the second line escape the following spaces.
| Aliases: | None |
|---|---|
| DTD Element: | interpreted |
| Writers: | html |
Implements colored text in html. The <val> expresses the color that will be applied. For example
This text is :color-red:`red`.
results in
This text is red.
| Aliases: | None |
|---|---|
| DTD Element: | interpreted |
| Writers: | html |
Implements text of different sizes in html. The <val> expresses the size that will be applied. For example
This text is :size-18pt:`18 pt`.
results in
This text is 18 pt.
| Aliases: | None |
|---|---|
| DTD Element: | interpreted |
| Writers: | html |
Implements text of different faces in html. The <val> expresses the face that will be applied. For example
This text is :face-helvetica:`helvetica`.
results in
This text is helvetica.
| Aliases: | None |
|---|---|
| DTD Element: | interpreted |
| Writers: | html |
Implements text of different classes in html. The <val> expresses the class that will be applied. For example
This text is :class-classy:`classy`.
results in html like:
This text is <class name="classy">classy</class>.
You can affect how different classes are rendered using style sheets.
| Aliases: | None |
|---|---|
| DTD Element: | strong |
Implements strong emphasis. These are equivalent:
**text** :strong:`text`
| Aliases: | :sub: |
|---|---|
| DTD Element: | subscript |
Implements subscripts.
Tip
Whitespace or punctuation is required around interpreted text, but often not desired with subscripts & superscripts. Backslash-escaped whitespace can be used; the whitespace will be removed from the processed document:
H\ :sub:`2`\ O E = mc\ :sup:`2`
In such cases, readability of the plain text can be greatly improved with substitutions:
The chemical formula for pure water is |H2O|. .. |H2O| replace:: H\ :sub:`2`\ O
See the reStructuredText spec for further information on character-level markup and the substitution mechanism.
| Aliases: | :sup: |
|---|---|
| DTD Element: | superscript |
Implements superscripts. See the tip in :subscript: above.
| Aliases: | :title:, :t:. |
|---|---|
| DTD Element: | interpreted |
The :title-reference: role is used to describe the titles of books, periodicals, and other materials. It is the equivalent of the HTML "cite" element, and it is expected that HTML writers will typically render "title_reference" elements using "cite".
Since title references are typically rendered with italics, they are often marked up using *emphasis*, which is misleading and vague. The "title_reference" element provides accurate and unambiguous descriptive markup.
Let's assume :title-reference: is the default interpreted text role (see below) for this example:
`Design Patterns` [GoF95]_ is an excellent read.
The following document fragment (pseudo-XML) will result from processing:
<paragraph>
<interpreted role="title-reference">
Design Patterns
<citation_reference refname="gof95">
GoF95
is an excellent read.
:title-reference: is the default interpreted text role in the standard reStructuredText parser. This means that no explicit role is required. Applications of reStructuredText may designate a different default role, in which case the explicit role must be used.