* order of parameters to translator swapped * context['meta'] always set, defaulting to None if the document has no metadata * [3.0 prep] modifying script_files deprecated, use add_javascript / add_js_file * remove deprecated call to l_ (which was useless anyway as the documentation is not translated) Fixes #33107 closes odoo/odoo#33187 Signed-off-by: Xavier Morel (xmo) <xmo@odoo.com>
25 lines
718 B
Python
25 lines
718 B
Python
# -*- coding: utf-8 -*-
|
|
|
|
"""
|
|
Adds a new "exercise" admonition type
|
|
"""
|
|
|
|
def setup(app):
|
|
app.add_directive('exercise', Exercise)
|
|
app.add_node(exercise, html=(
|
|
lambda self, node: self.visit_admonition(node, 'exercise'),
|
|
lambda self, node: self.depart_admonition(node)
|
|
), latex=(
|
|
lambda self, node: self.visit_admonition(node),
|
|
lambda self, node: self.depart_admonition(node)
|
|
))
|
|
|
|
from docutils import nodes
|
|
from docutils.parsers.rst.directives import admonitions
|
|
class exercise(nodes.Admonition, nodes.Element): pass
|
|
class Exercise(admonitions.BaseAdmonition):
|
|
node_class = exercise
|
|
|
|
from sphinx.locale import admonitionlabels
|
|
admonitionlabels['exercise'] = 'Exercise'
|