blob: 04bd2cb05faf4cda0de22849f85be4c93334d48c (
plain)
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
|
<document source="/home/milde/Code/Python/docutils-svn/sandbox/code-block-directive/docs/myfunction.py.txt">
<paragraph>
This is a test of the new "code" directive:
<comment xml:space="preserve">
Translate this document to HTML with a pygments enhanced frontend, e.g.
../rst2html-highlight.py --stylesheet=../data/pygments-default.css
../rst2latex-highlight.py --stylesheet=../data/pygments-docutilsroles.sty
../rst2pseudoxml-highlight.py
<paragraph>
The example from Docutils TODO list:
<literal_block classes="code pythonsi" xml:space="preserve">
print 'This is Python code.'
for i in range(10):
print i
<paragraph>
Another example:
<literal_block classes="code python silly" ids="my-function" names="my-function" xml:space="preserve">
<inline classes="ln">
7
<inline classes="k">
def
<inline classes="nf">
my_function
<inline classes="p">
():
<inline classes="ln">
8
<inline classes="sd">
"""Test the lexer.
<inline classes="ln">
9
<inline classes="sd">
<inline classes="ln">
10
<inline classes="sd">
just a test"""
<inline classes="ln">
11
<inline classes="ln">
12
<inline classes="c">
# and now for something completely different
<inline classes="ln">
13
<inline classes="k">
print
<inline classes="mi">
8
<inline classes="o">
/
<inline classes="mi">
2
<paragraph>
The end.
|