blob: 7d632a7d5c25e6c8686e8645eef81b5034209206 (
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
|
This is a test of the new "code" directive:
.. Translate this document with a pygments enhanced frontend, e.g.
../rst2html-highlight.py --stylesheet=../data/pygments-default.css
../rst2latex-highlight.py --stylesheet=../data/pygments-docutilsroles.sty
or via the test case in
../pygments_code_block_directive.py --traceback
The example from Docutils TODO list:
.. code:: python
print 'This is Python code.'
for i in range(10):
print i
Numbered lines:
.. code:: python
:number-lines:
# This is Python code,
# that prints the integers from 0 to 9
for i in range(10):
print i
Another example:
.. code:: python
:class: silly
:name: my_function
:number-lines: 7
def my_function():
"""Test the lexer.
"""
# and now for something completely different
print 8/2
Inline code :code:`$\alpha = \int_0^\infty f(x) dx$`.
.. role:: python(code)
:language: python
:class: testclass
Python code :python:`print("The end.")`
|