2014-08-22 15:51:20 +00:00
|
|
|
# -*- coding: utf-8 -*-
|
|
|
|
from . import html_domain
|
2014-09-03 08:18:20 +00:00
|
|
|
from . import github
|
2014-08-22 15:51:20 +00:00
|
|
|
# add Odoo style to pygments
|
|
|
|
from . import odoo_pygments
|
|
|
|
|
|
|
|
from . import sphinx_monkeypatch
|
|
|
|
sphinx_monkeypatch.patch()
|
|
|
|
|
|
|
|
def setup(app):
|
|
|
|
html_domain.setup(app)
|
2014-09-03 08:18:20 +00:00
|
|
|
github.setup(app)
|
2014-08-22 15:51:20 +00:00
|
|
|
|
|
|
|
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)
|
2014-11-17 16:40:38 +00:00
|
|
|
), latex=(
|
|
|
|
lambda self, node: self.visit_admonition(node),
|
|
|
|
lambda self, node: self.depart_admonition(node)
|
2014-08-22 15:51:20 +00:00
|
|
|
))
|
|
|
|
|
|
|
|
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, l_
|
|
|
|
admonitionlabels['exercise'] = l_('Exercise')
|
2014-10-20 05:47:14 +00:00
|
|
|
|
|
|
|
# monkeypatch PHP lexer to not require <?php
|
|
|
|
from sphinx.highlighting import lexers
|
|
|
|
from pygments.lexers.web import PhpLexer
|
|
|
|
lexers['php'] = PhpLexer(startinline=True)
|