1 Mar 2008 11:28
Re: Include python code block into rst?
Martin Geisler <mg <at> daimi.au.dk>
2008-03-01 10:28:55 GMT
2008-03-01 10:28:55 GMT
"G. Milde" <milde <at> users.berlios.de> writes: >> * Pass it to Pygments for HTML output. Pygments seems to handle most >> languages and does so with a good parser architecture. > > From a practical point of view, yes. However, the clean solution > (which hopefully will be in standard docutils some day) is to use > pygments (if available) to parse the content of a code block and > create a "rich" doctree node which is then is processed by the > writers... I can see how it might be easier to get uniform output in different formats if Docutils parses the code itself using Pygments, but on the other hand, then I would actually expect the LaTeX output to look different from the HTML output (e.g., only highlight with bold/italic instead of the full multi-color "fruit-salad" treatment by Pygments.) So I am very happy if the code is passed verbatim to the writer, which can then decide to include it as a literal block (I assume every writer knows about those) or highlight it in an appropriate way. > [...] > > There is, however an experimental latex writer with listings support > available: > http://docutils.sourceforge.net/sandbox/latex-variants/latex2e_listings/ Good to know, thanks for the link! -- --(Continue reading)

RSS Feed