documentation/extensions/exercise_admonition/__init__.py
Victor Feyens 2ddac026f1 [FIX] extensions: support parallel read
Now that patchqueue was removed, we can consider supporting the parallel 
read with our local extensions.

Since we only have basic extensions, not storing any data on the build 
environment, the change mainly consists of specifying the extensions as 
parallelizable.

The only specific case is the html domain, since the base html domain 
requires the support of the method merge_domaindata in parallel read 
mode.  Since we do not need to share anything between the envs for this 
extension, we can simply ignore the method.
2021-05-19 15:03:39 +02:00

30 lines
674 B
Python

""" Add a new "exercise" admonition directive. """
from docutils import nodes
from docutils.parsers.rst.directives import admonitions
from sphinx.locale import admonitionlabels
class exercise(nodes.Admonition, nodes.Element):
pass
class Exercise(admonitions.BaseAdmonition):
node_class = exercise
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),
))
return {
'parallel_read_safe': True,
'parallel_write_safe': True
}
admonitionlabels['exercise'] = 'Exercise'