8000 Infra: Only add Topics index to PEP 0, not topic indices (#3037) · python/peps@40f5796 · GitHub
[go: up one dir, main page]

Skip to content

Commit 40f5796

Browse files
authored
Infra: Only add Topics index to PEP 0, not topic indices (#3037)
1 parent 9fa3f36 commit 40f5796

File tree

3 files changed

+27
-12
lines changed

3 files changed

+27
-12
lines changed

pep_sphinx_extensions/pep_zero_generator/constants.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,10 @@
3535

3636
# map of topic -> additional description
3737
SUBINDICES_BY_TOPIC = {
38+
"governance": """\
39+
These PEPs detail Python's governance, including governance model proposals
40+
and selection, and the results of the annual steering council elections.
41+
""",
3842
"packaging": """\
3943
Packaging PEPs follow the `PyPA specification update process`_.
4044
They are used to propose major additions or changes to the PyPA specifications.
@@ -55,9 +59,5 @@
5559
Many recent PEPs propose changes to Python's static type system
5660
or otherwise relate to type annotations.
5761
They are listed here for reference.
58-
""",
59-
"governance": """\
60-
These PEPs detail Python's governance, including governance model proposals
61-
and selection, and the results of the annual steering council elections.
6262
""",
6363
}

pep_sphinx_extensions/pep_zero_generator/pep_index_generator.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ def create_pep_json(peps: list[parser.PEP]) -> str:
5555
def create_pep_zero(app: Sphinx, env: BuildEnvironment, docnames: list[str]) -> None:
5656
peps = _parse_peps()
5757

58-
pep0_text = writer.PEPZeroWriter().write_pep0(peps)
58+
pep0_text = writer.PEPZeroWriter().write_pep0(peps, builder=env.settings["builder"])
5959
pep0_path = subindices.update_sphinx("pep-0000", pep0_text, docnames, env)
6060
peps.append(parser.PEP(pep0_path))
6161

pep_sphinx_extensions/pep_zero_generator/writer.py

Lines changed: 22 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -118,7 +118,14 @@ def emit_pep_category(self, category: str, peps: list[PEP]) -> None:
118118
self.emit_text(" -")
119119
self.emit_newline()
120120

121-
def write_pep0(self, peps: list[PEP], header: str = HEADER, intro: str = INTRO, is_pep0: bool = True):
121+
def write_pep0(
122+
self,
123+
peps: list[PEP],
124+
header: str = HEADER,
125+
intro: str = INTRO,
126+
is_pep0: bool = True,
127+
builder: str = None,
128+
):
122129
if len(peps) == 0:
123130
return ""
124131

@@ -132,13 +139,21 @@ def write_pep0(self, peps: list[PEP], header: str = HEADER, intro: str = INTRO,
132139
self.emit_newline()
133140

134141
# PEPs by topic
135-
self.emit_title("Topics")
136-
self.emit_text("PEPs for specialist subjects are :doc:`indexed by topic <topic/index>`.")
137-
self.emit_newline()
138-
for subindex in SUBINDICES_BY_TOPIC:
139-
self.emit_text(f"* `{subindex.title()} PEPs <topic/{subindex}>`_")
142+
if is_pep0:
143+
self.emit_title("Topics")
144+
self.emit_text(
145+
"PEPs for specialist subjects are :doc:`indexed by topic <topic/index>`."
146+
)
147+
self.emit_newline()
148+
for subindex in SUBINDICES_BY_TOPIC:
149+
target = (
150+
f"topic/{subindex}.html"
151+
if builder == "html"
152+
else f"topic/{subindex}"
153+
)
154+
self.emit_text(f"* `{subindex.title()} PEPs <{target}>`_")
155+
self.emit_newline()
140156
self.emit_newline()
141-
self.emit_newline()
142157

143158
# PEPs by category
144159
self.emit_title("Index by Category")

0 commit comments

Comments
 (0)
0