mirror of
https://github.com/pybricks/pybricks-api.git
synced 2026-09-12 01:24:17 +00:00
Version tags can be useful to keep track of new or updated features. This lets us hide such details in the documentation that ships with the IDE to keep it concise.
29 lines
859 B
Python
29 lines
859 B
Python
"""This directive hides the builtin directives
|
|
* versionchanged
|
|
* versionadded
|
|
* deprecated
|
|
when building documentation with the 'ide' tag.
|
|
"""
|
|
from docutils import nodes
|
|
from docutils.parsers.rst import Directive
|
|
|
|
|
|
class PybricksVersionDirective(Directive):
|
|
|
|
has_content = True
|
|
|
|
def run(self):
|
|
html = ""
|
|
node = nodes.raw('', html, format="html")
|
|
return [node]
|
|
|
|
|
|
def setup(app):
|
|
if 'ide' in app.tags.tags:
|
|
app.add_directive_to_domain('py', 'deprecated',
|
|
PybricksVersionDirective, override=True)
|
|
app.add_directive_to_domain('py', 'versionadded',
|
|
PybricksVersionDirective, override=True)
|
|
app.add_directive_to_domain('py', 'versionchanged',
|
|
PybricksVersionDirective, override=True)
|