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

Uli Fouquet uli at gnufix.de
Mon Aug 4 22:37:45 EDT 2008

Hi Vincent,

Vincent Fretin wrote:

> 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

Import of ``pygments_directive`` should be sufficient, if you only want
syntax highlighting in general.

> 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.

Yup. As Sylvain already explained (thanks!) this is a known bug of the
docutils 0.4 packaging. He already told, how to fix that in

> 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
> lib/python2.4/site-packages/docutils-0.5-py2.4.egg/roman.py
> The docutils dependency version should be updated to 0.5, and a new
> release of ulif.rest should be made, no?

You've been lucky :-) I assume you haven't used other special directives
like `versionadded` or the like. Mainly thanks to Lea Wiemann there was
a major (and smart) rewrite of the directive registering API with the
0.5 version of docutils and most stuff of current ``ulif.rest`` should
break with docutils 0.5.

Therefore it is unfortunately not as simple as just bumping the
dependency number :-/

I'd like to adapt ``ulif.rest`` to docutils 0.5 after this year's GSOC,
because the new API is really an improvement IMHO.

Kind regards,


-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 191 bytes
Desc: Dies ist ein digital signierter Nachrichtenteil
Url : http://mail.zope.org/pipermail/grok-dev/attachments/20080805/4f9b913c/attachment-0001.bin

More information about the Grok-dev mailing list