Hi,

This is another issue motivated by my attempt at literate programming
with noweb and sphinx.

In a typical LP setting, any block of code may contain links to other
locations in the document. In other words, within blocks of code one
can find the markup :ref:`Link title <label-name>`. If we want that
markup to be properly parsed, a code-block directive won't work, and
so I'm putting the code in a parsed-literal directive (with a
corresponding highlight directive to specify the language).

There's a problem though: *all* the inline markup inside a
parsed-literal directive is parsed, and unfortunately blocks of code
may contain any of those special characters that will produce
unintended reST inline markup ("*", "_", "`", "\", "|"). So, the
solution would be to escape those characters with a backslash. I did
it, and it seems to work ok. (Of course, those code blocks will look
ugly, but since the escaped versions are generated automatically from
clean sources, I don't suffer.)

But... now the highlighting is gone! I guess that the escape sequences
are interfering with the Pygments parser, and so it cannot highlight
those code blocks.

How can this conflict be solved? How can one have both things: cross
reference links within code blocks, and highlighted code? Ideally, I'd
like to have a kind of "restricted parsed-literal" that only parses
:ref: links and ignores other markup. Or perhaps there's a way to make
Pygments see the clean, unescaped code so that its parser is not
bothered by the escape sequences.

Of course, even without the "unintended markup" issue, the code blocks
that do contain :ref: links still would be a problem for the
highlighter...

Any hints? Your help will be appreciated!


-- 
Fernando Gómez
Biblioteca "Antonio Monteiro"
INMABB (Conicet / Universidad Nacional del Sur)
Av. Alem 1253
B8000CPB Bahía Blanca, Argentina
Tel. +54 (291) 459 5116
http://inmabb.criba.edu.ar/

-- 
You received this message because you are subscribed to the Google Groups 
"sphinx-dev" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/sphinx-dev?hl=en.

Reply via email to