1. Georg Brandl
  2. sphinx

Commits

Jon Waltman  committed a77d71d

[texinfo] Do not add the "Index" node when there are no entries.

  • Participants
  • Parent commits 9d4d80f
  • Branches default

Comments (0)

Files changed (1)

File sphinx/writers/texinfo.py

View file
  • Ignore whitespace
                         continue
                     self.indices.append((indexcls.localname,
                                          generate(content, collapsed)))
-        self.indices.append((_('Index'), '\n@printindex ge\n'))
+        # only add the main Index if it's not empty
+        for docname in self.builder.docnames:
+            if self.builder.env.indexentries[docname]:
+                self.indices.append((_('Index'), '\n@printindex ge\n'))
+                break
 
     # this is copied from the latex writer
     # TODO: move this to sphinx.util