diff options
author | milde <milde@929543f6-e4f2-0310-98a6-ba3bd3dd1d04> | 2011-08-26 22:23:29 +0000 |
---|---|---|
committer | milde <milde@929543f6-e4f2-0310-98a6-ba3bd3dd1d04> | 2011-08-26 22:23:29 +0000 |
commit | b991feb7b06e99b2186fc533733905da9312f5d3 (patch) | |
tree | 9da9826e25d07a95e86d0f0ed8c711ba13305e92 /sandbox/code-block-directive/docs/myfunction.py.htm | |
parent | 0ffd4b2d58dbf67c4f35be718de8e69de2210c92 (diff) | |
download | docutils-b991feb7b06e99b2186fc533733905da9312f5d3.tar.gz |
Prepare code directive for inclusion in the core.
git-svn-id: http://svn.code.sf.net/p/docutils/code/trunk@7105 929543f6-e4f2-0310-98a6-ba3bd3dd1d04
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> |