code-block directive

classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|

code-block directive

Gael Varoquaux
Hello,

I have added python-code syntax-highlighting. This feature has been hand
coded in extensions like the trac extension, or in rest2web. This leads
to variants of rest that are not compatible with docutils. I have thus
added a crude version of syntax-highlighting. The new directive follows
the trac directive:

.. code-block:: python

I have not coded support for other language than python, and the
directive default to a literal block if the language isn't python.
For the latex2e writer, where I was able to use the listings package, and
thus get free support for other languages. For the newlatex2e it is
impossible to use the listings package, as the code cannot be passed as
macro arguments (see section 5.1 of the listings manual).

This is a first draft and is probably of a lower quality then other
directive. I would like to push for inclusion of this new directive even
if it doesn't support all the features it could to regain language
compatibility with trac.

Comments on the patch are welcome.

Regards,

Gaƫl


_______________________________________________
Doc-SIG maillist  -  [hidden email]
http://mail.python.org/mailman/listinfo/doc-sig

code-block.diff (9K) Download Attachment