<?xml version="1.0" encoding="ascii"?> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en"> <head> <title>epydoc.markup.doctest</title> <link rel="stylesheet" href="epydoc.css" type="text/css" /> <script type="text/javascript" src="epydoc.js"></script> </head> <body bgcolor="white" text="black" link="blue" vlink="#204080" alink="#204080"> <!-- ==================== NAVIGATION BAR ==================== --> <table class="navbar" border="0" width="100%" cellpadding="0" bgcolor="#a0c0ff" cellspacing="0"> <tr valign="middle"> <!-- Home link --> <th> <a href="epydoc-module.html">Home</a> </th> <!-- Tree link --> <th> <a href="module-tree.html">Trees</a> </th> <!-- Index link --> <th> <a href="identifier-index.html">Indices</a> </th> <!-- Help link --> <th> <a href="help.html">Help</a> </th> <!-- Project homepage --> <th class="navbar" align="right" width="100%"> <table border="0" cellpadding="0" cellspacing="0"> <tr><th class="navbar" align="center" ><a class="navbar" target="_top" href="http://epydoc.sourceforge.net">epydoc 3.0.1</a></th> </tr></table></th> </tr> </table> <table width="100%" cellpadding="0" cellspacing="0"> <tr valign="top"> <td width="100%"> <span class="breadcrumbs"> <a href="epydoc-module.html">Package epydoc</a> :: <a href="epydoc.markup-module.html">Package markup</a> :: Module doctest </span> </td> <td> <table cellpadding="0" cellspacing="0"> <!-- hide/show private --> <tr><td align="right"><span class="options">[<a href="javascript:void(0);" class="privatelink" onclick="toggle_private();">hide private</a>]</span></td></tr> <tr><td align="right"><span class="options" >[<a href="frames.html" target="_top">frames</a >] | <a href="epydoc.markup.doctest-module.html" target="_top">no frames</a>]</span></td></tr> </table> </td> </tr> </table> <!-- ==================== MODULE DESCRIPTION ==================== --> <h1 class="epydoc">Module doctest</h1><p class="nomargin-top"><span class="codelink"><a href="epydoc.markup.doctest-pysrc.html">source code</a></span></p> <p>Syntax highlighting for doctest blocks. This module defines two functions, <a href="epydoc.markup.doctest-module.html#doctest_to_html" class="link">doctest_to_html()</a> and <a href="epydoc.markup.doctest-module.html#doctest_to_latex" class="link">doctest_to_latex()</a>, which can be used to perform syntax highlighting on doctest blocks. It also defines the more general <code>colorize_doctest()</code>, which could be used to do syntac highlighting on doctest blocks with other output formats. (Both <code>doctest_to_html()</code> and <code>doctest_to_latex()</code> are defined using <code>colorize_doctest()</code>.)</p> <!-- ==================== CLASSES ==================== --> <a name="section-Classes"></a> <table class="summary" border="1" cellpadding="3" cellspacing="0" width="100%" bgcolor="white"> <tr bgcolor="#70b0f0" class="table-header"> <td colspan="2" class="table-header"> <table border="0" cellpadding="0" cellspacing="0" width="100%"> <tr valign="top"> <td align="left"><span class="table-header">Classes</span></td> <td align="right" valign="top" ><span class="options">[<a href="#section-Classes" class="privatelink" onclick="toggle_private();" >hide private</a>]</span></td> </tr> </table> </td> </tr> <tr> <td width="15%" align="right" valign="top" class="summary"> <span class="summary-type"> </span> </td><td class="summary"> <a href="epydoc.markup.doctest.DoctestColorizer-class.html" class="summary-name">DoctestColorizer</a><br /> An abstract base class for performing syntax highlighting on doctest blocks and other bits of Python code. </td> </tr> <tr> <td width="15%" align="right" valign="top" class="summary"> <span class="summary-type"> </span> </td><td class="summary"> <a href="epydoc.markup.doctest.XMLDoctestColorizer-class.html" class="summary-name">XMLDoctestColorizer</a><br /> A subclass of DoctestColorizer that generates XML-like output. </td> </tr> <tr> <td width="15%" align="right" valign="top" class="summary"> <span class="summary-type"> </span> </td><td class="summary"> <a href="epydoc.markup.doctest.HTMLDoctestColorizer-class.html" class="summary-name">HTMLDoctestColorizer</a><br /> A subclass of DoctestColorizer that generates HTML output. </td> </tr> <tr> <td width="15%" align="right" valign="top" class="summary"> <span class="summary-type"> </span> </td><td class="summary"> <a href="epydoc.markup.doctest.LaTeXDoctestColorizer-class.html" class="summary-name">LaTeXDoctestColorizer</a><br /> A subclass of DoctestColorizer that generates LaTeX output. </td> </tr> </table> <!-- ==================== FUNCTIONS ==================== --> <a name="section-Functions"></a> <table class="summary" border="1" cellpadding="3" cellspacing="0" width="100%" bgcolor="white"> <tr bgcolor="#70b0f0" class="table-header"> <td colspan="2" class="table-header"> <table border="0" cellpadding="0" cellspacing="0" width="100%"> <tr valign="top"> <td align="left"><span class="table-header">Functions</span></td> <td align="right" valign="top" ><span class="options">[<a href="#section-Functions" class="privatelink" onclick="toggle_private();" >hide private</a>]</span></td> </tr> </table> </td> </tr> <tr> <td width="15%" align="right" valign="top" class="summary"> <span class="summary-type"> </span> </td><td class="summary"> <table width="100%" cellpadding="0" cellspacing="0" border="0"> <tr> <td><span class="summary-sig"><a href="epydoc.markup.doctest-module.html#doctest_to_html" class="summary-sig-name">doctest_to_html</a>(<span class="summary-sig-arg">s</span>)</span><br /> Perform syntax highlighting on the given doctest string, and return the resulting HTML code.</td> <td align="right" valign="top"> <span class="codelink"><a href="epydoc.markup.doctest-pysrc.html#doctest_to_html">source code</a></span> <br /><span class="codelink"><a href="javascript:void(0);" onclick="toggleCallGraph('call_graph_for_doctest_to_html-summary-div');return false;">call graph</a></span> </td> </tr> </table> <div style="display:none" id="call_graph_for_doctest_to_html-summary-div"><center> <table border="0" cellpadding="0" cellspacing="0"> <tr><td><center> <map id="call_graph_for_doctest_to_html" name="call_graph_for_doctest_to_html"> <area shape="rect" href="epydoc.markup.doctest.DoctestColorizer-class.html#colorize_doctest" title="DoctestColorizer.colorize_doctest()" alt="" coords="604,6,892,38" /> <area shape="rect" href="epydoc.markup.doctest-module.html#doctest_to_html" title="doctest_to_html()" alt="" coords="400,6,555,38" /> <area shape="rect" href="epydoc.markup.epytext.ParsedEpytextDocstring-class.html#_to_html" title="epytext.ParsedEpytextDocstring._to_html()" alt="" coords="6,6,352,38" /> </map> <img src="call_graph_for_doctest_to_html.gif" alt='' usemap="#call_graph_for_doctest_to_html" ismap="ismap" class="graph-without-title" /> </center></td></tr> <tr><th>Call Graph</th></tr> </table><br /> </center></div> </td> </tr> <tr> <td width="15%" align="right" valign="top" class="summary"> <span class="summary-type"> </span> </td><td class="summary"> <table width="100%" cellpadding="0" cellspacing="0" border="0"> <tr> <td><span class="summary-sig"><a href="epydoc.markup.doctest-module.html#doctest_to_latex" class="summary-sig-name">doctest_to_latex</a>(<span class="summary-sig-arg">s</span>)</span><br /> Perform syntax highlighting on the given doctest string, and return the resulting LaTeX code.</td> <td align="right" valign="top"> <span class="codelink"><a href="epydoc.markup.doctest-pysrc.html#doctest_to_latex">source code</a></span> </td> </tr> </table> </td> </tr> </table> <!-- ==================== FUNCTION DETAILS ==================== --> <a name="section-FunctionDetails"></a> <table class="details" border="1" cellpadding="3" cellspacing="0" width="100%" bgcolor="white"> <tr bgcolor="#70b0f0" class="table-header"> <td colspan="2" class="table-header"> <table border="0" cellpadding="0" cellspacing="0" width="100%"> <tr valign="top"> <td align="left"><span class="table-header">Function Details</span></td> <td align="right" valign="top" ><span class="options">[<a href="#section-FunctionDetails" class="privatelink" onclick="toggle_private();" >hide private</a>]</span></td> </tr> </table> </td> </tr> </table> <a name="doctest_to_html"></a> <div> <table class="details" border="1" cellpadding="3" cellspacing="0" width="100%" bgcolor="white"> <tr><td> <table width="100%" cellpadding="0" cellspacing="0" border="0"> <tr valign="top"><td> <h3 class="epydoc"><span class="sig"><span class="sig-name">doctest_to_html</span>(<span class="sig-arg">s</span>)</span> </h3> </td><td align="right" valign="top" ><span class="codelink"><a href="epydoc.markup.doctest-pysrc.html#doctest_to_html">source code</a></span> <br /><span class="codelink"><a href="javascript:void(0);" onclick="toggleCallGraph('call_graph_for_doctest_to_html-div');return false;">call graph</a></span> </td> </tr></table> <div style="display:none" id="call_graph_for_doctest_to_html-div"><center> <table border="0" cellpadding="0" cellspacing="0"> <tr><td><center> <map id="call_graph_for_doctest_to_html" name="call_graph_for_doctest_to_html"> <area shape="rect" href="epydoc.markup.doctest.DoctestColorizer-class.html#colorize_doctest" title="DoctestColorizer.colorize_doctest()" alt="" coords="604,6,892,38" /> <area shape="rect" href="epydoc.markup.doctest-module.html#doctest_to_html" title="doctest_to_html()" alt="" coords="400,6,555,38" /> <area shape="rect" href="epydoc.markup.epytext.ParsedEpytextDocstring-class.html#_to_html" title="epytext.ParsedEpytextDocstring._to_html()" alt="" coords="6,6,352,38" /> </map> <img src="call_graph_for_doctest_to_html.gif" alt='' usemap="#call_graph_for_doctest_to_html" ismap="ismap" class="graph-without-title" /> </center></td></tr> <tr><th>Call Graph</th></tr> </table><br /> </center></div> <p>Perform syntax highlighting on the given doctest string, and return the resulting HTML code. This code consists of a <code><pre></code> block with class=py-doctest. Syntax highlighting is performed using the following css classes:</p> <ul> <li> <code>py-prompt</code> -- the Python PS1 prompt (>>>) </li> <li> <code>py-more</code> -- the Python PS2 prompt (...) </li> <li> <code>py-keyword</code> -- a Python keyword (for, if, etc.) </li> <li> <code>py-builtin</code> -- a Python builtin name (abs, dir, etc.) </li> <li> <code>py-string</code> -- a string literal </li> <li> <code>py-comment</code> -- a comment </li> <li> <code>py-except</code> -- an exception traceback (up to the next >>>) </li> <li> <code>py-output</code> -- the output from a doctest block. </li> <li> <code>py-defname</code> -- the name of a function or class defined by a <code>def</code> or <code>class</code> statement. </li> </ul> <dl class="fields"> </dl> </td></tr></table> </div> <a name="doctest_to_latex"></a> <div> <table class="details" border="1" cellpadding="3" cellspacing="0" width="100%" bgcolor="white"> <tr><td> <table width="100%" cellpadding="0" cellspacing="0" border="0"> <tr valign="top"><td> <h3 class="epydoc"><span class="sig"><span class="sig-name">doctest_to_latex</span>(<span class="sig-arg">s</span>)</span> </h3> </td><td align="right" valign="top" ><span class="codelink"><a href="epydoc.markup.doctest-pysrc.html#doctest_to_latex">source code</a></span> </td> </tr></table> <p>Perform syntax highlighting on the given doctest string, and return the resulting LaTeX code. This code consists of an <code>alltt</code> environment. Syntax highlighting is performed using the following new latex commands, which must be defined externally:</p> <ul> <li> <code>\pysrcprompt</code> -- the Python PS1 prompt (>>>) </li> <li> <code>\pysrcmore</code> -- the Python PS2 prompt (...) </li> <li> <code>\pysrckeyword</code> -- a Python keyword (for, if, etc.) </li> <li> <code>\pysrcbuiltin</code> -- a Python builtin name (abs, dir, etc.) </li> <li> <code>\pysrcstring</code> -- a string literal </li> <li> <code>\pysrccomment</code> -- a comment </li> <li> <code>\pysrcexcept</code> -- an exception traceback (up to the next >>>) </li> <li> <code>\pysrcoutput</code> -- the output from a doctest block. </li> <li> <code>\pysrcdefname</code> -- the name of a function or class defined by a <code>def</code> or <code>class</code> statement. </li> </ul> <dl class="fields"> </dl> </td></tr></table> </div> <br /> <!-- ==================== NAVIGATION BAR ==================== --> <table class="navbar" border="0" width="100%" cellpadding="0" bgcolor="#a0c0ff" cellspacing="0"> <tr valign="middle"> <!-- Home link --> <th> <a href="epydoc-module.html">Home</a> </th> <!-- Tree link --> <th> <a href="module-tree.html">Trees</a> </th> <!-- Index link --> <th> <a href="identifier-index.html">Indices</a> </th> <!-- Help link --> <th> <a href="help.html">Help</a> </th> <!-- Project homepage --> <th class="navbar" align="right" width="100%"> <table border="0" cellpadding="0" cellspacing="0"> <tr><th class="navbar" align="center" ><a class="navbar" target="_top" href="http://epydoc.sourceforge.net">epydoc 3.0.1</a></th> </tr></table></th> </tr> </table> <table border="0" cellpadding="0" cellspacing="0" width="100%%"> <tr> <td align="left" class="footer"> <a href="epydoc-log.html">Generated by Epydoc 3.0.1 on Wed Jan 30 14:06:41 2008</a> </td> <td align="right" class="footer"> <a target="mainFrame" href="http://epydoc.sourceforge.net" >http://epydoc.sourceforge.net</a> </td> </tr> </table> <script type="text/javascript"> <!-- // Private objects are initially displayed (because if // javascript is turned off then we want them to be // visible); but by default, we want to hide them. So hide // them unless we have a cookie that says to show them. checkCookie(); // --> </script> </body> </html>