~ubuntu-branches/ubuntu/hardy/python-docutils/hardy

« back to all changes in this revision

Viewing changes to tools/test.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
 
.. This is a comment. Note how any initial comments are moved by
2
 
   transforms to after the document title, subtitle, and docinfo.
3
 
 
4
 
================================
5
 
 reStructuredText Test Document
6
 
================================
7
 
 
8
 
.. Above is the document title, and below is the subtitle.
9
 
   They are transformed from section titles after parsing.
10
 
 
11
 
--------------------------------
12
 
 Examples of Syntax Constructs
13
 
--------------------------------
14
 
 
15
 
.. bibliographic fields (which also require a transform):
16
 
 
17
 
:Author: David Goodger
18
 
:Address: 123 Example Street
19
 
          Example, EX  Canada
20
 
          A1B 2C3
21
 
:Contact: goodger@users.sourceforge.net
22
 
:Authors: Me; Myself; I
23
 
:organization: humankind
24
 
:date: $Date: 2004/01/04 17:44:46 $
25
 
:status: This is a "work in progress"
26
 
:revision: $Revision: 1.29 $
27
 
:version: 1
28
 
:copyright: This document has been placed in the public domain. You
29
 
            may do with it as you wish. You may copy, modify,
30
 
            redistribute, reattribute, sell, buy, rent, lease,
31
 
            destroy, or improve it, quote it at length, excerpt,
32
 
            incorporate, collate, fold, staple, or mutilate it, or do
33
 
            anything else to it that your or anyone else's heart
34
 
            desires.
35
 
:field name: This is a generic bibliographic field.
36
 
:field name 2:
37
 
    Generic bibliographic fields may contain multiple body elements.
38
 
 
39
 
    Like this.
40
 
 
41
 
:Dedication:
42
 
 
43
 
    For Docutils users & co-developers.
44
 
 
45
 
:abstract:
46
 
 
47
 
    This is a test document, containing at least one example of each
48
 
    reStructuredText construct.
49
 
 
50
 
.. meta::
51
 
   :keywords: reStructuredText, test, parser
52
 
   :description lang=en: A test document, containing at least one
53
 
       example of each reStructuredText construct.
54
 
 
55
 
.. contents:: Table of Contents
56
 
.. section-numbering::
57
 
 
58
 
 
59
 
Structural Elements
60
 
===================
61
 
 
62
 
Section Title
63
 
-------------
64
 
 
65
 
That's it, the text just above this line.
66
 
 
67
 
Transitions
68
 
-----------
69
 
 
70
 
Here's a transition:
71
 
 
72
 
---------
73
 
 
74
 
It divides the section.
75
 
 
76
 
Body Elements
77
 
=============
78
 
 
79
 
Paragraphs
80
 
----------
81
 
 
82
 
A paragraph.
83
 
 
84
 
Inline Markup
85
 
`````````````
86
 
 
87
 
Paragraphs contain text and may contain inline markup: *emphasis*,
88
 
**strong emphasis**, ``inline literals``, standalone hyperlinks
89
 
(http://www.python.org), external hyperlinks (Python_), internal
90
 
cross-references (example_), external hyperlinks with embedded URIs
91
 
(`Python web site <http://www.python.org>`__), footnote references
92
 
(manually numbered [1]_, anonymous auto-numbered [#]_, labeled
93
 
auto-numbered [#label]_, or symbolic [*]_), citation references
94
 
([CIT2002]_), substitution references (|example|), and _`inline
95
 
hyperlink targets` (see Targets_ below for a reference back to here).
96
 
Character-level inline markup is also possible (although exceedingly
97
 
ugly!) in *re*\ ``Structured``\ *Text*.  Problems are indicated by
98
 
|problematic| text (generated by processing errors; this one is
99
 
intentional).
100
 
 
101
 
The default role for interpreted text is `Title Reference`.  Here are
102
 
some explicit interpreted text roles: a PEP reference (:PEP:`287`); an
103
 
RFC reference (:RFC:`2822`); a :sub:`subscript`; a :sup:`superscript`;
104
 
and explicit roles for :emphasis:`standard` :strong:`inline`
105
 
:literal:`markup`.
106
 
 
107
 
.. DO NOT RE-WRAP THE FOLLOWING PARAGRAPH!
108
 
 
109
 
Let's test wrapping and whitespace significance in inline literals:
110
 
``This is an example of --inline-literal --text, --including some--
111
 
strangely--hyphenated-words.  Adjust-the-width-of-your-browser-window
112
 
to see how the text is wrapped.  -- ---- --------  Now note    the
113
 
spacing    between the    words of    this sentence    (words
114
 
should    be grouped    in pairs).``
115
 
 
116
 
If the ``--pep-references`` option was supplied, there should be a
117
 
live link to PEP 258 here.
118
 
 
119
 
Bullet Lists
120
 
------------
121
 
 
122
 
- A bullet list
123
 
 
124
 
  + Nested bullet list.
125
 
  + Nested item 2.
126
 
 
127
 
- Item 2.
128
 
 
129
 
  Paragraph 2 of item 2.
130
 
 
131
 
  * Nested bullet list.
132
 
  * Nested item 2.
133
 
 
134
 
    - Third level.
135
 
    - Item 2.
136
 
 
137
 
  * Nested item 3.
138
 
 
139
 
Enumerated Lists
140
 
----------------
141
 
 
142
 
1. Arabic numerals.
143
 
 
144
 
   a) lower alpha)
145
 
 
146
 
      (i) (lower roman)
147
 
 
148
 
          A. upper alpha.
149
 
 
150
 
             I) upper roman)
151
 
 
152
 
2. Lists that don't start at 1:
153
 
 
154
 
   3. Three
155
 
 
156
 
   4. Four
157
 
 
158
 
   C. C
159
 
 
160
 
   D. D
161
 
 
162
 
   iii. iii
163
 
 
164
 
   iv. iv
165
 
 
166
 
Definition Lists
167
 
----------------
168
 
 
169
 
Term
170
 
    Definition
171
 
Term : classifier
172
 
    Definition paragraph 1.
173
 
 
174
 
    Definition paragraph 2.
175
 
Term
176
 
    Definition
177
 
 
178
 
Field Lists
179
 
-----------
180
 
 
181
 
:what: Field lists map field names to field bodies, like database
182
 
       records.  They are often part of an extension syntax.  They are
183
 
       an unambiguous variant of RFC 2822 fields.
184
 
 
185
 
:how arg1 arg2:
186
 
 
187
 
    The field marker is a colon, the field name, and a colon.
188
 
 
189
 
    The field body may contain one or more body elements, indented
190
 
    relative to the field marker.
191
 
 
192
 
Option Lists
193
 
------------
194
 
 
195
 
For listing command-line options:
196
 
 
197
 
-a            command-line option "a"
198
 
-b file       options can have arguments
199
 
              and long descriptions
200
 
--long        options can be long also
201
 
--input=file  long options can also have
202
 
              arguments
203
 
 
204
 
--very-long-option
205
 
              The description can also start on the next line.
206
 
 
207
 
              The description may contain multiple body elements,
208
 
              regardless of where it starts.
209
 
 
210
 
-x, -y, -z    Multiple options are an "option group".
211
 
-v, --verbose  Commonly-seen: short & long options.
212
 
-1 file, --one=file, --two file
213
 
              Multiple options with arguments.
214
 
/V            DOS/VMS-style options too
215
 
 
216
 
There must be at least two spaces between the option and the
217
 
description.
218
 
 
219
 
Literal Blocks
220
 
--------------
221
 
 
222
 
Literal blocks are indicated with a double-colon ("::") at the end of
223
 
the preceding paragraph (over there ``-->``).  They can be indented::
224
 
 
225
 
    if literal_block:
226
 
        text = 'is left as-is'
227
 
        spaces_and_linebreaks = 'are preserved'
228
 
        markup_processing = None
229
 
 
230
 
Or they can be quoted without indentation::
231
 
 
232
 
>> Great idea!
233
 
>
234
 
> Why didn't I think of that?
235
 
 
236
 
Block Quotes
237
 
------------
238
 
 
239
 
Block quotes consist of indented body elements:
240
 
 
241
 
    My theory by A. Elk.  Brackets Miss, brackets.  This theory goes
242
 
    as follows and begins now.  All brontosauruses are thin at one
243
 
    end, much much thicker in the middle and then thin again at the
244
 
    far end.  That is my theory, it is mine, and belongs to me and I
245
 
    own it, and what it is too.
246
 
 
247
 
    -- Anne Elk (Miss)
248
 
 
249
 
Doctest Blocks
250
 
--------------
251
 
 
252
 
>>> print 'Python-specific usage examples; begun with ">>>"'
253
 
Python-specific usage examples; begun with ">>>"
254
 
>>> print '(cut and pasted from interactive Python sessions)'
255
 
(cut and pasted from interactive Python sessions)
256
 
 
257
 
Tables
258
 
------
259
 
 
260
 
Here's a grid table followed by a simple table:
261
 
 
262
 
+------------------------+------------+----------+----------+
263
 
| Header row, column 1   | Header 2   | Header 3 | Header 4 |
264
 
| (header rows optional) |            |          |          |
265
 
+========================+============+==========+==========+
266
 
| body row 1, column 1   | column 2   | column 3 | column 4 |
267
 
+------------------------+------------+----------+----------+
268
 
| body row 2             | Cells may span columns.          |
269
 
+------------------------+------------+---------------------+
270
 
| body row 3             | Cells may  | - Table cells       |
271
 
+------------------------+ span rows. | - contain           |
272
 
| body row 4             |            | - body elements.    |
273
 
+------------------------+------------+----------+----------+
274
 
| body row 5             | Cells may also be     |          |
275
 
|                        | empty: ``-->``        |          |
276
 
+------------------------+-----------------------+----------+
277
 
 
278
 
=====  =====  ======
279
 
   Inputs     Output
280
 
------------  ------
281
 
  A      B    A or B
282
 
=====  =====  ======
283
 
False  False  False
284
 
True   False  True
285
 
False  True   True
286
 
True   True   True
287
 
=====  =====  ======
288
 
 
289
 
Footnotes
290
 
---------
291
 
 
292
 
.. [1] A footnote contains body elements, consistently indented by at
293
 
   least 3 spaces.
294
 
 
295
 
   This is the footnote's second paragraph.
296
 
 
297
 
.. [#label] Footnotes may be numbered, either manually (as in [1]_) or
298
 
   automatically using a "#"-prefixed label.  This footnote has a
299
 
   label so it can be referred to from multiple places, both as a
300
 
   footnore reference ([#label]_) and as a hyperlink reference
301
 
   (label_).
302
 
 
303
 
.. [#] This footnote is numbered automatically and anonymously using a
304
 
   label of "#" only.
305
 
 
306
 
.. [*] Footnotes may also use symbols, specified with a "*" label.
307
 
   Here's a reference to the next footnote: [*]_.
308
 
 
309
 
.. [*] This footnote shows the next symbol in the sequence.
310
 
 
311
 
.. [4] Here's an unreferenced footnote, with a reference to a
312
 
   nonexistent footnote: [5]_.
313
 
 
314
 
Citations
315
 
---------
316
 
 
317
 
.. [CIT2002] Citations are text-labeled footnotes. They may be
318
 
   rendered separately and differently from footnotes.
319
 
 
320
 
Here's a reference to the above, [CIT2002]_, and a [nonexistent]_
321
 
citation.
322
 
 
323
 
Targets
324
 
-------
325
 
 
326
 
.. _example:
327
 
 
328
 
This paragraph is pointed to by the explicit "example" target. A
329
 
reference can be found under `Inline Markup`_, above. `Inline
330
 
hyperlink targets`_ are also possible.
331
 
 
332
 
Section headers are implicit targets, referred to by name. See
333
 
Targets_, which is a subsection of `Body Elements`_.
334
 
 
335
 
Explicit external targets are interpolated into references such as
336
 
"Python_".
337
 
 
338
 
.. _Python: http://www.python.org/
339
 
 
340
 
Targets may be indirect and anonymous.  Thus `this phrase`__ may also
341
 
refer to the Targets_ section.
342
 
 
343
 
__ Targets_
344
 
 
345
 
Here's a `hyperlink reference without a target`_, which generates an
346
 
error.
347
 
 
348
 
Duplicate Target Names
349
 
``````````````````````
350
 
 
351
 
Duplicate names in section headers or other implicit targets will
352
 
generate "info" (level-1) system messages.  Duplicate names in
353
 
explicit targets will generate "warning" (level-2) system messages.
354
 
 
355
 
Duplicate Target Names
356
 
``````````````````````
357
 
 
358
 
Since there are two "Duplicate Target Names" section headers, we
359
 
cannot uniquely refer to either of them by name.  If we try to (like
360
 
this: `Duplicate Target Names`_), an error is generated.
361
 
 
362
 
Directives
363
 
----------
364
 
 
365
 
.. contents:: :local:
366
 
 
367
 
These are just a sample of the many reStructuredText Directives.  For
368
 
others, please see http://docutils.sf.net/spec/rst/directives.html.
369
 
 
370
 
Document Parts
371
 
``````````````
372
 
 
373
 
An example of the "contents" directive can be seen above this section
374
 
(a local, untitled table of contents_) and at the beginning of the
375
 
document (a document-wide `table of contents`_).
376
 
 
377
 
Images
378
 
``````
379
 
 
380
 
An image directive (also clickable -- a hyperlink reference):
381
 
 
382
 
.. image:: ../docs/rst/images/title.png
383
 
   :target: directives_
384
 
 
385
 
A figure directive:
386
 
 
387
 
.. figure:: ../docs/rst/images/title.png
388
 
   :alt: reStructuredText, the markup syntax
389
 
 
390
 
   A figure is an image with a caption and/or a legend:
391
 
 
392
 
   +------------+-----------------------------------------------+
393
 
   | re         | Revised, revisited, based on 're' module.     |
394
 
   +------------+-----------------------------------------------+
395
 
   | Structured | Structure-enhanced text, structuredtext.      |
396
 
   +------------+-----------------------------------------------+
397
 
   | Text       | Well it is, isn't it?                         |
398
 
   +------------+-----------------------------------------------+
399
 
 
400
 
   This paragraph is also part of the legend.
401
 
 
402
 
Admonitions
403
 
```````````
404
 
 
405
 
.. Attention:: Directives at large.
406
 
 
407
 
.. Caution::
408
 
 
409
 
   Don't take any wooden nickels.
410
 
 
411
 
.. DANGER:: Mad scientist at work!
412
 
 
413
 
.. Error:: Does not compute.
414
 
 
415
 
.. Hint:: It's bigger than a bread box.
416
 
 
417
 
.. Important::
418
 
   - Wash behind your ears.
419
 
   - Clean up your room.
420
 
   - Call your mother.
421
 
   - Back up your data.
422
 
 
423
 
.. Note:: This is a note.
424
 
 
425
 
.. Tip:: 15% if the service is good.
426
 
 
427
 
.. WARNING:: Strong prose may provoke extreme mental exertion.
428
 
   Reader discretion is strongly advised.
429
 
 
430
 
.. admonition:: And, by the way...
431
 
 
432
 
   You can make up your own admonition too.
433
 
 
434
 
Topics, Sidebars, and Rubrics
435
 
`````````````````````````````
436
 
 
437
 
.. sidebar:: Sidebar Title
438
 
   :subtitle: Optional Subtitle
439
 
 
440
 
   This is a sidebar.  It is for text outside the flow of the main
441
 
   text.  
442
 
 
443
 
   .. rubric:: This is a rubric inside a sidebar
444
 
 
445
 
   Sidebars often appears beside the main text with a border and
446
 
   background color.
447
 
 
448
 
.. topic:: Topic Title
449
 
 
450
 
   This is a topic.
451
 
 
452
 
.. rubric:: This is a rubric
453
 
 
454
 
Target Footnotes
455
 
````````````````
456
 
 
457
 
.. target-notes::
458
 
 
459
 
Line Blocks
460
 
```````````
461
 
 
462
 
Take it away, Eric the Orchestra Leader!
463
 
 
464
 
.. line-block::
465
 
 
466
 
   A one, two, a one two three four
467
 
 
468
 
   Half a bee, philosophically,
469
 
       must, *ipso facto*, half not be.
470
 
   But half the bee has got to be,
471
 
       *vis a vis* its entity.  D'you see?
472
 
 
473
 
   But can a bee be said to be
474
 
       or not to be an entire bee,
475
 
           when half the bee is not a bee,
476
 
               due to some ancient injury?
477
 
 
478
 
   Singing...
479
 
 
480
 
Replacement Text
481
 
````````````````
482
 
 
483
 
I recommend you try |Python|_.
484
 
 
485
 
.. |Python| replace:: Python, *the* best language around
486
 
 
487
 
Substitution Definitions
488
 
------------------------
489
 
 
490
 
An inline image (|example|) example:
491
 
 
492
 
.. |EXAMPLE| image:: ../docs/rst/images/biohazard.png
493
 
 
494
 
(Substitution definitions are not visible in the HTML source.)
495
 
 
496
 
Comments
497
 
--------
498
 
 
499
 
Here's one:
500
 
 
501
 
.. Comments begin with two dots and a space. Anything may
502
 
   follow, except for the syntax of footnotes, hyperlink
503
 
   targets, directives, or substitution definitions.
504
 
 
505
 
   Double-dashes -- "--" -- must be escaped somehow in HTML output.
506
 
 
507
 
(View the HTML source to see the comment.)
508
 
 
509
 
Error Handling
510
 
==============
511
 
 
512
 
Any errors caught during processing will generate system messages.
513
 
 
514
 
There should be five messages in the following, auto-generated
515
 
section, "Docutils System Messages":
516
 
 
517
 
.. section should be added by Docutils automatically