Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
38 changes: 38 additions & 0 deletions docs/source/_templates/genindex.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
{% extends "!genindex.html" %}

{# check sphinx/themes/basic/genindex:sidebartitle if this snippet has become outdated #}

{% block body %}

<h1 id="index">{{ _('Index') }}</h1>

<div class="genindex-jumpbox">
{% for key, dummy in genindexentries -%}
<a href="#{{ key }}"><strong>{{ key }}</strong></a>
{% if not loop.last %}| {% endif %}
{%- endfor %}
</div>

{%- for key, entries in genindexentries %}
<h2 id="{{ key }}">{{ key }}</h2>
<table style="width: 100%" class="indextable genindextable"><tr>
{%- for column in entries|slice_index(2) if column %}
<td style="width: 33%; vertical-align: top;"><ul>
{%- for entryname, (links, subitems, _) in column %}
{% set name = links[0][1].rsplit('#', 1)[1] if links else '' %}
<li>{{ indexentries(name if name and '-' not in name else entryname, links) }}
{%- if subitems %}
<ul>
{%- for subentryname, subentrylinks in subitems %}
{% set sname = subentrylinks[0][1].rsplit('#', 1)[1] if subentrylinks else '' %}
<li>{{ indexentries(sname if sname and '-' not in sname else subentryname, subentrylinks) }}</li>
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is very hacky, but I know better than to dive into Sphinx internals :-)

Is there a way we can customize what autofunction etc puts in the index? If so that would be significantly more elegant...

{%- endfor %}
</ul>
{%- endif -%}</li>
{%- endfor %}
</ul></td>
{%- endfor %}
</tr></table>
{% endfor %}

{% endblock %}
1 change: 1 addition & 0 deletions docs/source/index.rst
Original file line number Diff line number Diff line change
Expand Up @@ -86,6 +86,7 @@ Vital statistics:
contributing.rst
releasing.rst
code-of-conduct.rst
genindex

====================
Indices and tables
Expand Down