[Grok-dev] Re: Using pygments in rest with rst2html

Vincent Fretin vincent.fretin at gmail.com
Sun Aug 3 13:00:25 EDT 2008

On Sun, Aug 3, 2008 at 6:18 PM, Michael Haubenwallner <michael at d2m.at> wrote:
> Vincent Fretin wrote:
>> Hello,
>> How can I use code-block or sourcecode directive in rest and make the
>> command
>> rst2html.py mydoc.rst > mydoc.html
>> works?
>> I easy_install-ed docutils and Pygments. But I don't understand how I
>> import the special directives. I didn't find a good answer on the web.
>> Somebody know how to do it?
> The directives are included in
> http://pypi.python.org/pypi/ulif.rest

Thanks, I easy_install-ed ulif.rest
I edited bin/rst2html.py to include the three imports:
from ulif.rest import directives_plain
from ulif.rest import roles_plain
from ulif.rest import pygments_directive # for syntax-highlighting support
and I tested it:
$ rst2html.py mydoc.rst > mydoc.html
and it gave me :
File "$[sandbox}/lib/python2.4/site-packages/docutils-0.4-py2.4.egg/docutils/parsers/rst/states.py",
line 110, in ?
    import roman
ImportError: No module named roman

Indeed roman.py module is nowhere, not in the virtualenv's
site-packages, not in site-packages global directory.

Then I easy-installed docutils==0.5 and modified again bin/rst2html.py
and it works. docutils 0.5 have the roman.py module.
$ find lib/python2.4/site-packages/ -name roman.py

The docutils dependency version should be updated to 0.5, and a new
release of ulif.rest should be made, no?

Vincent Fretin

More information about the Grok-dev mailing list