Perform syntax highlighting on the given doctest string, and return
the resulting LaTeX code. This code consists of an alltt
environment. Syntax highlighting is performed using the following new
latex commands, which must be defined externally:
-
\pysrcprompt -- the Python PS1 prompt
(>>>)
-
\pysrcmore -- the Python PS2 prompt (...)
-
\pysrckeyword -- a Python keyword (for, if, etc.)
-
\pysrcbuiltin -- a Python builtin name (abs, dir,
etc.)
-
\pysrcstring -- a string literal
-
\pysrccomment -- a comment
-
\pysrcexcept -- an exception traceback (up to the
next >>>)
-
\pysrcoutput -- the output from a doctest block.
-
\pysrcdefname -- the name of a function or class
defined by a def or class statement.
|