Compare commits

...

5 Commits

Author SHA1 Message Date
ktyl 248cfb0aad update blog 2022-09-10 14:34:08 +01:00
ktyl 8223c0c6cf update blog 2022-08-14 00:51:10 +01:00
ktyl d91545c153 ensure index entries are ordered chronologically 2022-08-14 00:50:04 +01:00
ktyl 6ca4883004 update blog 2022-08-08 18:53:05 +01:00
ktyl db33cd054b fix bad closing tag 2022-07-23 16:08:48 +01:00
3 changed files with 13 additions and 3 deletions

2
blog

@ -1 +1 @@
Subproject commit 1d2751246546adfe334786124a65e995eab65b81 Subproject commit 12ceea71990c4dc255a964a809b65b1a3a2ae333

View File

@ -26,6 +26,8 @@ title_pattern = re.compile("<h1>(.+)</h1>")
posts = [p for p in posts if path_pattern.match(p)] posts = [p for p in posts if path_pattern.match(p)]
posts.reverse() posts.reverse()
links = []
# for each file we want to output an <a> tag with a relative href to the site root # for each file we want to output an <a> tag with a relative href to the site root
for path in posts: for path in posts:
m = re.match(path_pattern, path) m = re.match(path_pattern, path)
@ -45,5 +47,13 @@ for path in posts:
# clean leading directories to get the relative path we'll use for the link # clean leading directories to get the relative path we'll use for the link
url = re.sub(dir_pattern, r"\2", path) url = re.sub(dir_pattern, r"\2", path)
print(f'<li><a href="{url}">{date}{title}</a></li>') item = (date, f'<li><a href="{url}">{date}{title}</a></li>')
links.append(item)
# make sure we're properly ordered in reverse date order lol
links = sorted(links, key=lambda x: x[0])
links.reverse()
for l in links:
print(l[1])

View File

@ -17,7 +17,7 @@
<div class="page portfolio"> <div class="page portfolio">
<h1><span class="glass">Ray Tracing<span></h1> <h1><span class="glass">Ray Tracing</span></h1>
<p><span class="glass">Optics are beautiful, fascinating and fun to code!</span></p> <p><span class="glass">Optics are beautiful, fascinating and fun to code!</span></p>
<div class="wrapper"> <div class="wrapper">