Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

gh-101845: pyspecific: Fix i18n for availability directive #101846

Merged
merged 1 commit into from
Feb 12, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 11 additions & 9 deletions Doc/tools/extensions/pyspecific.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@
from sphinx.environment import NoUri
from sphinx.locale import _ as sphinx_gettext
from sphinx.util import status_iterator, logging
from sphinx.util.docutils import SphinxDirective
from sphinx.util.nodes import split_explicit_title
from sphinx.writers.text import TextWriter, TextTranslator

Expand Down Expand Up @@ -119,7 +120,7 @@ def run(self):

# Support for documenting platform availability

class Availability(Directive):
class Availability(SphinxDirective):

has_content = True
required_arguments = 1
Expand All @@ -139,18 +140,19 @@ class Availability(Directive):

def run(self):
availability_ref = ':ref:`Availability <availability>`: '
avail_nodes, avail_msgs = self.state.inline_text(
availability_ref + self.arguments[0],
self.lineno)
pnode = nodes.paragraph(availability_ref + self.arguments[0],
classes=["availability"],)
n, m = self.state.inline_text(availability_ref, self.lineno)
pnode.extend(n + m)
n, m = self.state.inline_text(self.arguments[0], self.lineno)
pnode.extend(n + m)
'', *avail_nodes, *avail_msgs)
self.set_source_info(pnode)
cnode = nodes.container("", pnode, classes=["availability"])
self.set_source_info(cnode)
if self.content:
self.state.nested_parse(self.content, self.content_offset, pnode)

self.state.nested_parse(self.content, self.content_offset, cnode)
self.parse_platforms()

return [pnode]
return [cnode]

def parse_platforms(self):
"""Parse platform information from arguments
Expand Down