[Python-checkins] r63559 - in doctools/trunk: CHANGES doc/config.rst sphinx/builder.py sphinx/config.py sphinx/quickstart.py sphinx/templates/layout.html
georg.brandl
python-checkins at python.org
Fri May 23 16:01:54 CEST 2008
Author: georg.brandl
Date: Fri May 23 16:01:53 2008
New Revision: 63559
Log:
Add html_use_index flag.
Modified:
doctools/trunk/CHANGES
doctools/trunk/doc/config.rst
doctools/trunk/sphinx/builder.py
doctools/trunk/sphinx/config.py
doctools/trunk/sphinx/quickstart.py
doctools/trunk/sphinx/templates/layout.html
Modified: doctools/trunk/CHANGES
==============================================================================
--- doctools/trunk/CHANGES (original)
+++ doctools/trunk/CHANGES Fri May 23 16:01:53 2008
@@ -11,6 +11,9 @@
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
----------
Modified: doctools/trunk/doc/config.rst
==============================================================================
--- doctools/trunk/doc/config.rst (original)
+++ doctools/trunk/doc/config.rst Fri May 23 16:01:53 2008
@@ -197,7 +197,7 @@
.. 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 @@
dictionary that maps document names to template names.
Example::
-
+
html_additional_pages = {
'download': 'customdownload.html',
}
@@ -238,7 +238,7 @@
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 @@
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
Modified: doctools/trunk/sphinx/builder.py
==============================================================================
--- doctools/trunk/sphinx/builder.py (original)
+++ doctools/trunk/sphinx/builder.py Fri May 23 16:01:53 2008
@@ -337,6 +337,7 @@
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 @@
# 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))
-
- genindexcontext = dict(
- genindexentries = self.env.index,
- genindexcounts = indexcounts,
- )
- self.info(' genindex', nonl=1)
- self.handle_page('genindex', genindexcontext, 'genindex.html')
+ 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')
# the global module index
Modified: doctools/trunk/sphinx/config.py
==============================================================================
--- doctools/trunk/sphinx/config.py (original)
+++ doctools/trunk/sphinx/config.py Fri May 23 16:01:53 2008
@@ -56,6 +56,7 @@
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),
Modified: doctools/trunk/sphinx/quickstart.py
==============================================================================
--- doctools/trunk/sphinx/quickstart.py (original)
+++ doctools/trunk/sphinx/quickstart.py Fri May 23 16:01:53 2008
@@ -132,6 +132,9 @@
# 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
Modified: doctools/trunk/sphinx/templates/layout.html
==============================================================================
--- doctools/trunk/sphinx/templates/layout.html (original)
+++ doctools/trunk/sphinx/templates/layout.html Fri May 23 16:01:53 2008
@@ -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 %}
More information about the Python-checkins
mailing list