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

@ -197,7 +197,7 @@ that use Sphinx' HTMLWriter class.
.. confval:: html_last_updated_fmt
If this is not the empty string, a 'Last updated on:' timestamp is inserted
at every page bottom, using the given :func:`strftime` format. Default is
at every page bottom, using the given :func:`strftime` format. Default is
``'%b %d, %Y'``.
.. confval:: html_use_smartypants
@ -223,7 +223,7 @@ that use Sphinx' HTMLWriter class.
dictionary that maps document names to template names.
Example::
html_additional_pages = {
'download': 'customdownload.html',
}
@ -238,7 +238,7 @@ that use Sphinx' HTMLWriter class.
you used this feature, migrate it by adding an ``'index'`` key to this
setting, with your custom template as the value, and in your custom
template, use ::
{% extend "defindex.html" %}
{% block tables %}
... old template content ...
@ -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,18 +411,20 @@ class StandaloneHTMLBuilder(Builder):
# the global general 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))
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))
genindexcontext = dict(
genindexentries = self.env.index,
genindexcounts = indexcounts,
)
self.info(' genindex', nonl=1)
self.handle_page('genindex', genindexcontext, 'genindex.html')
genindexcontext = dict(
genindexentries = self.env.index,
genindexcounts = indexcounts,
)
self.info(' genindex', nonl=1)
self.handle_page('genindex', genindexcontext, 'genindex.html')
# the global module 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 %}