Fix-up genindex templates.

This commit is contained in:
Georg Brandl 2010-01-07 14:06:14 +01:00
parent f8ca88ebbd
commit c3782af6d0
3 changed files with 18 additions and 25 deletions

View File

@ -13,33 +13,26 @@
<h1 id="index">{% trans key=key %}Index &ndash; {{ key }}{% endtrans %}</h1> <h1 id="index">{% trans key=key %}Index &ndash; {{ key }}{% endtrans %}</h1>
<table width="100%" class="indextable"><tr><td width="33%" valign="top"> <table width="100%" class="indextable"><tr>
<dl> {%- for column in entries|slice(2) if column %}
{%- set breakat = count // 2 %} <td width="33%" valign="top"><dl>
{%- set numcols = 1 %} {%- for entryname, (links, subitems) in column %}
{%- set numitems = 0 %} <dt>{% if links %}<a href="{{ links[0] }}">{{ entryname|e }}</a>
{% for entryname, (links, subitems) in entries %} {%- for link in links[1:] %}, <a href="{{ link }}">[{{ loop.index }}]</a>{% endfor %}
<dt>{%- if links -%}<a href="{{ links[0] }}">{{ entryname|e }}</a> {%- else %}{{ entryname|e }}{% endif %}</dt>
{%- for link in links[1:] %}, <a href="{{ link }}">[{{ loop.index }}]</a>{% endfor -%} {%- if subitems %}
{%- else -%} <dd><dl>
{{ entryname|e }}
{%- endif -%}</dt>
{%- if subitems %}
<dd><dl>
{%- for subentryname, subentrylinks in subitems %} {%- for subentryname, subentrylinks in subitems %}
<dt><a href="{{ subentrylinks[0] }}">{{ subentryname|e }}</a> <dt><a href="{{ subentrylinks[0] }}">{{ subentryname|e }}</a>
{%- for link in subentrylinks[1:] %}, <a href="{{ link }}">[{{ loop.index }}]</a>{% endfor -%} {%- for link in subentrylinks[1:] %}, <a href="{{ link }}">[{{ loop.index }}]</a>{% endfor -%}
</dt> </dt>
{%- endfor %} {%- endfor %}
</dl></dd> </dl></dd>
{%- endif -%} {%- endif -%}
{%- set numitems = numitems + 1 + (subitems|length) -%}
{%- if numcols < 2 and numitems > breakat -%}
{%- set numcols = numcols+1 -%}
</dl></td><td width="33%" valign="top"><dl>
{%- endif -%}
{%- endfor %} {%- endfor %}
</dl></td></tr></table> </dl></td>
{%- endfor %}
</tr></table>
{% endblock %} {% endblock %}

View File

@ -15,6 +15,7 @@
<p>{{ _('Index pages by letter') }}:</p> <p>{{ _('Index pages by letter') }}:</p>
<div class="genindex-jumpbox">
<p>{% for key, dummy in genindexentries -%} <p>{% for key, dummy in genindexentries -%}
<a href="{{ pathto('genindex-' + key) }}"><strong>{{ key }}</strong></a> <a href="{{ pathto('genindex-' + key) }}"><strong>{{ key }}</strong></a>
{% if not loop.last %}| {% endif %} {% if not loop.last %}| {% endif %}
@ -22,6 +23,7 @@
<p><a href="{{ pathto('genindex-all') }}"><strong>{{ _('Full index on one page') }}</strong> <p><a href="{{ pathto('genindex-all') }}"><strong>{{ _('Full index on one page') }}</strong>
({{ _('can be huge') }})</a></p> ({{ _('can be huge') }})</a></p>
</div>
{% endblock %} {% endblock %}

View File

@ -19,8 +19,6 @@
{%- endfor %} {%- endfor %}
</div> </div>
<hr />
{%- for key, entries in genindexentries %} {%- for key, entries in genindexentries %}
<h2 id="{{ key }}">{{ key }}</h2> <h2 id="{{ key }}">{{ key }}</h2>
<table width="100%" class="indextable genindextable"><tr> <table width="100%" class="indextable genindextable"><tr>
@ -28,7 +26,7 @@
<td width="33%" valign="top"><dl> <td width="33%" valign="top"><dl>
{%- for entryname, (links, subitems) in column %} {%- for entryname, (links, subitems) in column %}
<dt>{% if links %}<a href="{{ links[0] }}">{{ entryname|e }}</a> <dt>{% if links %}<a href="{{ links[0] }}">{{ entryname|e }}</a>
{% for link in links[1:] %}, <a href="{{ link }}">[{{ loop.index }}]</a>{% endfor %} {%- for link in links[1:] %}, <a href="{{ link }}">[{{ loop.index }}]</a>{% endfor %}
{%- else %}{{ entryname|e }}{% endif %}</dt> {%- else %}{{ entryname|e }}{% endif %}</dt>
{%- if subitems %} {%- if subitems %}
<dd><dl> <dd><dl>