Sophie

Sophie

distrib > Mageia > 5 > x86_64 > media > core-updates > by-pkgid > c044f82ec6193fba7e13c97913613b07 > files > 947

ipython-doc-2.3.0-2.3.mga5.noarch.rpm

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
  "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">


<html xmlns="http://www.w3.org/1999/xhtml">
  <head>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
    
    <title>New IPython Console Lexer &mdash; IPython 2.3.0 documentation</title>
    
    <link rel="stylesheet" href="../_static/default.css" type="text/css" />
    <link rel="stylesheet" href="../_static/pygments.css" type="text/css" />
    
    <script type="text/javascript">
      var DOCUMENTATION_OPTIONS = {
        URL_ROOT:    '../',
        VERSION:     '2.3.0',
        COLLAPSE_INDEX: false,
        FILE_SUFFIX: '.html',
        HAS_SOURCE:  true
      };
    </script>
    <script type="text/javascript" src="../_static/jquery.js"></script>
    <script type="text/javascript" src="../_static/underscore.js"></script>
    <script type="text/javascript" src="../_static/doctools.js"></script>
    <link rel="top" title="IPython 2.3.0 documentation" href="../index.html" />
    <link rel="up" title="IPython developer’s guide" href="index.html" />
    <link rel="next" title="Writing code for Python 2 and 3" href="pycompat.html" />
    <link rel="prev" title="Connection Diagrams of The IPython ZMQ Cluster" href="parallel_connections.html" /> 
  </head>
  <body>

<div style="background-color: white; text-align: left; padding: 10px 10px 15px 15px">
<a href="http://ipython.org/"><img src="../_static/logo.png" border="0" alt="IPython Documentation"/></a>
</div>

    <div class="related">
      <h3>Navigation</h3>
      <ul>
        <li class="right" style="margin-right: 10px">
          <a href="../genindex.html" title="General Index"
             accesskey="I">index</a></li>
        <li class="right" >
          <a href="../py-modindex.html" title="Python Module Index"
             >modules</a> |</li>
        <li class="right" >
          <a href="pycompat.html" title="Writing code for Python 2 and 3"
             accesskey="N">next</a> |</li>
        <li class="right" >
          <a href="parallel_connections.html" title="Connection Diagrams of The IPython ZMQ Cluster"
             accesskey="P">previous</a> |</li>
        <li><a href="http://ipython.org">home</a>|&nbsp;</li>
        <li><a href="../search.html">search</a>|&nbsp;</li>
       <li><a href="../index.html">documentation </a> &raquo;</li>

          <li><a href="index.html" accesskey="U">IPython developer&#8217;s guide</a> &raquo;</li> 
      </ul>
    </div>

      <div class="sphinxsidebar">
        <div class="sphinxsidebarwrapper">
  <h4>Previous topic</h4>
  <p class="topless"><a href="parallel_connections.html"
                        title="previous chapter">Connection Diagrams of The IPython ZMQ Cluster</a></p>
  <h4>Next topic</h4>
  <p class="topless"><a href="pycompat.html"
                        title="next chapter">Writing code for Python 2 and 3</a></p>
  <h3>This Page</h3>
  <ul class="this-page-menu">
    <li><a href="../_sources/development/lexer.txt"
           rel="nofollow">Show Source</a></li>
  </ul>
<div id="searchbox" style="display: none">
  <h3>Quick search</h3>
    <form class="search" action="../search.html" method="get">
      <input type="text" name="q" />
      <input type="submit" value="Go" />
      <input type="hidden" name="check_keywords" value="yes" />
      <input type="hidden" name="area" value="default" />
    </form>
    <p class="searchtip" style="font-size: 90%">
    Enter search terms or a module, class or function name.
    </p>
</div>
<script type="text/javascript">$('#searchbox').show(0);</script>
        </div>
      </div>

    <div class="document">
      <div class="documentwrapper">
        <div class="bodywrapper">
          <div class="body">
            
  <div class="section" id="new-ipython-console-lexer">
<span id="console-lexer"></span><h1>New IPython Console Lexer<a class="headerlink" href="#new-ipython-console-lexer" title="Permalink to this headline">¶</a></h1>
<div class="versionadded">
<p><span class="versionmodified">New in version 2.0.0.</span></p>
</div>
<p>The IPython console lexer has been rewritten and now supports tracebacks
and customized input/output prompts. An entire suite of lexers is now
available at <a class="reference internal" href="../api/generated/IPython.nbconvert.utils.lexers.html#module-IPython.nbconvert.utils.lexers" title="IPython.nbconvert.utils.lexers"><tt class="xref py py-mod docutils literal"><span class="pre">IPython.nbconvert.utils.lexers</span></tt></a>. These include:</p>
<dl class="docutils">
<dt>IPythonLexer &amp; IPython3Lexer</dt>
<dd>Lexers for pure IPython (python + magic/shell commands)</dd>
<dt>IPythonPartialTracebackLexer &amp; IPythonTracebackLexer</dt>
<dd>Supports 2.x and 3.x via the keyword <cite>python3</cite>. The partial traceback
lexer reads everything but the Python code appearing in a traceback.
The full lexer combines the partial lexer with an IPython lexer.</dd>
<dt>IPythonConsoleLexer</dt>
<dd>A lexer for IPython console sessions, with support for tracebacks.
Supports 2.x and 3.x via the keyword <cite>python3</cite>.</dd>
<dt>IPyLexer</dt>
<dd>A friendly lexer which examines the first line of text and from it,
decides whether to use an IPython lexer or an IPython console lexer.
Supports 2.x and 3.x via the keyword <cite>python3</cite>.</dd>
</dl>
<p>Previously, the <tt class="xref py py-class docutils literal"><span class="pre">IPythonConsoleLexer</span></tt> class was available at
<tt class="xref py py-mod docutils literal"><span class="pre">IPython.sphinxext.ipython_console_hightlight</span></tt>.  It was inserted
into Pygments&#8217; list of available lexers under the name <cite>ipython</cite>.  It should
be mentioned that this name is inaccurate, since an IPython console session
is not the same as IPython code (which itself is a superset of the Python
language).</p>
<p>Now, the Sphinx extension inserts two console lexers into Pygments&#8217; list of
available lexers. Both are IPyLexer instances under the names: <cite>ipython</cite> and
<cite>ipython3</cite>. Although the names can be confusing (as mentioned above), their
continued use is, in part, to maintain backwards compatibility and to
aid typical usage. If a project needs to make Pygments aware of more than just
the IPyLexer class, then one should not make the IPyLexer class available under
the name <cite>ipython</cite> and use <cite>ipy</cite> or some other non-conflicting value.</p>
<p>Code blocks such as:</p>
<div class="highlight-rst"><div class="highlight"><pre><span class="p">..</span> <span class="ow">code-block</span><span class="p">::</span> ipython

    In [1]: 2**2
    Out[1]: 4
</pre></div>
</div>
<p>will continue to work as before, but now, they will also properly highlight
tracebacks.  For pure IPython code, the same lexer will also work:</p>
<div class="highlight-rst"><div class="highlight"><pre><span class="p">..</span> <span class="ow">code-block</span><span class="p">::</span> ipython

    x = &#39;&#39;.join(map(str, range(10)))
    !echo $x
</pre></div>
</div>
<p>Since the first line of the block did not begin with a standard IPython console
prompt, the entire block is assumed to consist of IPython code instead.</p>
</div>


          </div>
        </div>
      </div>
      <div class="clearer"></div>
    </div>
    <div class="related">
      <h3>Navigation</h3>
      <ul>
        <li class="right" style="margin-right: 10px">
          <a href="../genindex.html" title="General Index"
             >index</a></li>
        <li class="right" >
          <a href="../py-modindex.html" title="Python Module Index"
             >modules</a> |</li>
        <li class="right" >
          <a href="pycompat.html" title="Writing code for Python 2 and 3"
             >next</a> |</li>
        <li class="right" >
          <a href="parallel_connections.html" title="Connection Diagrams of The IPython ZMQ Cluster"
             >previous</a> |</li>
        <li><a href="http://ipython.org">home</a>|&nbsp;</li>
        <li><a href="../search.html">search</a>|&nbsp;</li>
       <li><a href="../index.html">documentation </a> &raquo;</li>

          <li><a href="index.html" >IPython developer&#8217;s guide</a> &raquo;</li> 
      </ul>
    </div>
    <div class="footer">
        &copy; Copyright The IPython Development Team.
      Last updated on Sep 02, 2015.
      Created using <a href="http://sphinx-doc.org/">Sphinx</a> 1.2.3.
    </div>
  </body>
</html>