19.0 vanilla

This commit is contained in:
Ernad Husremovic 2025-10-03 18:07:25 +02:00
parent 0a7ae8db93
commit 991d2234ca
416 changed files with 646602 additions and 300844 deletions

View 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)