~ubuntu-branches/ubuntu/karmic/python-docutils/karmic

« back to all changes in this revision

Viewing changes to spec/rst/interpreted.txt

  • Committer: Bazaar Package Importer
  • Author(s): martin f. krafft
  • Date: 2006-07-10 11:45:05 UTC
  • mfrom: (2.1.4 edgy)
  • Revision ID: james.westby@ubuntu.com-20060710114505-otkhqcslevewxmz5
Tags: 0.4-3
Added build dependency on python-central (closes: #377580).

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
=========================================
2
 
 reStructuredText Interpreted Text Roles
3
 
=========================================
4
 
:Author: David Goodger
5
 
:Contact: goodger@users.sourceforge.net
6
 
:Revision: $Revision: 1.12 $
7
 
:Date: $Date: 2004/04/27 19:51:12 $
8
 
:Copyright: This document has been placed in the public domain.
9
 
 
10
 
This document describes the interpreted text roles implemented in the
11
 
reference reStructuredText parser.
12
 
 
13
 
Interpreted text uses backquotes (`) around the text.  An explicit
14
 
role marker may optionally appear before or after the text, delimited
15
 
with colons.  For example::
16
 
 
17
 
    This is `interpreted text` using the default role.
18
 
 
19
 
    This is :title:`interpreted text` using an explicit role.
20
 
 
21
 
A default role may be defined by applications of reStructuredText; it
22
 
is used if no explicit ``:role:`` prefix or suffix is given.  The
23
 
"default default role" is `:title-reference:`_.
24
 
 
25
 
See the `Interpreted Text`_ section in the `reStructuredText Markup
26
 
Specification`_ for syntax details.  For details on the hierarchy of
27
 
elements, please see `The Docutils Document Tree`_ and the `Docutils
28
 
Generic DTD`_ XML document type definition.  For interpreted text role
29
 
implementation details, see `Creating reStructuredText Interpreted
30
 
Text Roles`_.
31
 
 
32
 
.. _"role" directive: directives.html#role
33
 
.. _Interpreted Text: reStructuredText.html#interpreted-text
34
 
.. _reStructuredText Markup Specification: reStructuredText.html
35
 
.. _The Docutils Document Tree: ../doctree.html
36
 
.. _Docutils Generic DTD: ../docutils.dtd
37
 
.. _Creating reStructuredText Interpreted Text Roles: ../howto/rst-roles.html
38
 
 
39
 
 
40
 
.. contents::
41
 
 
42
 
 
43
 
---------------
44
 
 Customization
45
 
---------------
46
 
 
47
 
Custom interpreted text roles may be defined in a document with the
48
 
`"role" directive`_.  Customization details are listed with each role.
49
 
 
50
 
.. _class:
51
 
 
52
 
The ``class`` option is recognized by the "role" directive for most
53
 
interpreted text roles.  A description__ is provided by `"role"
54
 
directive`_ documentation.
55
 
 
56
 
__ directives.html#role-class
57
 
 
58
 
 
59
 
---------------------------------
60
 
 Standard Interpreted Text Roles
61
 
---------------------------------
62
 
 
63
 
``:emphasis:``
64
 
==============
65
 
 
66
 
:Aliases: None
67
 
:DTD Element: emphasis
68
 
:Customization:
69
 
    :Options: class_.
70
 
    :Content: None.
71
 
 
72
 
Implements emphasis.  These are equivalent::
73
 
 
74
 
    *text*
75
 
    :emphasis:`text`
76
 
 
77
 
 
78
 
``:literal:``
79
 
==============
80
 
 
81
 
:Aliases: None
82
 
:DTD Element: literal
83
 
:Customization:
84
 
    :Options: class_.
85
 
    :Content: None.
86
 
 
87
 
Implements inline literal text.  These are equivalent::
88
 
 
89
 
    ``text``
90
 
    :literal:`text`
91
 
 
92
 
Care must be taken with backslash-escapes though.  These are *not*
93
 
equivalent::
94
 
 
95
 
    ``text \ and \ backslashes``
96
 
    :literal:`text \ and \ backslashes`
97
 
 
98
 
The backslashes in the first line are preserved (and do nothing),
99
 
whereas the backslashes in the second line escape the following
100
 
spaces.
101
 
 
102
 
 
103
 
``:pep-reference:``
104
 
===================
105
 
 
106
 
:Aliases: ``:PEP:``
107
 
:DTD Element: reference
108
 
:Customization:
109
 
    :Options: class_.
110
 
    :Content: None.
111
 
 
112
 
The ``:pep-reference:`` role is used to create an HTTP reference to a
113
 
PEP (Python Enhancement Proposal).  The ``:PEP:`` alias is usually
114
 
used.  For example::
115
 
 
116
 
    See :PEP:`287` for more information about reStructuredText.
117
 
 
118
 
This is equivalent to::
119
 
 
120
 
    See `PEP 287`__ for more information about reStructuredText.
121
 
 
122
 
    __ http://www.python.org/peps/pep-0287.html
123
 
 
124
 
 
125
 
``:rfc-reference:``
126
 
===================
127
 
 
128
 
:Aliases: ``:RFC:``
129
 
:DTD Element: reference
130
 
:Customization:
131
 
    :Options: class_.
132
 
    :Content: None.
133
 
 
134
 
The ``:rfc-reference:`` role is used to create an HTTP reference to an
135
 
RFC (Internet Request for Comments).  The ``:RFC:`` alias is usually
136
 
used.  For example::
137
 
 
138
 
    See :RFC:`2822` for information about email headers.
139
 
 
140
 
This is equivalent to::
141
 
 
142
 
    See `RFC 2822`__ for information about email headers.
143
 
 
144
 
    __ http://www.faqs.org/rfcs/rfc2822.html
145
 
 
146
 
 
147
 
``:strong:``
148
 
============
149
 
 
150
 
:Aliases: None
151
 
:DTD Element: strong
152
 
:Customization:
153
 
    :Options: class_.
154
 
    :Content: None.
155
 
 
156
 
Implements strong emphasis.  These are equivalent::
157
 
 
158
 
    **text**
159
 
    :strong:`text`
160
 
 
161
 
 
162
 
``:subscript:``
163
 
===============
164
 
 
165
 
:Aliases: ``:sub:``
166
 
:DTD Element: subscript
167
 
:Customization:
168
 
    :Options: class_.
169
 
    :Content: None.
170
 
 
171
 
Implements subscripts.
172
 
 
173
 
.. Tip::
174
 
 
175
 
   Whitespace or punctuation is required around interpreted text, but
176
 
   often not desired with subscripts & superscripts.
177
 
   Backslash-escaped whitespace can be used; the whitespace will be
178
 
   removed from the processed document::
179
 
 
180
 
       H\ :sub:`2`\ O
181
 
       E = mc\ :sup:`2`
182
 
 
183
 
   In such cases, readability of the plain text can be greatly
184
 
   improved with substitutions::
185
 
 
186
 
       The chemical formula for pure water is |H2O|.
187
 
 
188
 
       .. |H2O| replace:: H\ :sub:`2`\ O
189
 
 
190
 
   See `the reStructuredText spec`__ for further information on
191
 
   `character-level markup`__ and `the substitution mechanism`__.
192
 
 
193
 
   __ ./reStructuredText.html
194
 
   __ ./reStructuredText.html#character-level-inline-markup
195
 
   __ ./reStructuredText.html#substitution-references
196
 
 
197
 
 
198
 
``:superscript:``
199
 
=================
200
 
 
201
 
:Aliases: ``:sup:``
202
 
:DTD Element: superscript
203
 
:Customization:
204
 
    :Options: class_.
205
 
    :Content: None.
206
 
 
207
 
Implements superscripts.  See the tip in `:subscript:`_ above.
208
 
 
209
 
 
210
 
``:title-reference:``
211
 
=====================
212
 
 
213
 
:Aliases: ``:title:``, ``:t:``.
214
 
:DTD Element: title_reference
215
 
:Customization:
216
 
    :Options: class_.
217
 
    :Content: None.
218
 
 
219
 
The ``:title-reference:`` role is used to describe the titles of
220
 
books, periodicals, and other materials.  It is the equivalent of the
221
 
HTML "cite" element, and it is expected that HTML writers will
222
 
typically render "title_reference" elements using "cite".
223
 
 
224
 
Since title references are typically rendered with italics, they are
225
 
often marked up using ``*emphasis*``, which is misleading and vague. 
226
 
The "title_reference" element provides accurate and unambiguous
227
 
descriptive markup.
228
 
 
229
 
Let's assume ``:title-reference:`` is the default interpreted text
230
 
role (see below) for this example::
231
 
 
232
 
    `Design Patterns` [GoF95]_ is an excellent read.
233
 
 
234
 
The following document fragment (pseudo-XML_) will result from
235
 
processing::
236
 
 
237
 
    <paragraph>
238
 
        <title_reference>
239
 
            Design Patterns
240
 
 
241
 
        <citation_reference refname="gof95">
242
 
            GoF95
243
 
         is an excellent read.
244
 
 
245
 
``:title-reference:`` is the default interpreted text role in the
246
 
standard reStructuredText parser.  This means that no explicit role is
247
 
required.  Applications of reStructuredText may designate a different
248
 
default role, in which case the explicit ``:title-reference:`` role
249
 
must be used to obtain a ``title_reference`` element.
250
 
 
251
 
 
252
 
.. _pseudo-XML: ../doctree.html#pseudo-xml