« Return to Thread: Using pygments in rest with rst2html

Re: Re: Using pygments in rest with rst2html

by Uli Fouquet :: Rate this Message:

Reply to Author | View in Thread

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

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

--
Uli



_______________________________________________
Grok-dev mailing list
Grok-dev@...
http://mail.zope.org/mailman/listinfo/grok-dev

signature.asc (198 bytes) Download Attachment

 « Return to Thread: Using pygments in rest with rst2html

LightInTheBox - Buy quality products at wholesale price!