I am writing an extension that uses `listings` instead of `SphinxVerbatim`.
This extension extends the current translator:
def setup(app):
app.set_translator('latex', MyLaTeXTranslator)
return {
'version': '0.1',
'parallel_read_safe': True,
'parallel_write_safe': True,
}
Then I want to write another extension that adds a colored frame around the
code
from sphinx.writers.latex import LaTeXTranslator
class Translator(LaTeXTranslator):
def visit_literal_block(self, node):
return ''.join([
'foo',
super().visit_literal_block(node),
'bar'
])
def setup(app):
app.set_translator('latex', Translator)
return {
'version': '0.1',
'parallel_read_safe': True,
'parallel_write_safe': True,
}
Unfortunately this lead to an error:
sphinx.errors.ExtensionError: Translator for 'latex' already exists
Extension error:
Translator for 'latex' already exists
What is the proper way to do this?
--
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 view this discussion on the web visit
https://groups.google.com/d/msgid/sphinx-users/81fb2c56-2711-4262-89a1-02a2552d1ce5o%40googlegroups.com.