Skip to content

Commit c794534

Browse files
committed
Inline references. Remove unneeded anchors
1 parent c4fe973 commit c794534

File tree

1 file changed

+26
-39
lines changed
  • pep_sphinx_extensions/pep_zero_generator

1 file changed

+26
-39
lines changed

pep_sphinx_extensions/pep_zero_generator/writer.py

Lines changed: 26 additions & 39 deletions
Original file line numberDiff line numberDiff line change
@@ -49,16 +49,12 @@
4949

5050
intro = """\
5151
This PEP contains the index of all Python Enhancement Proposals,
52-
known as PEPs. PEP numbers are assigned by the PEP editors, and
53-
once assigned are never changed [1_]. The version control history [2_] of
52+
known as PEPs. PEP numbers are :pep:`assigned <1#pep-editors>`
53+
by the PEP editors, and once assigned are never changed. The
54+
`version control history <https://github.com/python/peps>`_ of
5455
the PEP texts represent their historical record.
5556
"""
5657

57-
references = """\
58-
.. [1] PEP 1: PEP Purpose and Guidelines
59-
.. [2] View PEP history online: https://github.com/python/peps
60-
"""
61-
6258

6359
class PEPZeroWriter:
6460
# This is a list of reserved PEP numbers. Reservations are not to be used for
@@ -100,17 +96,16 @@ def emit_column_headers(self) -> None:
10096
self.emit_pep_row({"status": ".", "type": ".", "number": "PEP", "title": "PEP Title", "authors": "PEP Author(s)"})
10197
self.emit_table_separator()
10298

103-
def emit_title(self, text: str, anchor: str, *, symbol: str = "=") -> None:
104-
self.output.append(f".. _{anchor}:\n")
99+
def emit_title(self, text: str, *, symbol: str = "=") -> None:
105100
self.output.append(text)
106101
self.output.append(symbol * len(text))
107102
self.emit_newline()
108103

109-
def emit_subtitle(self, text: str, anchor: str) -> None:
110-
self.emit_title(text, anchor, symbol="-")
104+
def emit_subtitle(self, text: str) -> None:
105+
self.emit_title(text, symbol="-")
111106

112-
def emit_pep_category(self, category: str, anchor: str, peps: list[PEP]) -> None:
113-
self.emit_subtitle(category, anchor)
107+
def emit_pep_category(self, category: str, peps: list[PEP]) -> None:
108+
self.emit_subtitle(category)
114109
self.emit_column_headers()
115110
for pep in peps:
116111
self.output.append(column_format(**pep.details(title_length=title_length)))
@@ -124,44 +119,40 @@ def write_pep0(self, peps: list[PEP]):
124119
self.emit_newline()
125120

126121
# Introduction
127-
self.emit_title("Introduction", "intro")
122+
self.emit_title("Introduction")
128123
self.emit_text(intro)
129124
self.emit_newline()
130125

131126
# PEPs by category
132-
self.emit_title("Index by Category", "by-category")
127+
self.emit_title("Index by Category")
133128
meta, info, provisional, accepted, open_, finished, historical, deferred, dead = _classify_peps(peps)
134129
pep_categories = [
135-
("Meta-PEPs (PEPs about PEPs or Processes)", "by-category-meta", meta),
136-
("Other Informational PEPs", "by-category-other-info", info),
137-
("Provisional PEPs (provisionally accepted; interface may still change)", "by-category-provisional", provisional),
138-
("Accepted PEPs (accepted; may not be implemented yet)", "by-category-accepted", accepted),
139-
("Open PEPs (under consideration)", "by-category-open", open_),
140-
("Finished PEPs (done, with a stable interface)", "by-category-finished", finished),
141-
("Historical Meta-PEPs and Informational PEPs", "by-category-historical", historical),
142-
("Deferred PEPs (postponed pending further research or updates)", "by-category-deferred", deferred),
143-
("Abandoned, Withdrawn, and Rejected PEPs", "by-category-abandoned", dead),
130+
("Meta-PEPs (PEPs about PEPs or Processes)", meta),
131+
("Other Informational PEPs", info),
132+
("Provisional PEPs (provisionally accepted; interface may still change)", provisional),
133+
("Accepted PEPs (accepted; may not be implemented yet)", accepted),
134+
("Open PEPs (under consideration)", open_),
135+
("Finished PEPs (done, with a stable interface)", finished),
136+
("Historical Meta-PEPs and Informational PEPs", historical),
137+
("Deferred PEPs (postponed pending further research or updates)", deferred),
138+
("Abandoned, Withdrawn, and Rejected PEPs", dead),
144139
]
145-
for (category, anchor, peps_in_category) in pep_categories:
146-
self.emit_pep_category(category, anchor, peps_in_category)
140+
for (category, peps_in_category) in pep_categories:
141+
self.emit_pep_category(category, peps_in_category)
147142

148143
self.emit_newline()
149144

150145
# PEPs by number
151-
self.emit_title("Numerical Index", "by-pep-number")
146+
self.emit_title("Numerical Index")
152147
self.emit_column_headers()
153-
prev_pep = 0
154148
for pep in peps:
155-
if pep.number - prev_pep > 1:
156-
self.emit_newline()
157149
self.emit_pep_row(pep.details(title_length=title_length))
158-
prev_pep = pep.number
159150

160151
self.emit_table_separator()
161152
self.emit_newline()
162153

163154
# Reserved PEP numbers
164-
self.emit_title("Reserved PEP Numbers", "reserved")
155+
self.emit_title("Reserved PEP Numbers")
165156
self.emit_column_headers()
166157
for number, claimants in sorted(self.RESERVED.items()):
167158
self.emit_pep_row({"type": ".", "status": ".", "number": number, "title": "RESERVED", "authors": claimants})
@@ -170,15 +161,15 @@ def write_pep0(self, peps: list[PEP]):
170161
self.emit_newline()
171162

172163
# PEP types key
173-
self.emit_title("PEP Types Key", "type-key")
164+
self.emit_title("PEP Types Key")
174165
for type_ in sorted(TYPE_VALUES):
175166
self.emit_text(f" {type_[0]} - {type_} PEP")
176167
self.emit_newline()
177168

178169
self.emit_newline()
179170

180171
# PEP status key
181-
self.emit_title("PEP Status Key", "status-key")
172+
self.emit_title("PEP Status Key")
182173
for status in sorted(STATUS_VALUES):
183174
# Draft PEPs have no status displayed, Active shares a key with Accepted
184175
if status in HIDE_STATUS:
@@ -195,7 +186,7 @@ def write_pep0(self, peps: list[PEP]):
195186
# PEP owners
196187
authors_dict = _verify_email_addresses(peps)
197188
max_name_len = max(len(author_name) for author_name in authors_dict)
198-
self.emit_title("Authors/Owners", "authors")
189+
self.emit_title("Authors/Owners")
199190
self.emit_author_table_separator(max_name_len)
200191
self.emit_text(f"{'Name':{max_name_len}} Email Address")
201192
self.emit_author_table_separator(max_name_len)
@@ -207,10 +198,6 @@ def write_pep0(self, peps: list[PEP]):
207198
self.emit_newline()
208199
self.emit_newline()
209200

210-
# References for introduction footnotes
211-
self.emit_title("References", "references")
212-
self.emit_text(references)
213-
214201
pep0_string = "\n".join([str(s) for s in self.output])
215202
return pep0_string
216203

0 commit comments

Comments
 (0)