Commits

Georg Brandl  committed f6db620

Don't generate HTML modindex if no modules are present.

  • Participants
  • Parent commits fbf96a0

Comments (0)

Files changed (2)

     used to disable the anchor-link creation after headlines and
     definition links.
 
+  - Only generate a module index if there are some modules in the
+    documentation.
+
 * New and changed config values:
 
   - Added support for internationalization in generated text with the

File sphinx/builder.py

         rellinks = []
         if self.config.html_use_index:
             rellinks.append(('genindex', _('General Index'), 'I', _('index')))
-        if self.config.html_use_modindex:
+        if self.config.html_use_modindex and self.env.modules:
             rellinks.append(('modindex', _('Global Module Index'), 'M', _('modules')))
 
         self.globalcontext = dict(
 
         # the global module index
 
-        if self.config.html_use_modindex:
+        if self.config.html_use_modindex and self.env.modules:
             # the sorted list of all modules, for the global module index
             modules = sorted(((mn, (self.get_relative_uri('modindex', fn) +
                                     '#module-' + mn, sy, pl, dep))