Infra: Only emit a category table when it has entries (#2839)

Co-authored-by: Adam Turner <9087854+AA-Turner@users.noreply.github.com>
This commit is contained in:
Hugo van Kemenade 2022-10-22 09:44:36 +02:00 committed by GitHub
parent 18b3870e3a
commit ed92c0697c
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 7 additions and 2 deletions

View File

@ -144,9 +144,14 @@ class PEPZeroWriter:
]
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()