3 ==============================
4 reStructuredText Test Document
5 ==============================
7 -----------------------------
8 Examples of Syntax Constructs
9 -----------------------------
11 :author: David Goodger
12 :address: 123 Example Street
15 :contact: goodger@users.sourceforge.net
16 :authors: Me; Myself; I
17 :organization: humankind
18 :date: Now, or yesterday. Or maybe even *before* yesterday.
19 :status: This is a "work in progress"
20 :revision: is managed by a version control system.
22 :copyright: This document has been placed in the public domain. You
23 may do with it as you wish. You may copy, modify,
24 redistribute, reattribute, sell, buy, rent, lease,
25 destroy, or improve it, quote it at length, excerpt,
26 incorporate, collate, fold, staple, or mutilate it, or do
27 anything else to it that your or anyone else's heart
29 :field name: This is a "generic bibliographic field".
31 :field name "2": Generic bibliographic fields may contain multiple body elements.
39 For Docutils users & co-developers.
43 This is a test document, containing at least one example of each
44 reStructuredText construct.
46 .. This is a comment. Note how any initial comments are moved by
47 transforms to after the document title, subtitle, and docinfo.
51 .. Above is the document title, and below is the subtitle.
52 They are transformed from section titles after parsing.
56 .. bibliographic fields (which also require a transform):
58 .. contents:: Table of Contents
67 That's it, the text just above this line.
79 It divides the section. Transitions may also occur between sections:
95 Paragraphs contain text and may contain inline markup: *emphasis*,
96 **strong emphasis**, ``inline literals``, standalone hyperlinks
97 (http://www.python.org), external hyperlinks (Python_ ), internal
98 cross-references (example_), external hyperlinks with embedded URIs
99 (`Python web site <http://www.python.org>`__), footnote references
100 (manually numbered [1]_, anonymous auto-numbered [#]_, labeled
101 auto-numbered [#label]_, or symbolic [*]_), citation references
102 ([CIT2002]_), substitution references (|EXAMPLE|), and _`inline
103 hyperlink targets` (see Targets_ below for a reference back to here).
104 Character-level inline markup is also possible (although exceedingly
105 ugly!) in *re*\ ``Structured``\ *Text*. Problems are indicated by
106 |problematic| text (generated by processing errors; this one is
107 intentional). Here is a reference to the doctitle_ and the subtitle_.
109 The default role for interpreted text is `Title Reference`. Here are
110 some explicit interpreted text roles: a PEP reference (:PEP:`287`); an
111 RFC reference (:RFC:`2822`); a :sub:`subscript`; a :sup:`superscript`;
112 and explicit roles for *standard* **inline**
115 .. DO NOT RE-WRAP THE FOLLOWING PARAGRAPH!
117 Let's test wrapping and whitespace significance in inline literals:
118 ``This is an example of --inline-literal --text, --including some--
119 strangely--hyphenated-words. Adjust-the-width-of-your-browser-window
120 to see how the text is wrapped. -- ---- -------- Now note the
121 spacing between the words of this sentence (words
122 should be grouped in pairs).``
124 If the ``--pep-references`` option was supplied, there should be a
125 live link to PEP 258 here.
132 + Nested bullet list.
138 Paragraph 2 of item 2.
140 * Nested bullet list.
150 * This nested list should be compacted by the HTML writer.
154 .. Even if this item contains a target and a comment.
169 2. Lists that don't start at 1:
190 Definition paragraph 1.
192 Definition paragraph 2.
197 Term : classifier one : classifier two
203 :what: Field lists map field names to field bodies, like database
204 records. They are often part of an extension syntax. They are
205 an unambiguous variant of RFC 2822 fields.
207 :how arg1 arg2: The field marker is a colon, the field name, and a colon.
209 The field body may contain one or more body elements, indented
210 relative to the field marker.
215 This paragraph has the `credits` class set. (This is actually not
216 about credits but just for ensuring that the class attribute
217 doesn't get stripped away.)
222 For listing command-line options:
225 command-line option "a"
228 options can have arguments
229 and long descriptions
232 options can be long also
235 long options can also have
239 The description can also start on the next line.
241 The description may contain multiple body elements,
242 regardless of where it starts.
245 Multiple options are an "option group".
248 Commonly-seen: short & long options.
250 -1 file, --one=file, --two file
251 Multiple options with arguments.
254 DOS/VMS-style options too
257 There must be at least two spaces between the option and the
263 Literal blocks are indicated with a double-colon ("::") at the end of
264 the preceding paragraph (over there ``-->``). They can be indented:
269 text = 'is left as-is'
270 spaces_and_linebreaks = 'are preserved'
271 markup_processing = None
273 Or they can be quoted without indentation:
279 > Why didn't I think of that?
284 This section tests line blocks. Line blocks are body elements which
285 consist of lines and other line blocks. Nested line blocks cause
288 | This is a line block. It ends with a blank line.
289 | New lines begin with a vertical bar ("|").
290 | Line breaks and initial indent are significant, and preserved.
291 | Continuation lines are also possible. A long line that is intended
292 to wrap should begin with a space in place of the vertical bar.
293 | The left edge of a continuation line need not be aligned with
294 the left edge of the text above it.
296 | This is a second line block.
298 | Blank lines are permitted internally, but they must begin with a "|".
300 Another line block, surrounded by paragraphs:
302 | And it's no good waiting by the window
303 | It's no good waiting for the sun
304 | Please believe me, the things you dream of
305 | They don't fall in the lap of no-one
307 Take it away, Eric the Orchestra Leader!
309 | A one, two, a one two three four
311 | Half a bee, philosophically,
312 | must, *ipso facto*, half not be.
313 | But half the bee has got to be,
314 | *vis a vis* its entity. D'you see?
316 | But can a bee be said to be
317 | or not to be an entire bee,
318 | when half the bee is not a bee,
319 | due to some ancient injury?
326 Block quotes consist of indented body elements:
328 My theory by A. Elk. Brackets Miss, brackets. This theory goes
329 as follows and begins now. All brontosauruses are thin at one
330 end, much much thicker in the middle and then thin again at the
331 far end. That is my theory, it is mine, and belongs to me and I
332 own it, and what it is too.
340 >>> print 'Python-specific usage examples; begun with ">>>"'
341 Python-specific usage examples; begun with ">>>"
342 >>> print '(cut and pasted from interactive Python sessions)'
343 (cut and pasted from interactive Python sessions)
348 .. [1] A footnote contains body elements, consistently indented by at
351 This is the footnote's second paragraph.
353 .. [#label] Footnotes may be numbered, either manually (as in [1]_) or
354 automatically using a "#"-prefixed label. This footnote has a
355 label so it can be referred to from multiple places, both as a
356 footnote reference ([#label]_) and as a hyperlink reference
359 .. [#] This footnote is numbered automatically and anonymously using a
362 This is the second paragraph.
364 And this is the third paragraph.
366 .. [*] Footnotes may also use symbols, specified with a "*" label.
367 Here's a reference to the next footnote: [*]_.
369 .. [*] This footnote shows the next symbol in the sequence.
371 .. [4] Here's an unreferenced footnote, with a reference to a
372 nonexistent footnote: [5]_.
377 .. [CIT2002] Citations are text-labeled footnotes. They may be
378 rendered separately and differently from footnotes.
380 Here's a reference to the above, [CIT2002]_, and a [nonexistent]_
389 This paragraph is pointed to by the explicit "example" target. A
390 reference can be found under `Inline Markup`_, above. `Inline
391 hyperlink targets`_ are also possible.
393 Section headers are implicit targets, referred to by name. See
394 Targets_, which is a subsection of `Body Elements`_.
396 Explicit external targets are interpolated into references such as
399 .. _python: http://www.python.org/
401 Targets may be indirect and anonymous. Thus `this phrase`__ may also
402 refer to the Targets_ section.
406 Here's a `hyperlink reference without a target`_, which generates an
409 And another phrase__ pointing to an anonymous hyperlink.
411 __ http://www.example.com/
413 Duplicate Target Names
414 ~~~~~~~~~~~~~~~~~~~~~~
416 Duplicate names in section headers or other implicit targets will
417 generate "info" (level-1) system messages. Duplicate names in
418 explicit targets will generate "warning" (level-2) system messages.
420 Duplicate Target Names
421 ~~~~~~~~~~~~~~~~~~~~~~
423 Since there are two "Duplicate Target Names" section headers, we
424 cannot uniquely refer to either of them by name. If we try to (like
425 this: `Duplicate Target Names`_), an error is generated.
433 These are just a sample of the many reStructuredText Directives. For
435 http://docutils.sourceforge.net/docs/ref/rst/directives.html.
440 An example of the "contents" directive can be seen above this section
441 (a local, untitled table of contents_) and at the beginning of the
442 document (a document-wide `table of contents`_).
447 An image directive (also clickable -- a hyperlink reference):
449 .. image:: ../../../docs/user/rst/images/title.png
453 .. image:: ../../../docs/user/rst/images/title.png
454 :target: http://www.merten-home.de/
458 .. figure:: ../../../docs/user/rst/images/title.png
459 :alt: reStructuredText, the markup syntax
461 A figure is an image with a caption and/or a legend:
463 +------------+-----------------------------------------------+
464 | re | Revised, revisited, based on 're' module. |
465 +------------+-----------------------------------------------+
466 | Structured | Structure-enhanced text, structuredtext. |
467 +------------+-----------------------------------------------+
468 | Text | Well it is, isn't it? |
469 +------------+-----------------------------------------------+
471 This paragraph is also part of the legend.
476 .. attention:: Directives at large.
478 .. caution:: Don't take any wooden nickels.
480 .. danger:: Mad scientist at work!
482 .. error:: Does not compute.
484 .. hint:: It's bigger than a bread box.
487 - Wash behind your ears.
489 - Clean up your room.
495 .. note:: This is a note.
497 .. tip:: 15% if the service is good.
499 .. warning:: Strong prose may provoke extreme mental exertion.
500 Reader discretion is strongly advised.
502 .. admonition:: And, by the way...
504 You can make up your own admonition too.
506 Topics, Sidebars, and Rubrics
507 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
509 .. sidebar:: Sidebar Title
510 :subtitle: Optional Subtitle
512 This is a sidebar. It is for text outside the flow of the main
515 .. rubric:: This is a rubric inside a sidebar
517 Sidebars often appears beside the main text with a border and
520 .. topic:: Topic Title
524 .. rubric:: This is a rubric
534 I recommend you try Python, *the* best language around .
536 .. |Python| replace:: Python, *the* best language around
544 Compound 1, paragraph 1.
546 Compound 1, paragraph 2.
548 * Compound 1, list item one.
550 * Compound 1, list item two.
552 Another compound statement:
556 Compound 2, a literal block:
562 Compound 2, this is a test.
566 Compound 3, only consisting of one paragraph.
573 This one starts with a literal block.
575 Compound 4, a paragraph.
577 Now something *really* perverted -- a nested compound block. In
578 LaTeX, the following paragraphs should all be first-line indented:
582 Compound 5, block 1 (a paragraph).
586 Compound 6, block 2 in compound 5.
588 Compound 6, another paragraph.
590 Compound 5, block 3 (a paragraph).
594 Compound 7, with a table inside:
596 +--------------------+--------------------+--------------------+
597 | Left cell, first | Middle cell, | Right cell. |
598 | paragraph. | consisting of | |
599 | | exactly one | Paragraph 2. |
600 | Left cell, second | paragraph. | |
601 | paragraph. | | Paragraph 3. |
602 +--------------------+--------------------+--------------------+
604 Compound 7, a paragraph after the table.
606 Compound 7, another paragraph.
608 Substitution Definitions
609 ------------------------
611 An inline image (|EXAMPLE|) example:
613 .. |EXAMPLE| image:: ../../../docs/user/rst/images/biohazard.png
616 (Substitution definitions are not visible in the HTML source.)
623 .. Comments begin with two dots and a space. Anything may
624 follow, except for the syntax of footnotes, hyperlink
625 targets, directives, or substitution definitions.
627 Double-dashes -- "--" -- must be escaped somehow in HTML output.
629 (View the HTML source to see the comment.)
634 This does not necessarily look nice, because there may be missing white space.
636 It's just there to freeze the behavior.
650 Another test with myclass set.
652 This is the :RAW-ROLE:`fourth test` with myrawroleclass set.
656 Fifth test in HTML.<br />Line two.
660 Fifth test in LaTeX.\\Line two.