mirror of
https://github.com/sphinx-doc/sphinx.git
synced 2025-02-25 18:55:22 -06:00
Remove "group" identifier from get_index() entries; let the template figure that out.
This commit is contained in:
@@ -189,7 +189,29 @@ class Domain(object):
|
|||||||
Return entries for the index given by *name*. If *docnames* is given,
|
Return entries for the index given by *name*. If *docnames* is given,
|
||||||
restrict to entries referring to these docnames.
|
restrict to entries referring to these docnames.
|
||||||
|
|
||||||
XXX document return format
|
The return value is a tuple of ``(content, collapse)``, where *collapse*
|
||||||
|
is a boolean that determines if sub-entries should start collapsed (for
|
||||||
|
output formats that support collapsing sub-entries).
|
||||||
|
|
||||||
|
*content* is a sequence of ``(letter, entries)`` tuples, where *letter*
|
||||||
|
is the "heading" for the given *entries*, usually the starting letter.
|
||||||
|
|
||||||
|
*entries* is a sequence of single entries, where a single entry is a
|
||||||
|
sequence ``[name, subtype, docname, anchor, extra, qualifier, descr]``.
|
||||||
|
The items in this sequence have the following meaning:
|
||||||
|
|
||||||
|
- `name` -- the name of the index entry to be displayed
|
||||||
|
- `subtype` -- sub-entry related type:
|
||||||
|
0 -- normal entry
|
||||||
|
1 -- entry with sub-entries
|
||||||
|
2 -- sub-entry
|
||||||
|
- `docname` -- docname where the entry is located
|
||||||
|
- `anchor` -- anchor for the entry within `docname`
|
||||||
|
- `extra` -- extra info for the entry
|
||||||
|
- `qualifier` -- qualifier for the description
|
||||||
|
- `descr` -- description for the entry
|
||||||
|
|
||||||
|
Qualifier and description are not rendered e.g. in LaTeX output.
|
||||||
"""
|
"""
|
||||||
return [], False
|
return [], False
|
||||||
|
|
||||||
|
|||||||
@@ -574,7 +574,6 @@ class PythonDomain(Domain):
|
|||||||
# sort out collapsable modules
|
# sort out collapsable modules
|
||||||
prev_modname = ''
|
prev_modname = ''
|
||||||
num_toplevels = 0
|
num_toplevels = 0
|
||||||
current_group = 0 # collapse group
|
|
||||||
for modname, (docname, synopsis, platforms, deprecated) in modules:
|
for modname, (docname, synopsis, platforms, deprecated) in modules:
|
||||||
if docnames and docname not in docnames:
|
if docnames and docname not in docnames:
|
||||||
continue
|
continue
|
||||||
@@ -601,19 +600,16 @@ class PythonDomain(Domain):
|
|||||||
entries[-1][1] = 1
|
entries[-1][1] = 1
|
||||||
elif not prev_modname.startswith(package):
|
elif not prev_modname.startswith(package):
|
||||||
# submodule without parent in list, add dummy entry
|
# submodule without parent in list, add dummy entry
|
||||||
current_group += 1
|
entries.append([stripped + package, 1, '', '', '', '', ''])
|
||||||
entries.append([stripped + package, 1, current_group,
|
subtype = 2
|
||||||
'', '', '', '', ''])
|
|
||||||
grouptype = 2
|
|
||||||
else:
|
else:
|
||||||
num_toplevels += 1
|
num_toplevels += 1
|
||||||
current_group += 1
|
subtype = 0
|
||||||
grouptype = 0
|
|
||||||
|
|
||||||
qualifier = deprecated and _('Deprecated') or ''
|
qualifier = deprecated and _('Deprecated') or ''
|
||||||
entries.append([stripped + modname, grouptype, current_group,
|
entries.append([stripped + modname, subtype, docname,
|
||||||
docname, 'module-' + stripped + modname,
|
'module-' + stripped + modname, platforms,
|
||||||
platforms, qualifier, synopsis])
|
qualifier, synopsis])
|
||||||
prev_modname = modname
|
prev_modname = modname
|
||||||
|
|
||||||
# apply heuristics when to collapse modindex at page load:
|
# apply heuristics when to collapse modindex at page load:
|
||||||
|
|||||||
@@ -19,6 +19,8 @@
|
|||||||
{% endblock %}
|
{% endblock %}
|
||||||
{% block body %}
|
{% block body %}
|
||||||
|
|
||||||
|
{%- set curr_group = 0 %}
|
||||||
|
|
||||||
<h1>{{ indextitle }}</h1>
|
<h1>{{ indextitle }}</h1>
|
||||||
|
|
||||||
<div class="modindex-jumpbox">
|
<div class="modindex-jumpbox">
|
||||||
@@ -33,11 +35,12 @@
|
|||||||
<tr class="pcap"><td></td><td> </td><td></td></tr>
|
<tr class="pcap"><td></td><td> </td><td></td></tr>
|
||||||
<tr class="cap"><td></td><td><a name="cap-{{ letter }}">
|
<tr class="cap"><td></td><td><a name="cap-{{ letter }}">
|
||||||
<strong>{{ letter }}</strong></a></td><td></td></tr>
|
<strong>{{ letter }}</strong></a></td><td></td></tr>
|
||||||
{%- for (name, grouptype, group, page, anchor, extra, qualifier, description)
|
{%- for (name, grouptype, page, anchor, extra, qualifier, description)
|
||||||
in entries %}
|
in entries %}
|
||||||
<tr{% if grouptype == 2 %} class="cg-{{ cgroup }}"{% endif %}>
|
{%- if grouptype == 1 %}{% set curr_group = curr_group + 1 %}{% endif %}
|
||||||
|
<tr{% if grouptype == 2 %} class="cg-{{ curr_group }}"{% endif %}>
|
||||||
<td>{% if grouptype == 1 -%}
|
<td>{% if grouptype == 1 -%}
|
||||||
<img src="{{ pathto('_static/minus.png', 1) }}" id="toggle-{{ group }}"
|
<img src="{{ pathto('_static/minus.png', 1) }}" id="toggle-{{ curr_group }}"
|
||||||
class="toggler" style="display: none" alt="-" />
|
class="toggler" style="display: none" alt="-" />
|
||||||
{%- endif %}</td>
|
{%- endif %}</td>
|
||||||
<td>{% if grouptype == 2 %} {% endif %}
|
<td>{% if grouptype == 2 %} {% endif %}
|
||||||
|
|||||||
@@ -262,10 +262,13 @@ class LaTeXTranslator(nodes.NodeVisitor):
|
|||||||
ret.append('\\indexspace\n')
|
ret.append('\\indexspace\n')
|
||||||
ret.append('\\bigletter{%s}\n' % letter)
|
ret.append('\\bigletter{%s}\n' % letter)
|
||||||
for entry in entries:
|
for entry in entries:
|
||||||
if not entry[4]:
|
if not entry[3]:
|
||||||
continue
|
continue
|
||||||
ret.append('\\item {\\texttt{%s}}, \\pageref{%s}' %
|
ret.append('\\item {\\texttt{%s}}' % self.encode(entry[0]))
|
||||||
(self.encode(entry[0]), entry[4]))
|
if entry[4]:
|
||||||
|
# add "extra" info
|
||||||
|
ret.append(' \\emph{(%s)}' % self.encode(entry[4]))
|
||||||
|
ret.append(', \\pageref{%s}' % self.idescape(entry[3]))
|
||||||
ret.append('\\end{theindex}\n')
|
ret.append('\\end{theindex}\n')
|
||||||
|
|
||||||
ret = []
|
ret = []
|
||||||
@@ -968,6 +971,7 @@ class LaTeXTranslator(nodes.NodeVisitor):
|
|||||||
try:
|
try:
|
||||||
next = node.parent[parindex+1]
|
next = node.parent[parindex+1]
|
||||||
if isinstance(next, nodes.section):
|
if isinstance(next, nodes.section):
|
||||||
|
# postpone the label until after the sectioning command
|
||||||
self.next_section_target = node['refid']
|
self.next_section_target = node['refid']
|
||||||
return
|
return
|
||||||
except IndexError:
|
except IndexError:
|
||||||
|
|||||||
@@ -87,7 +87,8 @@ def test_latex(app):
|
|||||||
stdout, stderr = p.communicate()
|
stdout, stderr = p.communicate()
|
||||||
if p.returncode != 0:
|
if p.returncode != 0:
|
||||||
print stdout
|
print stdout
|
||||||
|
print stderr
|
||||||
del app.cleanup_trees[:]
|
del app.cleanup_trees[:]
|
||||||
assert False, 'latex exited with error'
|
assert False, 'latex exited with return code %s' % p.returncode
|
||||||
finally:
|
finally:
|
||||||
os.chdir(cwd)
|
os.chdir(cwd)
|
||||||
|
|||||||
Reference in New Issue
Block a user