Skip to content

Commit

Permalink
Infra: Only emit a category table when it has entries (python#2839)
Browse files Browse the repository at this point in the history
Co-authored-by: Adam Turner <9087854+AA-Turner@users.noreply.github.com>
  • Loading branch information
hugovk and AA-Turner authored Oct 22, 2022
1 parent 18b3870 commit ed92c06
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions pep_sphinx_extensions/pep_zero_generator/writer.py
Original file line number Diff line number Diff line change
Expand Up @@ -144,9 +144,14 @@ def write_pep0(self, peps: list[PEP], header: str = HEADER, intro: str = INTRO,
]
for (category, peps_in_category) in pep_categories:
# For sub-indices, only emit categories with entries.
# For PEP 0, emit every category
if is_pep0 or len(peps_in_category) > 0:
# For PEP 0, emit every category, but only with a table when it has entries.
if len(peps_in_category) > 0:
self.emit_pep_category(category, peps_in_category)
elif is_pep0:
# emit the category with no table
self.emit_subtitle(category)
self.emit_text("None.")
self.emit_newline()

self.emit_newline()

Expand Down

0 comments on commit ed92c06

Please sign in to comment.