mirror of
https://github.com/sphinx-doc/sphinx.git
synced 2026-09-03 20:52:55 -05:00
Don't generate HTML modindex if no modules are present.
This commit is contained in:
@@ -58,6 +58,9 @@ New features added
|
||||
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
|
||||
|
||||
+2
-2
@@ -425,7 +425,7 @@ class StandaloneHTMLBuilder(Builder):
|
||||
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(
|
||||
@@ -559,7 +559,7 @@ class StandaloneHTMLBuilder(Builder):
|
||||
|
||||
# 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))
|
||||
|
||||
Reference in New Issue
Block a user