<h3>sourcecode django tag</h3>

<p>example:</p>

<fieldset class="pygments_code">
<legend class="pygments_code">HTML+Django/Jinja</legend><table class="pygmentstable"><tr><td class="linenos"><pre>1
2
3</pre></td><td class="code"><div class="pygments"><pre><span class="cp">&#x7B;%</span> <span class="k">sourcecode</span> <span class="nv">ext</span><span class="o">=</span><span class="s2">&quot;.py&quot;</span> <span class="cp">%&#x7D;</span>
print &quot;Python is cool!&quot;
<span class="cp">&#x7B;%</span> <span class="k">endsourcecode</span> <span class="cp">%&#x7D;</span>

</pre></div>
</td></tr></table></fieldset>

<ul>
    You can pass the follow types to the <strong>ext=</strong> argument:
    <li>file extension - e.g.: ext=".sh"</li>
    <li>filename - e.g.: ext="apache.conf"</li>
    <li>mimetype - e.g.: ext="text/x-python-doctest"</li>
</ul>
See also <a href="http://pygments.org/docs/lexers/" class="openinwindow">existing pygments lexers</a>.
</p>

<p>result:</p>
{% sourcecode ext=".py" %}
print "Python is cool!"
{% endsourcecode %}

<p><strong>Info:</strong></p>

<ul>
    <li>With this method the code can contain django template tags, except the sourcecode tag :)</li>
    <li>You didn't see the result in "markup preview"!</li>
</ul>

<p>more info, on PyLucid homepage: <a href="http://www.pylucid.org/permalink/309/highlight-source-code" class="openinwindow">highlight source code</a></p>