On Tuesday 06 April 2010 14:42:37 Georg Brandl wrote:
>   - gpg control packet
> 
> Am 06.04.2010 19:34, schrieb Roberto Alsina:
> > On Tuesday 06 April 2010 14:18:57 Georg Brandl wrote:
> >> What Pygments does is also very output-format specific.
> > 
> > And doesn't need to. Here's a version of the code block directive,
> > that's not output-format specific, if the writer can handle inline nodes
> > with classes it should work, because all it does is generate a
> > literal_block of class "code" and add styled text fragments in it.
> > 
> > http://code.google.com/p/rst2pdf/source/browse/trunk/rst2pdf/pygments_cod
> > e_block_directive.py
> 
> The LaTeX writer doesn't handle such nodes, though.

Whoa, bummer :-(

I can't claim to know LateX but the latest docutils has a different 
visit_inline than Sphinx:

    def visit_inline(self, node): # <span>, i.e. custom roles
        # insert fallback definition
        self.fallbacks['inline'] = PreambleCmds.inline
        self.out += [r'\DUrole{%s}{' % cls for cls in node['classes']]
        self.context.append('}' * (len(node['classes'])))

As far as I can follow the explanation from 
http://docutils.sourceforge.net/docs/user/latex.html that means it calls a 
macro called \DUroleCLASSARGUMENT{} which can then do things like setting a 
bold font and whatnot.

If LaTex is capable of setting bold, italic, monospaced font and foreground 
colour, then a set of such macros could be autogenerated from the pygment 
stylesheets (I create rst2pdf's stylesheets that way) thus allowing the LaTeX 
writer to process the output of the proposed codeblock directive.

Or am I way wrong (it tends to happen with me and LaTeX ;-)

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