File: interpreted.txt

package info (click to toggle)
python-docutils 0.3.7-2sarge1
  • links: PTS
  • area: main
  • in suites: sarge
  • size: 3,872 kB
  • ctags: 2,908
  • sloc: python: 27,538; lisp: 641; makefile: 102
file content (252 lines) | stat: -rw-r--r-- 6,584 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
=========================================
 reStructuredText Interpreted Text Roles
=========================================
:Author: David Goodger
:Contact: goodger@users.sourceforge.net
:Revision: $Revision: 1.12 $
:Date: $Date: 2004/04/27 19:51:12 $
: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.  For details on the hierarchy of
elements, please see `The Docutils Document Tree`_ and the `Docutils
Generic DTD`_ XML document type definition.  For interpreted text role
implementation details, see `Creating reStructuredText Interpreted
Text Roles`_.

.. _"role" directive: directives.html#role
.. _Interpreted Text: reStructuredText.html#interpreted-text
.. _reStructuredText Markup Specification: reStructuredText.html
.. _The Docutils Document Tree: ../doctree.html
.. _Docutils Generic DTD: ../docutils.dtd
.. _Creating reStructuredText Interpreted Text Roles: ../howto/rst-roles.html


.. contents::


---------------
 Customization
---------------

Custom interpreted text roles may be defined in a document with the
`"role" directive`_.  Customization details are listed with each role.

.. _class:

The ``class`` option is recognized by the "role" directive for most
interpreted text roles.  A description__ is provided by `"role"
directive`_ documentation.

__ directives.html#role-class


---------------------------------
 Standard Interpreted Text Roles
---------------------------------

``:emphasis:``
==============

:Aliases: None
:DTD Element: emphasis
:Customization:
    :Options: class_.
    :Content: None.

Implements emphasis.  These are equivalent::

    *text*
    :emphasis:`text`


``:literal:``
==============

:Aliases: None
:DTD Element: literal
:Customization:
    :Options: class_.
    :Content: None.

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.


``:pep-reference:``
===================

:Aliases: ``:PEP:``
:DTD Element: reference
:Customization:
    :Options: class_.
    :Content: None.

The ``:pep-reference:`` role is used to create an HTTP reference to a
PEP (Python Enhancement Proposal).  The ``:PEP:`` alias is usually
used.  For example::

    See :PEP:`287` for more information about reStructuredText.

This is equivalent to::

    See `PEP 287`__ for more information about reStructuredText.

    __ http://www.python.org/peps/pep-0287.html


``:rfc-reference:``
===================

:Aliases: ``:RFC:``
:DTD Element: reference
:Customization:
    :Options: class_.
    :Content: None.

The ``:rfc-reference:`` role is used to create an HTTP reference to an
RFC (Internet Request for Comments).  The ``:RFC:`` alias is usually
used.  For example::

    See :RFC:`2822` for information about email headers.

This is equivalent to::

    See `RFC 2822`__ for information about email headers.

    __ http://www.faqs.org/rfcs/rfc2822.html


``:strong:``
============

:Aliases: None
:DTD Element: strong
:Customization:
    :Options: class_.
    :Content: None.

Implements strong emphasis.  These are equivalent::

    **text**
    :strong:`text`


``:subscript:``
===============

:Aliases: ``:sub:``
:DTD Element: subscript
:Customization:
    :Options: class_.
    :Content: None.

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`__.

   __ ./reStructuredText.html
   __ ./reStructuredText.html#character-level-inline-markup
   __ ./reStructuredText.html#substitution-references


``:superscript:``
=================

:Aliases: ``:sup:``
:DTD Element: superscript
:Customization:
    :Options: class_.
    :Content: None.

Implements superscripts.  See the tip in `:subscript:`_ above.


``:title-reference:``
=====================

:Aliases: ``:title:``, ``:t:``.
:DTD Element: title_reference
:Customization:
    :Options: class_.
    :Content: None.

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>
        <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 ``:title-reference:`` role
must be used to obtain a ``title_reference`` element.


.. _pseudo-XML: ../doctree.html#pseudo-xml