[IMP] odoo_theme: add the class o_code
on literals
The SCSS that styles the `literal`, `code`, `file`, and `command` roles is excessively complex because the traduction from RST to HTML is not consistent from one role to another: some use `<code>` elements, some have the `code` class, some wrap the literal with a `span` element. This commit sets the `o_code` class on all of these roles' parent node at translation time to allow simplifying the SCSS target.
This commit is contained in:
parent
1a95d1cd6f
commit
2ef1219109
@ -137,6 +137,17 @@ class BootstrapTranslator(HTML5Translator):
|
||||
else:
|
||||
super().depart_title(node)
|
||||
|
||||
def visit_literal(self, node):
|
||||
""" Override to add the class `o_code` to all `literal`, `code`, and `file` roles. """
|
||||
node['classes'].append('o_code')
|
||||
return super().visit_literal(node)
|
||||
|
||||
def visit_literal_strong(self, node):
|
||||
""" Override to add the class `o_code` to all `command` roles. """
|
||||
if 'command' in node['classes']:
|
||||
node['classes'].append('o_code')
|
||||
return super().visit_literal_strong(node)
|
||||
|
||||
# overwritten
|
||||
# Ensure table class is present for tables
|
||||
def visit_table(self, node):
|
||||
|
Loading…
Reference in New Issue
Block a user