From 896c466021ffc3921c463915f8c121840a1dcb95 Mon Sep 17 00:00:00 2001 From: chimchooree Date: Sun, 4 Oct 2020 11:04:42 -0500 Subject: [PATCH] cluster variable is stored in index.py --- src/index.py | 2 +- src/views/diary.tpl | 5 +---- 2 files changed, 2 insertions(+), 5 deletions(-) diff --git a/src/index.py b/src/index.py index c559463..7d6160f 100644 --- a/src/index.py +++ b/src/index.py @@ -121,7 +121,7 @@ def diary2(): @route('/diary/') def diary(page): """diary page""" - info = {'css': 'diary', 'title': 'blessfrey - developer diary', 'year': datetime.datetime.now(), 'snippets': list_snippets(sort_files(gather_files())), 'latest': make_latest(), 'total': len(gather_files()), 'limit': 3, 'page': page} + info = {'css': 'diary', 'title': 'blessfrey - developer diary', 'year': datetime.datetime.now(), 'snippets': list_snippets(sort_files(gather_files())), 'latest': make_latest(), 'total': len(gather_files()), 'limit': 3, 'cluster': 3, 'page': page} return template('diary.tpl', info) if __name__ == '__main__': diff --git a/src/views/diary.tpl b/src/views/diary.tpl index f8ee377..9fd8b77 100644 --- a/src/views/diary.tpl +++ b/src/views/diary.tpl @@ -4,9 +4,6 @@
% max_pages = int((total - 1) / limit) - % cluster = 3 - % # TRY DECIMAL POINT PAGES - <% # page never below 0 if page <= 0: @@ -31,7 +28,7 @@ % # fill out number cluster to the left when page is high % if page > max_pages - cluster: % for j in range(cluster - max_pages + page): - {{page + j + cluster + 1}} + {{max_pages - cluster * 2 + j}} % end % end