From ed92c0697c0a95e09c665dec9ba076281954c7c6 Mon Sep 17 00:00:00 2001 From: Hugo van Kemenade Date: Sat, 22 Oct 2022 09:44:36 +0200 Subject: [PATCH] Infra: Only emit a category table when it has entries (#2839) Co-authored-by: Adam Turner <9087854+AA-Turner@users.noreply.github.com> --- pep_sphinx_extensions/pep_zero_generator/writer.py | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/pep_sphinx_extensions/pep_zero_generator/writer.py b/pep_sphinx_extensions/pep_zero_generator/writer.py index d4566fd05..0abd1e38a 100644 --- a/pep_sphinx_extensions/pep_zero_generator/writer.py +++ b/pep_sphinx_extensions/pep_zero_generator/writer.py @@ -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()