added code to prevent diary nav from dipping under 0 and soaring over the total

small-nav
chimchooree 4 years ago
parent 3a08c07f92
commit 013ad596f4

@ -47,7 +47,7 @@
<div class="body-row"> </div>
<div class="diary-entry">
<h1>weekly roundup</h1>
<h1>this week</h1>
september 27-october 3, 2020
bottle, css, git, html, regex, regular expressions, website<br>
<br>
@ -61,6 +61,7 @@ bottle, css, git, html, regex, regular expressions, website<br>
<ul>
<li>blessfrey.me's diary properly displays snippets for all articles: a header taken from the title, a truncated view of the article, the date + a place for social media share links, and a link to the article.</li>
<li>Cleaning the snippets enough to look okay and not break the page was a challenge. I used regular expressions to remove html link + header tags, <a href="https://stackoverflow.com/questions/1732348/regex-match-open-tags-except-xhtml-self-contained-tags">which is apparently a lost cause Stack Overflow users stand against daily, hourly even</a>. It's not so bad if it's not user content, and the content is pretty predictable, right?
<li>Pythex @ https://pythex.org/ is useful for checking whether your regular expression will catch your target strings</li>
<li>First command line git merge. I usually do it on the website. It's really simple - switch to the branch you're merging the second branch into, type 'git merge second-branch' (second-branch = name of the second branch obviously), and fix any conflicts.</li>
</ul>
<br>

@ -2,6 +2,15 @@
<div class="dir-row"> </div>
<div class="diary-dir">
<%
if page < 0:
page = 0
end
if page > total:
page = total
end
%>
% for i in range(max(0,page - limit), min(total,page + limit)):
% if i == page:
<b>{{i}}</b>

Loading…
Cancel
Save