diff options
Diffstat (limited to 'sandbox/code-block-directive/docs/myfunction.py.htm')
-rw-r--r-- | sandbox/code-block-directive/docs/myfunction.py.htm | 40 |
1 files changed, 28 insertions, 12 deletions
diff --git a/sandbox/code-block-directive/docs/myfunction.py.htm b/sandbox/code-block-directive/docs/myfunction.py.htm index 617f4b671..5e180e46e 100644 --- a/sandbox/code-block-directive/docs/myfunction.py.htm +++ b/sandbox/code-block-directive/docs/myfunction.py.htm @@ -3,7 +3,7 @@ <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.8: http://docutils.sourceforge.net/" /> +<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> @@ -12,19 +12,35 @@ <p>This is a test of the new "code" directive:</p> -<!-- Translate this document to HTML with a pygments enhanced frontend, e.g. +<!-- Translate this document with a pygments enhanced frontend, e.g. -../rst2html-highlight - -stylesheet=../data/pygments-default.css + ../rst2html-highlight.py - -stylesheet=../data/pygments-default.css + ../rst2latex-highlight.py - -stylesheet=../data/pygments-docutilsroles.sty -../rst2latex-highlight - -stylesheet=../data/pygments-docutileroles.sty --> -<pre class="code python silly literal-block"> -<span class="ln">1 </span><span class="k">def</span> <span class="nf">my_function</span><span class="p">():</span> -<span class="ln">2 </span> <span class="sd">"""Test the lexer. -</span><span class="ln">3 </span><span class="sd"> -</span><span class="ln">4 </span><span class="sd"> just a test"""</span> -<span class="ln">5 </span> -<span class="ln">6 </span> <span class="c"># and now for something completely different</span> -<span class="ln">7 </span> <span class="k">print</span> <span class="mi">8</span><span class="o">/</span><span class="mi">2</span> +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> |