From f0d5bdcd17061936c24411e1b208cc8eaaaa788e Mon Sep 17 00:00:00 2001 From: Mez Date: Sun, 24 Aug 2025 21:45:16 +0100 Subject: [PATCH] Add links to book lists from previous years --- generate.py | 16 +++++++++++++--- 1 file changed, 13 insertions(+), 3 deletions(-) diff --git a/generate.py b/generate.py index fead97a..d280b66 100644 --- a/generate.py +++ b/generate.py @@ -1223,7 +1223,7 @@ def thisyearworkbooks(theyear=datetime.today().year): def booksfrontpage(): bookindex = open("build/books/index.html","w") - bookindex.write("\n\n \n \n \n praze • Books\n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n
\n
\n
\n

Currently reading

\n
    \n") + bookindex.write("\n\n \n \n \n praze • Books\n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n
    \n
    \n
    \n

    Book tracker

    \n

    Currently reading

    \n
      \n") for book in books: if not book["work"]: if len(book["progressdates"]) > 0: @@ -1247,7 +1247,17 @@ def booksfrontpage(): bookindex.write("

      + 1 work-related book

      \n") if len(thisyearbooks()) == 0 and thisyearworkbooks() == 0: bookindex.write("

      None yet!

      \n") - bookindex.write("
    \n
    \n \n
    \n \n\n") + bookindex.write("
\n

Previous years (data before 2014 incomplete)

\n

") + sumyear = datetime.today().year - 1 + presplit = False + while sumyear > 1993: + if len(thisyearbooks(sumyear)) > 0: + if presplit: + bookindex.write (" · ") + bookindex.write("" + str(sumyear) + " (" + str(len(thisyearbooks(sumyear)) + thisyearworkbooks(sumyear)) + ")") + presplit = True + sumyear -= 1 + bookindex.write("

\n
\n
\n \n
\n \n\n") bookindex.close() def previousyearbooks(): @@ -1257,7 +1267,7 @@ def previousyearbooks(): if not os.path.isdir("build/books/" + str(theyear)): os.mkdir("build/books/" + str(theyear)) booksyear = open("build/books/" + str(theyear) + "/index.html","w") - booksyear.write("\n\n \n \n \n praze • Books\n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n
\n
\n
\n

Books read in " + str(theyear) + "

\n
    \n") + booksyear.write("\n\n \n \n \n praze • Books\n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n
    \n
    \n
    \n

    Book tracker

    \n

    Books read in " + str(theyear) + "

    \n
      \n") for book in thisyearbooks(theyear): if book["author"] == "": booksyear.write("
    1. " + book["title"] + "
    2. \n")