cluster variable is stored in index.py

small-nav
chimchooree 4 years ago
parent 315e4103f6
commit 896c466021

@ -121,7 +121,7 @@ def diary2():
@route('/diary/<page:int>') @route('/diary/<page:int>')
def diary(page): def diary(page):
"""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) return template('diary.tpl', info)
if __name__ == '__main__': if __name__ == '__main__':

@ -4,9 +4,6 @@
<div class="diary-dir"> <div class="diary-dir">
<center> <center>
% max_pages = int((total - 1) / limit) % max_pages = int((total - 1) / limit)
% cluster = 3
% # TRY DECIMAL POINT PAGES
<% <%
# page never below 0 # page never below 0
if page <= 0: if page <= 0:
@ -31,7 +28,7 @@
% # fill out number cluster to the left when page is high % # fill out number cluster to the left when page is high
% if page > max_pages - cluster: % if page > max_pages - cluster:
% for j in range(cluster - max_pages + page): % for j in range(cluster - max_pages + page):
<a href=/diary/{{page + j + cluster + 1}}><b><i>{{page + j + cluster + 1}}</b></i></a> <a href=/diary/{{max_pages - cluster * 2 + j}}>{{max_pages - cluster * 2 + j}}</a>
% end % end
% end % end

Loading…
Cancel
Save