Add html_use_index flag.

This commit is contained in:
Georg Brandl 2008-05-23 14:01:53 +00:00
parent 0e3dd509e6
commit e93f22e84e
6 changed files with 32 additions and 14 deletions

View File

@ -11,6 +11,9 @@ New features added
classes now that override the signature got via introspection from
Python code.
* The new config value `html_use_index` can be used to switch index
generation in HTML documents off.
Bugs fixed
----------

View File

@ -248,6 +248,12 @@ that use Sphinx' HTMLWriter class.
If true, add a module index to the HTML documents. Default is ``True``.
.. confval:: html_use_index
If true, add an index to the HTML documents. Default is ``True``.
.. versionadded:: 0.5
.. confval:: html_copy_source
If true, the reST sources are included in the HTML build as

View File

@ -337,6 +337,7 @@ class StandaloneHTMLBuilder(Builder):
copyright = self.config.copyright,
style = self.config.html_style,
use_modindex = self.config.html_use_modindex,
use_index = self.config.html_use_index,
use_opensearch = self.config.html_use_opensearch,
docstitle = docstitle,
builder = self.name,
@ -410,11 +411,13 @@ class StandaloneHTMLBuilder(Builder):
# the global general index
if self.config.html_use_index:
# the total count of lines for each index letter, used to distribute
# the entries into two columns
indexcounts = []
for _, entries in self.env.index:
indexcounts.append(sum(1 + len(subitems) for _, (_, subitems) in entries))
indexcounts.append(sum(1 + len(subitems)
for _, (_, subitems) in entries))
genindexcontext = dict(
genindexentries = self.env.index,

View File

@ -56,6 +56,7 @@ class Config(object):
html_sidebars = ({}, False),
html_additional_pages = ({}, False),
html_use_modindex = (True, False),
html_use_index = (True, False),
html_copy_source = (True, False),
html_use_opensearch = ('', False),
html_file_suffix = (None, False),

View File

@ -132,6 +132,9 @@ html_last_updated_fmt = '%%b %%d, %%Y'
# If false, no module index is generated.
#html_use_modindex = True
# If false, no index is generated.
#html_use_index = True
# If true, the reST sources are included in the HTML build as _sources/<name>.
#html_copy_source = True

View File

@ -8,7 +8,9 @@
<div class="related">
<h3>Navigation</h3>
<ul>
{%- if use_index %}
<li class="right" style="margin-right: 10px"><a href="{{ pathto('genindex') }}" title="General Index" accesskey="I">index</a></li>
{%- endif %}
{%- if use_modindex %}
<li class="right"><a href="{{ pathto('modindex') }}" title="Global Module Index" accesskey="M">modules</a>{{ reldelim2 }}</li>
{%- endif %}