Skip to content
Permalink
Browse files
Fix #2960 -- properly handle SHOW_INDEX_PAGE_NAVIGATION with Jinja te…
…mplates

Signed-off-by: Chris Warrick <kwpolska@gmail.com>
  • Loading branch information
Kwpolska committed Feb 15, 2018
1 parent 26703ef commit 01b92c07b05b54f4ffabf273c84a4b8bd49a95ed
@@ -28,6 +28,8 @@ Features
Bugfixes
--------

* Properly handle ``SHOW_INDEX_PAGE_NAVIGATION`` with Jinja templates
(Issue #2960)
* Prevent crashes due to Windows-specific code in ``auto`` running on
all platforms (Issue #2940)
* Don’t run hyphenate on ``<pre>`` blocks (Issue #2939)
@@ -2,7 +2,7 @@
{% macro page_navigation(current_page, page_links, prevlink, nextlink, prev_next_links_reversed, surrounding=5) %}
<div class="page-navigation">
{% for i, link in enumerate(page_links) %}
{% if abs(i - current_page) <= surrounding or i == 0 or i == page_links|length - 1 %}
{% if (i - current_page)|abs <= surrounding or i == 0 or i == page_links|length - 1 %}
{% if i == current_page %}
<span class="current-page">{{ i+1 }}</span>
{% else %}
@@ -16,7 +16,7 @@
{% endif %}
{% endif %}
{% for i, link in enumerate(page_links) %}
{% if abs(i - current_page) <= surrounding or i == 0 or i == page_links|length - 1 %}
{% if (i - current_page)|abs <= surrounding or i == 0 or i == page_links|length - 1 %}
<li {{ ' class="active"' if i == current_page else '' }}><a href="{{ link }}">{{ i + 1 }}{{ ' <span class="sr-only">(current)</span>' if i == current_page else '' }}</a></li>
{% elif i == current_page - surrounding - 1 or i == current_page + surrounding + 1 %}
<li class="disabled"><a href="#" aria-label="…"><span aria-hidden="true">…</span></a></li>
@@ -24,6 +24,7 @@
["fb: http://ogp.me/ns/fb# \\", "fb: http://ogp.me/ns/fb#"],
['dir="rtl" \\', 'dir="rtl"'],
['sorted(translations)', 'translations|sort'],
['abs(i - current_page)', '(i - current_page)|abs'],
]

dumber_replacements = [

0 comments on commit 01b92c0

Please sign in to comment.