Hi, >Can I somehow derive a new node from an existing node without killing >the original visit/depart functions?
How about subclassing a Translator class? You can get original implementation with calling super() function. And you can use custom translators with app.set_translator() API. Thanks, Takeshi KOMIYA 2018年9月21日(金) 7:28 Matthias Geier <[email protected]>: > > Dear Sphinx experts. > > I've asked this already a few years ago > (https://groups.google.com/forum/#!topic/sphinx-dev/0chv7BsYuW0) but I > didn't get an answer. > > Now I'm having a very similar problem again and I thought I'll try asking > again. > > I know that I can create new nodes and register visit/depart functions > with app.add_node(). > > But instead of a completely new node, I would like to use an existing > node, I just need additional custom visit/depart functions that are > called in addition to the original visit/depart functions. > In fact, I would like to get the original visit/depart functions for > HTML output and my own custom functions for LaTeX output. > > In my concrete case I would like to use docutils.nodes.container nodes > specifying a "classes" argument to select CSS classes that will be > used in the HTML renderer. > But for LaTeX output I need to add some more stuff in the visit/depart > functions. > > If I derive my own class from docutils.nodes.container and register it > with app.add_node(), the CSS classes are not added to the HTML output, > because apparently the original visit/depart functions are not > executed in that case. > > Can I somehow derive a new node from an existing node without killing > the original visit/depart functions? > > cheers, > Matthias > > -- > 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 https://groups.google.com/group/sphinx-users. > For more options, visit https://groups.google.com/d/optout. -- 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 https://groups.google.com/group/sphinx-users. For more options, visit https://groups.google.com/d/optout.
