<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>deffbeff &#187; reStructuredText</title>
	<atom:link href="http://www.deffbeff.com/blog/category/restructuredtext/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.deffbeff.com/blog</link>
	<description>Mostly software</description>
	<lastBuildDate>Thu, 03 Dec 2009 23:00:15 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.0.1</generator>
		<item>
		<title>Using Pygments with docutils</title>
		<link>http://www.deffbeff.com/blog/2009/06/using-pygments-with-docutils/</link>
		<comments>http://www.deffbeff.com/blog/2009/06/using-pygments-with-docutils/#comments</comments>
		<pubDate>Wed, 03 Jun 2009 21:56:03 +0000</pubDate>
		<dc:creator>Matthew Gilbert</dc:creator>
				<category><![CDATA[Programming]]></category>
		<category><![CDATA[html]]></category>
		<category><![CDATA[reStructuredText]]></category>
		<category><![CDATA[docutils]]></category>
		<category><![CDATA[pygments]]></category>

		<guid isPermaLink="false">http://www.deffbeff.com/blog/?p=46</guid>
		<description><![CDATA[Pygments has a very short tutorial for integrating itself with docutils here: http://pygments.org/docs/rstdirective/. However, that was not enough info to get me started using Pygments with rst2html.py. Here are the missing steps: Copy the Pygments supplied rst-directive.py to your docutils installation. Something like: cp Pygments/external/rst-directive.py \ .../site-packages/docutils/parsers/rst/directives/rst_directive.py Notice that rst-directive.py became rst_directive.py (dash changed to [...]]]></description>
			<content:encoded><![CDATA[<p>Pygments has a very short tutorial for integrating itself with docutils here: <a href="http://pygments.org/docs/rstdirective/">http://pygments.org/docs/rstdirective/</a>. However, that was not enough info to get me started using Pygments with rst2html.py. Here are the missing steps:</p>
<ol>
<li>Copy the Pygments supplied rst-directive.py to your docutils installation. Something like:
<pre>cp Pygments/external/rst-directive.py \
 .../site-packages/docutils/parsers/rst/directives/rst_directive.py</pre>
<p>Notice that rst-directive.py became rst_directive.py (dash changed to underscore). </li>
<li>Modify rst_directive.py in the docutils directives directory to set INLINESTYLES = True and add a style option to the formatter. Something like:
<pre># Set to True if you want inline CSS styles instead of classes
INLINESTYLES = True

from pygments.formatters import HtmlFormatter

# The default formatter
DEFAULT = HtmlFormatter(noclasses=INLINESTYLES, style='trac')</pre>
</li>
<li>Modify rst2html.py to import the Pygments directive. I added the following line:
<pre>from docutils.parsers.rst.directives import rst_directive</pre>
</li>
</ol>
<p>That’s it. Now I can use the ..sourcecode directive in my rst documents. For example:</p>
<pre>.. sourcecode:: c++
	int
	main(int argc, char *argv[])
	{
	}</pre>
]]></content:encoded>
			<wfw:commentRss>http://www.deffbeff.com/blog/2009/06/using-pygments-with-docutils/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>
