Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
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
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
from docutils.parsers import rst

PYPA_SPEC_BASE_URL = "https://packaging.python.org/en/latest/specifications/"
TYPING_SPEC_BASE_URL = "https://typing.readthedocs.io/en/latest/spec/"
TYPING_SPEC_BASE_URL = "https://typing.python.org/en/latest/spec/"


class PEPBanner(rst.Directive):
Expand All @@ -26,16 +26,16 @@
css_classes = []

def run(self) -> list[nodes.admonition]:

if self.arguments:
link_content = self.arguments[0]
pre_text = self.admonition_pre_template.format(
link_content=link_content)
pre_text = self.admonition_pre_template.format(link_content=link_content)

Check warning on line 31 in pep_sphinx_extensions/pep_processor/parsing/pep_banner_directive.py

View check run for this annotation

Codecov / codecov/patch

pep_sphinx_extensions/pep_processor/parsing/pep_banner_directive.py#L31

Added line #L31 was not covered by tests
else:
pre_text = self.admonition_pre_text

close_button_node = nodes.paragraph('', '', nodes.Text('×'), classes=['close-button'])
close_button_node['classes'].append('close-button')
close_button_node = nodes.paragraph(

Check warning on line 35 in pep_sphinx_extensions/pep_processor/parsing/pep_banner_directive.py

View check run for this annotation

Codecov / codecov/patch

pep_sphinx_extensions/pep_processor/parsing/pep_banner_directive.py#L35

Added line #L35 was not covered by tests
"", "", nodes.Text("×"), classes=["close-button"]
)
close_button_node["classes"].append("close-button")

Check warning on line 38 in pep_sphinx_extensions/pep_processor/parsing/pep_banner_directive.py

View check run for this annotation

Codecov / codecov/patch

pep_sphinx_extensions/pep_processor/parsing/pep_banner_directive.py#L38

Added line #L38 was not covered by tests

pre_text_node = nodes.paragraph(pre_text)
pre_text_node.line = self.lineno
Expand All @@ -50,13 +50,13 @@

source_lines = [pre_text] + list(self.content or []) + [post_text]
admonition_node = self.admonition_class(
"\n".join(source_lines), classes=["pep-banner"] + self.css_classes)
"\n".join(source_lines), classes=["pep-banner"] + self.css_classes
)

admonition_node.append(pre_text_node)
admonition_node.append(close_button_node)
if self.content:
self.state.nested_parse(
self.content, self.content_offset, admonition_node)
self.state.nested_parse(self.content, self.content_offset, admonition_node)

Check warning on line 59 in pep_sphinx_extensions/pep_processor/parsing/pep_banner_directive.py

View check run for this annotation

Codecov / codecov/patch

pep_sphinx_extensions/pep_processor/parsing/pep_banner_directive.py#L59

Added line #L59 was not covered by tests
admonition_node.append(post_text_node)

return [admonition_node]
Expand All @@ -74,9 +74,7 @@
"This PEP is a historical document. "
"The up-to-date, canonical documentation can now be found elsewhere."
)
admonition_post_text = (
"See :pep:`1` for how to propose changes."
)
admonition_post_text = "See :pep:`1` for how to propose changes."
css_classes = ["canonical-doc", "sticky-banner"]


Expand Down Expand Up @@ -113,7 +111,7 @@
admonition_pre_text = admonition_pre_template
admonition_post_text = (
"See the `typing specification update process "
"<https://typing.readthedocs.io/en/latest/spec/meta.html>`__ "
"<https://typing.python.org/en/latest/spec/meta.html>`__ "
"for how to propose changes to the typing spec."
)
css_classes = ["canonical-typing-spec", "sticky-banner"]
Expand Down
2 changes: 1 addition & 1 deletion peps/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@
"py3.14": ("https://docs.python.org/3.14/", None),
"python": ("https://docs.python.org/3/", None),
"trio": ("https://trio.readthedocs.io/en/latest/", None),
"typing": ("https://typing.readthedocs.io/en/latest/", None),
"typing": ("https://typing.python.org/en/latest/", None),
}
intersphinx_disabled_reftypes = []

Expand Down
2 changes: 1 addition & 1 deletion peps/pep-0012.rst
Original file line number Diff line number Diff line change
Expand Up @@ -656,7 +656,7 @@ You can use
to other Sphinx sites,
such as the `Python documentation <https://docs.python.org/>`_
`packaging.python.org <https://packaging.python.org/>`_,
and `typing.readthedocs.io <https://typing.readthedocs.io/>`_,
and `typing.python.org <https://typing.python.org/>`_,
to easily cross-reference pages, sections and Python/C objects.

For example,
Expand Down