blob: 5e180e46eaa35b250d64eaf1277869f1eb0cdadd (
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
|
<?xml version="1.0" encoding="utf-8" ?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<meta name="generator" content="Docutils 0.9: http://docutils.sourceforge.net/" />
<title></title>
<link rel="stylesheet" href="../data/pygments-default.css" type="text/css" />
</head>
<body>
<div class="document">
<p>This is a test of the new "code" directive:</p>
<!-- 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 -->
<p>The example from Docutils TODO list:</p>
<pre class="code python literal-block">
<span class="k">print</span> <span class="s">'This is Python code.'</span>
<span class="k">for</span> <span class="n">i</span> <span class="ow">in</span> <span class="nb">range</span><span class="p">(</span><span class="mi">10</span><span class="p">):</span>
<span class="k">print</span> <span class="n">i</span>
</pre>
<p>Numbered lines:</p>
<pre class="code python literal-block">
<span class="ln">1 </span><span class="c"># This is Python code,</span>
<span class="ln">2 </span><span class="c"># that prints the integers from 0 to 9</span>
<span class="ln">3 </span><span class="k">for</span> <span class="n">i</span> <span class="ow">in</span> <span class="nb">range</span><span class="p">(</span><span class="mi">10</span><span class="p">):</span>
<span class="ln">4 </span> <span class="k">print</span> <span class="n">i</span>
</pre>
<p>Another example:</p>
<pre class="code python silly literal-block" id="my-function">
<span class="ln"> 7 </span><span class="k">def</span> <span class="nf">my_function</span><span class="p">():</span>
<span class="ln"> 8 </span> <span class="sd">"""Test the lexer.
</span><span class="ln"> 9 </span><span class="sd"> """</span>
<span class="ln">10 </span>
<span class="ln">11 </span> <span class="c"># and now for something completely different</span>
<span class="ln">12 </span> <span class="k">print</span> <span class="mi">8</span><span class="o">/</span><span class="mi">2</span>
</pre>
<p>The end.</p>
</div>
</body>
</html>
|