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

Infra: Move numerical index to own page #3992

Merged
merged 6 commits into from
Sep 26, 2024
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 @@ -63,6 +63,9 @@
def create_pep_zero(app: Sphinx, env: BuildEnvironment, docnames: list[str]) -> None:
peps = _parse_peps(Path(app.srcdir))

numerical_index_text = writer.PEPZeroWriter().write_numerical_index(peps)
subindices.update_sphinx("numerical", numerical_index_text, docnames, env)

Check warning on line 67 in pep_sphinx_extensions/pep_zero_generator/pep_index_generator.py

View check run for this annotation

Codecov / codecov/patch

pep_sphinx_extensions/pep_zero_generator/pep_index_generator.py#L66-L67

Added lines #L66 - L67 were not covered by tests

pep0_text = writer.PEPZeroWriter().write_pep0(peps, builder=env.settings["builder"])
pep0_path = subindices.update_sphinx("pep-0000", pep0_text, docnames, env)
peps.append(parser.PEP(pep0_path))
Expand Down
27 changes: 19 additions & 8 deletions pep_sphinx_extensions/pep_zero_generator/writer.py
Original file line number Diff line number Diff line change
Expand Up @@ -132,14 +132,25 @@
self.emit_text(" -")
self.emit_newline()

def write_numerical_index(self, peps: list[PEP]) -> str:
hugovk marked this conversation as resolved.
Show resolved Hide resolved
self.emit_text(".. _numerical-index:")
self.emit_newline()

Check warning on line 137 in pep_sphinx_extensions/pep_zero_generator/writer.py

View check run for this annotation

Codecov / codecov/patch

pep_sphinx_extensions/pep_zero_generator/writer.py#L136-L137

Added lines #L136 - L137 were not covered by tests

self.emit_title("Numerical Index")
self.emit_table(peps)
self.emit_newline()

Check warning on line 141 in pep_sphinx_extensions/pep_zero_generator/writer.py

View check run for this annotation

Codecov / codecov/patch

pep_sphinx_extensions/pep_zero_generator/writer.py#L139-L141

Added lines #L139 - L141 were not covered by tests

numerical_index_string = "\n".join(self.output)
return numerical_index_string

Check warning on line 144 in pep_sphinx_extensions/pep_zero_generator/writer.py

View check run for this annotation

Codecov / codecov/patch

pep_sphinx_extensions/pep_zero_generator/writer.py#L143-L144

Added lines #L143 - L144 were not covered by tests

def write_pep0(
self,
peps: list[PEP],
header: str = HEADER,
intro: str = INTRO,
is_pep0: bool = True,
builder: str = None,
):
) -> str:
if len(peps) == 0:
return ""

Expand Down Expand Up @@ -176,6 +187,12 @@
)
self.emit_newline()

# PEPs by number
if is_pep0:
self.emit_title("Numerical Index")
self.emit_text("All PEPs :ref:`sorted by number <numerical-index>`.")
hugovk marked this conversation as resolved.
Show resolved Hide resolved
self.emit_newline()

Check warning on line 194 in pep_sphinx_extensions/pep_zero_generator/writer.py

View check run for this annotation

Codecov / codecov/patch

pep_sphinx_extensions/pep_zero_generator/writer.py#L191-L194

Added lines #L191 - L194 were not covered by tests

# PEPs by category
self.emit_title("Index by Category")
meta, info, provisional, accepted, open_, finished, historical, deferred, dead = _classify_peps(peps)
Expand Down Expand Up @@ -203,12 +220,6 @@

self.emit_newline()

# PEPs by number
self.emit_title("Numerical Index")
self.emit_table(peps)

self.emit_newline()

# Reserved PEP numbers
if is_pep0:
self.emit_title("Reserved PEP Numbers")
Expand Down Expand Up @@ -264,7 +275,7 @@
self.emit_newline()
self.emit_newline()

pep0_string = "\n".join(map(str, self.output))
pep0_string = "\n".join(self.output)

Check warning on line 278 in pep_sphinx_extensions/pep_zero_generator/writer.py

View check run for this annotation

Codecov / codecov/patch

pep_sphinx_extensions/pep_zero_generator/writer.py#L278

Added line #L278 was not covered by tests
return pep0_string


Expand Down
3 changes: 2 additions & 1 deletion peps/contents.rst
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ This is an internal Sphinx page; please go to the :doc:`PEP Index <pep-0000>`.
:glob:
:caption: PEP Table of Contents (needed for Sphinx):

pep-*
api/*
numerical
pep-*
topic/*
hugovk marked this conversation as resolved.
Show resolved Hide resolved
Loading