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
|
.. -*- rst-mode -*-
.. translate to LaTeX with
rst2latex --literal-block-env=(|listings|verbatim|Verbatim)
Comparing blocks
================
A sample text to compare several types of block elements
Literal Blocks
--------------
The following syntax variants all translate to a "literal-block" docutils
doctree element.
A paragraph containing only two colons (``::``) indicates that the following
indented or **consistently** quoted text is a literal block.
Indented literal block
~~~~~~~~~~~~~~~~~~~~~~
::
Whitespace, newlines, blank lines, and
all kinds of markup (like *this* or
\this) is preserved by literal blocks.
indented literal block with class
.. class:: testme
::
Whitespace, newlines, blank lines, and
all kinds of markup (like *this* or
\this) is preserved by literal blocks.
Quoted literal block
~~~~~~~~~~~~~~~~~~~~
::
>> Great idea!
>
> Why didn't I think of that?
You just did! ;-)
Parsed Literal Block
~~~~~~~~~~~~~~~~~~~~
The "parsed-literal" directive starts a parsed "literal-block".
.. parsed-literal::
Whitespace, newlines, blank lines, are preserved, but
all kinds of markup (like *this* or
\this) is **not** preserved but converted to inline elements
by parsed literal blocks.
Doctest Blocks
--------------
Doctest exemples are read into the doctree element: "doctest-block".
(This could change as a "literal-block" will do as well.)
>>> print 'this is a Doctest block'
this is a Doctest block
Line blocks
-----------
Line blocks are useful for addresses,
verse, and adornment-free lists.
| Each new line begins with a
| vertical bar ("|").
| Line breaks and initial indents
| are preserved.
| Continuation lines are wrapped
portions of long lines; they begin
with spaces in place of vertical bars.
| last line
Line Block directive
~~~~~~~~~~~~~~~~~~~~
The "line-block" directive is deprecated. Use the line block syntax instead.
.. line-block::
Lend us a couple of bob till Thursday.
I'm absolutely skint.
But I'm expecting a postal order and I can pay you back
as soon as it comes.
Love, Ewan.
Special characters in a literal block
-------------------------------------
In LaTeX, many characters have a special meaning ::
The squares of $\sin(x)$ and $\cos(x)$ equals one:
$$
\sin^2(x) + \cos^2(x) = 1
$$
and need escaping in a literal block if no verbatim environment is
used.
|