% rebase('frame.tpl') % import re
% max_pages = int((total - 1) / limit) <% # page never below 0 if page <= 0: page = 0 end # page never over maximum if page > max_pages: page = max_pages end %> % # << is always active link pointing to 0 << % # < points to 0 if page 0 or below % if page <= 0: < % # < points to previous page otherwise % else: < % end % # fill out number cluster to the left when page is high % if max_pages > cluster and page > max_pages - cluster: % for j in range(cluster - max_pages + page): {{max_pages - cluster * 2 + j}} % end % end % # form cluster of number links around page % for i in range(max(0,page - cluster), min(max_pages + 1,page + cluster + 1)): % # bold current page number % if i == page: {{i}} % # form neighboring numbers into links % else: {{i}} % end % end % # fill out number cluster to the right when page is low % if page <= cluster - 1 and max_pages > page + cluster: % for j in range(cluster - page): {{page + j + cluster + 1}} % end % end % # > points to max if page is at or above maximum % if page >= max_pages: > % # > point to next page otherwise % else: > % end % # >> is always active link to maximum page >>
% for s in snippets[page * limit:page * limit + limit]:
{{!s[1]}}
{{!s[2]}} • % message = "Hey,+check+out+this+post:+" + s[1] + ".,+" + s[3] % message = message.replace('+','\+') % message = re.sub('\s+?','+', message) % message = message.replace('\\','') % message = re.sub('<.*?>','', message) •
% end
% max_pages = int((total - 1) / limit) <% # page never below 0 if page <= 0: page = 0 end # page never over maximum if page > max_pages: page = max_pages end %> % # << is always active link pointing to 0 << % # < points to 0 if page 0 or below % if page <= 0: < % # < points to previous page otherwise % else: < % end % # fill out number cluster to the left when page is high % if max_pages > cluster and page > max_pages - cluster: % for j in range(cluster - max_pages + page): {{max_pages - cluster * 2 + j}} % end % end % # form cluster of number links around page % for i in range(max(0,page - cluster), min(max_pages + 1,page + cluster + 1)): % # bold current page number % if i == page: {{i}} % # form neighboring numbers into links % else: {{i}} % end % end % # fill out number cluster to the right when page is low % if page <= cluster - 1 and max_pages > page + cluster: % for j in range(cluster - page): {{page + j + cluster + 1}} % end % end % # > points to max if page is at or above maximum % if page >= max_pages: > % # > point to next page otherwise % else: > % end % # >> is always active link to maximum page >>
% include diary-boxes.tpl