Change default of "syntax highlight" option to "long",
[docutils.git] / test / functional / input / data / standard.txt
blobac8ce47b3381883cd0ef595bd986884eb18eebde
1 .. This is a comment. Note how any initial comments are moved by
2    transforms to after the document title, subtitle, and docinfo.
4 .. _doctitle:
6 ================================
7  reStructuredText Test Document
8 ================================
10 .. Above is the document title, and below is the subtitle.
11    They are transformed from section titles after parsing.
13 .. _subtitle:
15 --------------------------------
16  Examples of Syntax Constructs
17 --------------------------------
19 .. bibliographic fields (which also require a transform):
21 :Author: David Goodger
22 :Address: 123 Example Street
23           Example, EX  Canada
24           A1B 2C3
25 :Contact: goodger@python.org
26 :Authors: Me; Myself; I
27 :organization: humankind
28 :date: Now, or yesterday.  Or maybe even *before* yesterday.
29 :status: This is a "work in progress"
30 :revision: is managed by a version control system.
31 :version: 1
32 :copyright: This document has been placed in the public domain. You
33             may do with it as you wish. You may copy, modify,
34             redistribute, reattribute, sell, buy, rent, lease,
35             destroy, or improve it, quote it at length, excerpt,
36             incorporate, collate, fold, staple, or mutilate it, or do
37             anything else to it that your or anyone else's heart
38             desires.
39 :field name: This is a "generic bibliographic field".
40 :field name "2":
41     Generic bibliographic fields may contain multiple body elements.
43     Like this.
45 :Dedication:
47     For Docutils users & co-developers.
49 :abstract:
51     This is a test document, containing at least one example of each
52     reStructuredText construct.
54 .. meta::
55    :keywords: reStructuredText, test, parser
56    :description lang=en: A test document, containing at least one
57        example of each reStructuredText construct.
59 .. raw:: latex
61    \pagebreak[4] % start ToC on new page
63 .. contents:: Table of Contents
64 .. section-numbering::
67 Structural Elements
68 ===================
70 Section Title
71 -------------
72 Section Subtitle
73 ````````````````
75 Lone subsections are converted to a section subtitle by a transform
76 activated with the ``--section-subtitles`` command line option or the
77 ``sectsubtitle-xform`` configuration value.
79 Empty Section
80 -------------
82 Transitions
83 -----------
85 Here's a transition:
87 ---------
89 It divides the section.  Transitions may also occur between sections:
91 ---------
93 Body Elements
94 =============
96 Paragraphs
97 ----------
99 A paragraph.
101 Inline Markup
102 `````````````
104 Paragraphs contain text and may contain inline markup: *emphasis*,
105 **strong emphasis**, ``inline literals``, standalone hyperlinks
106 (http://www.python.org), external hyperlinks (Python_), internal
107 cross-references (example_), external hyperlinks with embedded URIs
108 (`Python web site <http://www.python.org>`__), `anonymous hyperlink
109 references`__ (`a second reference`__), footnote references (manually
110 numbered [1]_, anonymous auto-numbered [#]_, labeled auto-numbered
111 [#label]_, or symbolic [*]_), citation references ([CIT2002]_),
112 substitution references (|example|), and _`inline hyperlink targets`
113 (see Targets_ below for a reference back to here).  Character-level
114 inline markup is also possible (although exceedingly ugly!) in *re*\
115 ``Structured``\ *Text*.  Problems are indicated by |problematic| text
116 (generated by processing errors; this one is intentional).  Here is a
117 reference to the doctitle_ and the subtitle_.
119 __ http://www.python.org/
120 __ http://docutils.sourceforge.net/
122 The default role for interpreted text is `Title Reference`.  Here are
123 some explicit interpreted text roles: a PEP reference (:PEP:`287`); an
124 RFC reference (:RFC:`2822`); an abbreviation (:ab:`abb.`), an acronym
125 (:ac:`reST`), code (:code:`print "hello world"`); a :sub:`subscript`;
126 a :sup:`superscript` and explicit roles for :title:`Docutils`'
127 :emphasis:`standard` :strong:`inline` :literal:`markup`.
129 .. DO NOT RE-WRAP THE FOLLOWING PARAGRAPH!
131 Let's test wrapping and whitespace significance in inline literals:
132 ``This is an example of --inline-literal --text, --including some--
133 strangely--hyphenated-words.  Adjust-the-width-of-your-browser-window
134 to see how the text is wrapped.  -- ---- --------  Now note    the
135 spacing    between the    words of    this sentence    (words
136 should    be grouped    in pairs).``
138 If the ``--pep-references`` option was supplied, there should be a
139 live link to PEP 258 here.
141 Bullet Lists
142 ------------
144 - A bullet list
146   + Nested bullet list.
147   + Nested item 2.
149 - Item 2.
151   Paragraph 2 of item 2.
153   * Nested bullet list.
154   * Nested item 2.
156     - Third level.
157     - Item 2.
159   * Nested item 3.
161   * This nested list should be compacted by the HTML writer.
163     .. _target:
165     .. Even if this item contains a target and a comment.
167 Enumerated Lists
168 ----------------
170 1. Arabic numerals.
172    a) lower alpha)
174       (i) (lower roman)
176           A. upper alpha.
178              I) upper roman)
180 2. Lists that don't start at 1:
182    3. Three
184    4. Four
186    C. C
188    D. D
190    iii. iii
192    iv. iv
194 Definition Lists
195 ----------------
197 Term
198     Definition
199 Term : classifier
200     Definition paragraph 1.
202     Definition paragraph 2.
203 Term
204     Definition
205 Term : classifier one  :  classifier two
206     Definition
208 Field Lists
209 -----------
211 :what: Field lists map field names to field bodies, like database
212        records.  They are often part of an extension syntax.  They are
213        an unambiguous variant of RFC 2822 fields.
215 :how arg1 arg2:
217     The field marker is a colon, the field name, and a colon.
219     The field body may contain one or more body elements, indented
220     relative to the field marker.
222 :credits:
224     .. class:: credits
226     This paragraph has the `credits` class set.  (This is actually not
227     about credits but just for ensuring that the class attribute
228     doesn't get stripped away.)
230 Option Lists
231 ------------
233 For listing command-line options:
235 -a            command-line option "a"
236 -b file       options can have arguments
237               and long descriptions
238 --long        options can be long also
239 --input=file  long options can also have
240               arguments
242 --very-long-option
243               The description can also start on the next line.
245               The description may contain multiple body elements,
246               regardless of where it starts.
248 -x, -y, -z    Multiple options are an "option group".
249 -v, --verbose  Commonly-seen: short & long options.
250 -1 file, --one=file, --two file
251               Multiple options with arguments.
252 /V            DOS/VMS-style options too
254 There must be at least two spaces between the option and the
255 description.
257 Literal Blocks
258 --------------
260 Literal blocks are indicated with a double-colon ("::") at the end of
261 the preceding paragraph (over there ``-->``).  They can be indented::
263     if literal_block:
264         text = 'is left as-is'
265         spaces_and_linebreaks = 'are preserved'
266         markup_processing = None
268 Or they can be quoted without indentation::
270 >> Great idea!
272 > Why didn't I think of that?
274 Line Blocks
275 -----------
277 This section tests line blocks.  Line blocks are body elements which
278 consist of lines and other line blocks.  Nested line blocks cause
279 indentation.
281 | This is a line block.  It ends with a blank line.
282 |     New lines begin with a vertical bar ("|").
283 |     Line breaks and initial indent are significant, and preserved.
284 |         Continuation lines are also possible.  A long line that is intended
285           to wrap should begin with a space in place of the vertical bar.
286 |     The left edge of a continuation line need not be aligned with
287   the left edge of the text above it.
289 | This is a second line block.
291 | Blank lines are permitted internally, but they must begin with a "|".
293 Another line block, surrounded by paragraphs:
295 | And it's no good waiting by the window
296 | It's no good waiting for the sun
297 | Please believe me, the things you dream of
298 | They don't fall in the lap of no-one
300 Take it away, Eric the Orchestra Leader!
302     | A one, two, a one two three four
303     |
304     | Half a bee, philosophically,
305     |     must, *ipso facto*, half not be.
306     | But half the bee has got to be,
307     |     *vis a vis* its entity.  D'you see?
308     |
309     | But can a bee be said to be
310     |     or not to be an entire bee,
311     |         when half the bee is not a bee,
312     |             due to some ancient injury?
313     |
314     | Singing...
316 A line block, like the following poem by Christian Morgenstern, can
317 also be centre-aligned:
319 .. class:: language-de align-center
321 | **Die Trichter** 
323 | Zwei Trichter wandeln durch die Nacht.
324 | Durch ihres Rumpfs verengten Schacht
325 | fließt weißes Mondlicht
326 | still und heiter
327 | auf   ihren
328 | Waldweg
329 | u. s.
330 | w.
333 Block Quotes
334 ------------
336 Block quotes consist of indented body elements:
338     My theory by A. Elk.  Brackets Miss, brackets.  This theory goes
339     as follows and begins now.  All brontosauruses are thin at one
340     end, much much thicker in the middle and then thin again at the
341     far end.  That is my theory, it is mine, and belongs to me and I
342     own it, and what it is too.
344     -- Anne Elk (Miss)
346 The language of a quote (like any other object) can be specified by
347 a class attribute:
349 .. class:: language-fr
353     ReStructuredText est un langage de balisage léger utilisé
354     notamment dans la documentation du langage Python.
356 Doctest Blocks
357 --------------
359 >>> print 'Python-specific usage examples; begun with ">>>"'
360 Python-specific usage examples; begun with ">>>"
361 >>> print '(cut and pasted from interactive Python sessions)'
362 (cut and pasted from interactive Python sessions)
364 Footnotes
365 ---------
367 .. [1] A footnote contains body elements, consistently indented by at
368    least 3 spaces.
370    This is the footnote's second paragraph.
372 .. [#label] Footnotes may be numbered, either manually (as in [1]_) or
373    automatically using a "#"-prefixed label.  This footnote has a
374    label so it can be referred to from multiple places, both as a
375    footnote reference ([#label]_) and as a `hyperlink reference`__.
377    __ label_
379 .. [#] This footnote is numbered automatically and anonymously using a
380    label of "#" only.
382    This is the second paragraph.
384    And this is the third paragraph.
386 .. [*] Footnotes may also use symbols, specified with a "*" label.
387    Here's a reference to the next footnote: [*]_.
389 .. [*] This footnote shows the next symbol in the sequence.
391 .. [4] Here's an unreferenced footnote, with a reference to a
392    nonexistent footnote: [5]_.
394 Citations
395 ---------
397 .. [CIT2002] Citations are text-labeled footnotes. They may be
398    rendered separately and differently from footnotes.
400 Here's a reference to the above, [CIT2002]_, and a [nonexistent]_
401 citation.
403 .. _Another Target:
405 Targets
406 -------
408 .. _example:
410 This paragraph is pointed to by the explicit "example" target. A
411 reference can be found under `Inline Markup`_, above. `Inline
412 hyperlink targets`_ are also possible.
414 Section headers are implicit targets, referred to by name. See
415 Targets_, which is a subsection of `Body Elements`_.
417 Explicit external targets are interpolated into references such as
418 "Python_".
420 .. _Python: http://www.python.org/
422 Targets may be indirect and anonymous.  Thus `this phrase`__ may also
423 refer to the Targets_ section.
425 __ Targets_
427 Here's a `hyperlink reference without a target`_, which generates an
428 error.
430 Duplicate Target Names
431 ``````````````````````
433 Duplicate names in section headers or other implicit targets will
434 generate "info" (level-1) system messages.  Duplicate names in
435 explicit targets will generate "warning" (level-2) system messages.
437 Duplicate Target Names
438 ``````````````````````
440 Since there are two "Duplicate Target Names" section headers, we
441 cannot uniquely refer to either of them by name.  If we try to (like
442 this: `Duplicate Target Names`_), an error is generated.
444 Directives
445 ----------
447 .. contents:: :local:
449 These are just a sample of the many reStructuredText Directives.  For
450 others, please see
451 http://docutils.sourceforge.net/docs/ref/rst/directives.html.
453 Document Parts
454 ``````````````
456 An example of the "contents" directive can be seen above this section
457 (a local, untitled table of contents_) and at the beginning of the
458 document (a document-wide `table of contents`_).
460 Images and Figures
461 ``````````````````
463 An image directive (also clickable -- a hyperlink reference):
465 .. image:: ../../../docs/user/rst/images/title.png
466    :class: class1 class2
467    :target: directives_
469 Image with multiple IDs:
471 .. _image target 1:
472 .. _image target 2:
473 .. _image target 3:
474 .. image:: ../../../docs/user/rst/images/title.png
476 A centered image:
478 .. image:: ../../../docs/user/rst/images/biohazard.png
479    :align: center
481 A left-aligned image:
483 .. image:: ../../../docs/user/rst/images/biohazard.png
484    :align: left
486 This paragraph might flow around the image.
487 The specific behavior depends upon the style sheet and
488 the browser or rendering software used.
490 A right-aligned image:
492 .. image:: ../../../docs/user/rst/images/biohazard.png
493    :align: right
495 This paragraph might flow around the image.
496 The specific behavior depends upon the style sheet and
497 the browser or rendering software used.
499 For inline images see `Substitution Definitions`_.
501 Image size:
503 An image 2 em wide:
505 .. image:: ../../../docs/user/rst/images/biohazard.png
506    :width: 2 em
508 An image 2 em wide and 15 pixel high:
510 .. image:: ../../../docs/user/rst/images/biohazard.png
511    :width: 2em
512    :height: 15 px
514 An image occupying 50% of the line width:
516 .. image:: ../../../docs/user/rst/images/title.png
517    :width: 50%
519 An image 2 cm high:
521 .. image:: ../../../docs/user/rst/images/biohazard.png
522    :height: 2 cm
524 A *figure* is an image with a caption and/or a legend.  With page-based output
525 media, figures might float to a different position if this helps the page
526 layout.
528 .. figure:: ../../../docs/user/rst/images/title.png
529    :figclass: figclass1 figclass2
530    :class: class1 class2
531    :alt: reStructuredText, the markup syntax
532    :width: 258
534    Plaintext markup syntax and parser system.
536    +------------+-----------------------------------------------+
537    | re         | Revised, revisited, based on 're' module.     |
538    +------------+-----------------------------------------------+
539    | Structured | Structure-enhanced text, structuredtext.      |
540    +------------+-----------------------------------------------+
541    | Text       | Well it is, isn't it?                         |
542    +------------+-----------------------------------------------+
544    This paragraph is also part of the legend.
546 A left-aligned figure:
548 .. figure:: ../../../docs/user/rst/images/biohazard.png
549    :figclass: figclass1 figclass2
550    :class: class1 class2
551    :alt: reStructuredText, the markup syntax
552    :align: left
553    :width: 40 px
554    :figwidth: 70 %
556    This is the caption.
558    This is the legend.
560    The legend may consist of several paragraphs.
562 This paragraph might flow around the figure.
564 The specific behavior depends upon the style sheet and the browser or
565 rendering software used.
567 A centered figure:
569 .. figure:: ../../../docs/user/rst/images/biohazard.png
570    :align: center
571    :width: 40 px
573    This is the caption.
575    This is the legend.
577    The legend may consist of several paragraphs.
579 This paragraph might flow around the figure.
581 The specific behavior depends upon the style sheet and the browser or
582 rendering software used.
584 A right-aligned figure:
586 .. figure:: ../../../docs/user/rst/images/biohazard.png
587    :align: right
588    :width: 40 px
590    This is the caption.
592    This is the legend.
594    The legend may consist of several paragraphs.
596 This paragraph might flow around the figure. The specific behavior depends
597 upon the style sheet and the browser or rendering software used.
600 Admonitions
601 ```````````
603 .. Attention:: Directives at large.
605 .. Caution::
607    Don't take any wooden nickels.
609 .. DANGER:: Mad scientist at work!
611 .. Error:: Does not compute.
613 .. Hint:: It's bigger than a bread box.
615 .. Important::
616    - Wash behind your ears.
617    - Clean up your room.
618    - Call your mother.
619    - Back up your data.
621 .. Note:: This is a note.
623 .. Tip:: 15% if the service is good.
625 .. WARNING:: Strong prose may provoke extreme mental exertion.
626    Reader discretion is strongly advised.
628 .. admonition:: And, by the way...
630    You can make up your own admonition too.
632    .. _Docutils: http://docutils.sourceforge.net/
634 Topics, Sidebars, and Rubrics
635 `````````````````````````````
637 *Sidebars* are like miniature, parallel documents.
639 .. sidebar:: Sidebar Title
640    :subtitle: Optional Subtitle
642    This is a sidebar.  It is for text outside the flow of the main
643    text.
645    .. rubric:: This is a rubric inside a sidebar
647    Sidebars often appear beside the main text with a border and a different
648    background or font color.
650 A *topic* is like a block quote with a title, or a self-contained section
651 with no subsections.
653 .. topic:: Topic Title
655    This is a topic.
657 A *rubric* is like an informal heading that doesn't correspond to the
658 document's structure. It is typically highlighted in red (hence the name).
660 .. rubric:: This is a rubric
662 Topics and rubrics can be used at places where a `section title`_ is not
663 allowed (e.g. inside a directive).
665 Target Footnotes
666 ````````````````
668 .. target-notes::
671 Replacement Text
672 ````````````````
674 I recommend you try |Python|_.
676 .. |Python| replace:: Python, *the* best language around
678 Compound Paragraph
679 ``````````````````
681 .. compound::
682    :class: some-class
684    Compound 1, paragraph 1.
686    Compound 1, paragraph 2.
688    * Compound 1, list item one.
689    * Compound 1, list item two.
691 Another compound statement:
693 .. compound::
695    Compound 2, a literal block::
697        Compound 2, literal.
699    Compound 2, this is a test.
701 .. compound::
703    Compound 3, only consisting of one paragraph.
705 .. compound::
707    ::
709        Compound 4.
710        This one starts with a literal block.
712    Compound 4, a paragraph.
714 Now something *really* perverted -- a nested compound block.  This is
715 just to test that it works at all; the results don't have to be
716 meaningful.
718 .. compound::
720    Compound 5, block 1 (a paragraph).
722    .. compound::
724       Compound 6, block 2 in compound 5.
726       Compound 6, another paragraph.
728    Compound 5, block 3 (a paragraph).
730 .. compound::
732    Compound 7, with a table inside:
734    +--------------------+--------------------+--------------------+
735    | Left cell, first   | Middle cell,       | Right cell.        |
736    | paragraph.         | consisting of      |                    |
737    |                    | exactly one        | Paragraph 2.       |
738    | Left cell, second  | paragraph.         |                    |
739    | paragraph.         |                    | Paragraph 3.       |
740    +--------------------+--------------------+--------------------+
742    Compound 7, a paragraph after the table.
744    Compound 7, another paragraph.
746 Parsed Literal Blocks
747 `````````````````````
749 .. parsed-literal::
751    This is a parsed literal block.
752        This line is indented.  The next line is blank.
754    Inline markup is supported, e.g. *emphasis*, **strong**, ``literal
755    text``, footnotes [1]_, _`hyperlink targets`, and `references
756    <http://www.python.org/>`_.
758 Code
759 ````
761 Blocks of source code can be set with the `code` directive. If the code
762 language is specified, the content is parsed and tagged by the Pygments_
763 syntax highlighter and can be formatted with a style sheet. (Code parsing
764 is turned off using the ``syntax-highlight`` config setting in the test
765 conversions in order to get identical results with/without installed
766 Pygments highlighter.)
768 .. code:: python
770   print 'This is Python code.'
772 The ``:number-lines:`` option (with optional start value) generates line
773 numbers:
775 .. code:: python
776   :number-lines: 8
778   # print integers from 0 to 9:
779   for i in range(10):
780       print i
782 For inline code snippets, there is the `code` role, which can be used
783 directly (the code will not be parsed/tagged, as the language is not known)
784 or as base for special code roles, e.g. the LaTeX code in the next
785 paragraph.
787 .. role:: tex(code)
788    :language: tex
790 Docutils uses LaTeX syntax for math directives and roles: 
791 :tex:`\alpha = f(x)` prints :math:`\alpha = f(x)`.
793 The ``:code:`` option of the `include` directive sets the included content
794 as a code block, here the rst file ``header_footer.txt`` with line numbers:
796 .. include:: header_footer.txt
797    :code: rst
798    :number-lines:
800 .. _Pygments: http://pygments.org/
802 Substitution Definitions
803 ------------------------
805 An inline image (|example|) example:
807 .. |EXAMPLE| image:: ../../../docs/user/rst/images/biohazard.png
809 (Substitution definitions are not visible in the HTML source.)
811 Comments
812 --------
814 Here's one:
816 .. Comments begin with two dots and a space. Anything may
817    follow, except for the syntax of footnotes, hyperlink
818    targets, directives, or substitution definitions.
820    Double-dashes -- "--" -- must be escaped somehow in HTML output.
822    Comments may contain non-ASCII characters: ä ö ü æ ø å
824 (View the HTML source to see the comment.)
826 Raw text
827 --------
829 This does not necessarily look nice, because there may be missing white space.
831 It's just there to freeze the behavior.
833 .. raw:: html latex
835    A test.
837 .. raw:: html latex
839    Second test.
841 .. class:: myclass
843 .. raw:: html latex
845    Another test with myclass set.
847 .. role:: raw-role(raw)
848    :format: html latex
849    :class: myrawroleclass
851 This is the :raw-role:`fourth test` with myrawroleclass set.
853 .. raw:: html
855    Fifth test in HTML.<br />Line two.
857 .. raw:: latex
859    Fifth test in LaTeX.\\Line two.
861 Container
862 ---------
864 .. container:: custom
866    paragraph 1
868    paragraph 2