I have been using sphinx to document some teaching notes and it has worked 
pretty well for my needs when I generate HTML.  I have been able to make 
use of the 'container' directive to style different kinds of text blocks in 
different ways since the HTML output adds a class attribute to the 
generated div block.

However, I would like to do the same thing with latex output so I can 
generate PDF output with these text blocks as named environments (I have a 
custom style file with these environments already set up).  

However, the current latex translator/writer ignores container directives 
(the visit/depart methods just have 'pass').  My first thought is that I 
could create a subclass of LaTeXTranslator that simply implements these 
visitor methods as follows:

    def visit_container(self, node):
        self.out.append(r'\begin{')
        self.out.append(node['name'])
        self.out.append(r'}')

    def depart_container(self, node):
        self.out.append(r'\end{')
        self.out.append(node['name'])
        self.out.append(r'}')

I don't know if this is sufficient for the translator or not.

I have tried to create new translator/writer classes which seems to require 
a new builder class as well.  However, I am getting bogged down trying to 
understand how to write these classes and how to integrate them into my 
environment.

Any help or pointers would be appreciated.

Mark

-- 
You received this message because you are subscribed to the Google Groups 
"sphinx-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/sphinx-users.
For more options, visit https://groups.google.com/groups/opt_out.


Reply via email to