mirror of
https://github.com/bringout/oca-ocb-core.git
synced 2026-04-20 04:12:02 +02:00
19.0 vanilla
This commit is contained in:
parent
0a7ae8db93
commit
991d2234ca
416 changed files with 646602 additions and 300844 deletions
29
odoo-bringout-oca-ocb-base/odoo/_monkeypatches/docutils.py
Normal file
29
odoo-bringout-oca-ocb-base/odoo/_monkeypatches/docutils.py
Normal file
|
|
@ -0,0 +1,29 @@
|
|||
"""
|
||||
The docstrings can use many more roles and directives than the one
|
||||
present natively in docutils. That's because we use Sphinx to render
|
||||
them in the documentation, and Sphinx defines the "Python Domain", a set
|
||||
of additional rules and directive to understand the python language.
|
||||
|
||||
It is not desirable to add a dependency on Sphinx in community, as it is
|
||||
a *too big* dependency.
|
||||
|
||||
The following code adds a bunch of dummy elements for the missing roles
|
||||
and directives, so docutils is able to parse them with no warning.
|
||||
"""
|
||||
|
||||
import docutils.nodes
|
||||
import docutils.parsers.rst.directives.admonitions
|
||||
|
||||
|
||||
def _role_literal(name, rawtext, text, lineno, inliner, options=None, content=None):
|
||||
literal = docutils.nodes.literal(rawtext, text)
|
||||
return [literal], []
|
||||
|
||||
|
||||
def patch_module():
|
||||
for role in ('attr', 'class', 'func', 'meth', 'ref', 'const', 'samp', 'term'):
|
||||
docutils.parsers.rst.roles.register_local_role(role, _role_literal)
|
||||
|
||||
for directive in ('attribute', 'deprecated'):
|
||||
docutils.parsers.rst.directives.register_directive(
|
||||
directive, docutils.parsers.rst.directives.admonitions.Note)
|
||||
Loading…
Add table
Add a link
Reference in a new issue