mirror of
https://github.com/python/cpython.git
synced 2025-08-03 16:39:00 +00:00
bpo-11233: Create availability directive for documentation (GH-9692)
Replace "Availability: xxx" with ".. availability:: xxx" in the doc. Original patch by Georg Brandl. Co-Authored-By: Georg Brandl <georg@python.org>
This commit is contained in:
parent
da2bf9f66d
commit
2d6097d027
27 changed files with 351 additions and 291 deletions
|
@ -131,6 +131,25 @@ class ImplementationDetail(Directive):
|
|||
return [pnode]
|
||||
|
||||
|
||||
# Support for documenting platform availability
|
||||
|
||||
class Availability(Directive):
|
||||
|
||||
has_content = False
|
||||
required_arguments = 1
|
||||
optional_arguments = 0
|
||||
final_argument_whitespace = True
|
||||
|
||||
def run(self):
|
||||
pnode = nodes.paragraph(classes=['availability'])
|
||||
n, m = self.state.inline_text(':ref:`Availability <availability>`: ',
|
||||
self.lineno)
|
||||
pnode.extend(n + m)
|
||||
n, m = self.state.inline_text(self.arguments[0], self.lineno)
|
||||
pnode.extend(n + m)
|
||||
return [pnode]
|
||||
|
||||
|
||||
# Support for documenting decorators
|
||||
|
||||
class PyDecoratorMixin(object):
|
||||
|
@ -401,6 +420,7 @@ def setup(app):
|
|||
app.add_role('issue', issue_role)
|
||||
app.add_role('source', source_role)
|
||||
app.add_directive('impl-detail', ImplementationDetail)
|
||||
app.add_directive('availability', Availability)
|
||||
app.add_directive('deprecated-removed', DeprecatedRemoved)
|
||||
app.add_builder(PydocTopicsBuilder)
|
||||
app.add_builder(suspicious.CheckSuspiciousMarkupBuilder)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue