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.tex | |
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.tex')
-rw-r--r-- | sandbox/code-block-directive/docs/myfunction.py.tex | 39 |
1 files changed, 31 insertions, 8 deletions
diff --git a/sandbox/code-block-directive/docs/myfunction.py.tex b/sandbox/code-block-directive/docs/myfunction.py.tex index c72da4eac..5a7721295 100644 --- a/sandbox/code-block-directive/docs/myfunction.py.tex +++ b/sandbox/code-block-directive/docs/myfunction.py.tex @@ -44,20 +44,43 @@ This is a test of the new ``code'' directive: -% 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-docutilsroles.sty +% or via the test case in +% +% ../pygments_code_block_directive.py --traceback + +The example from Docutils TODO list: +% +\begin{quote}{\ttfamily \raggedright \noindent +\DUrole{k}{print}~\DUrole{s}{'This~is~Python~code.'}~\\ +\DUrole{k}{for}~\DUrole{n}{i}~\DUrole{ow}{in}~\DUrole{nb}{range}\DUrole{p}{(}\DUrole{mi}{10}\DUrole{p}{):}~\\ +~~~~\DUrole{k}{print}~\DUrole{n}{i} +} +\end{quote} + +Numbered lines: +% +\begin{quote}{\ttfamily \raggedright \noindent +\DUrole{ln}{1~}\DUrole{c}{\#~This~is~Python~code,}~\\ +\DUrole{ln}{2~}\DUrole{c}{\#~that~prints~the~integers~from~0~to~9}~\\ +\DUrole{ln}{3~}\DUrole{k}{for}~\DUrole{n}{i}~\DUrole{ow}{in}~\DUrole{nb}{range}\DUrole{p}{(}\DUrole{mi}{10}\DUrole{p}{):}~\\ +\DUrole{ln}{4~}~~~~\DUrole{k}{print}~\DUrole{n}{i} +} +\end{quote} + +Another example: % \begin{quote}{\ttfamily \raggedright \noindent \DUrole{ln}{~7~}\DUrole{k}{def}~\DUrole{nf}{my\_function}\DUrole{p}{():}~\\ \DUrole{ln}{~8~}~~~~\DUrole{sd}{"{}"{}"Test~the~lexer.\\ -}\DUrole{ln}{~9~}\DUrole{sd}{~\\ -}\DUrole{ln}{10~}\DUrole{sd}{~~~~just~a~test"{}"{}"}~\\ -\DUrole{ln}{11~}~\\ -\DUrole{ln}{12~}~~~~\DUrole{c}{\#~and~now~for~something~completely~different}~\\ -\DUrole{ln}{13~}~~~~\DUrole{k}{print}~\DUrole{mi}{8}\DUrole{o}{/}\DUrole{mi}{2} +}\DUrole{ln}{~9~}\DUrole{sd}{~~~~"{}"{}"}~\\ +\DUrole{ln}{10~}~\\ +\DUrole{ln}{11~}~~~~\DUrole{c}{\#~and~now~for~something~completely~different}~\\ +\DUrole{ln}{12~}~~~~\DUrole{k}{print}~\DUrole{mi}{8}\DUrole{o}{/}\DUrole{mi}{2} } \end{quote} |