From 7bb584845572305fe91a261b8d20762c454958fa Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?tr=C3=A9meur?=
Date: Mon, 30 Dec 2024 12:04:29 +0000
Subject: [PATCH] Show donations on index page
---
README.org | 1 +
indexgen.py | 20 ++++++++++++++++++++
2 files changed, 21 insertions(+)
diff --git a/README.org b/README.org
index 20bce55..ec5f38f 100644
--- a/README.org
+++ b/README.org
@@ -33,6 +33,7 @@ Python scripts to generate a mobile-friendly static site for tracking tcg cards
- =ownedpage=: =True= if you want a page displaying your entire collection, =False= otherwise
- =firstmasteries=: a list of decks you mastered first
- =misclink=: under ="link"=, a link to any page you choose, and under ~"text"~, text to display as the link
+ - =donations= : lists of donated decks and individual scrapbook cards
- =masscollect=: list (python dict) of series/themes being mass collected, each containing a dict which specifies =“full”= as either =True= or =False= (to show or hide a list of the total number of cards in the set) and contains at least one of ="decks"= specifying a list of decks, or ="singles"= specifying a list of individual cards
- Run the following:
#+BEGIN_SRC bash
diff --git a/indexgen.py b/indexgen.py
index a3c92b8..2bc4138 100644
--- a/indexgen.py
+++ b/indexgen.py
@@ -303,6 +303,26 @@ def indexgen():
content.write("\" title=\"" + str(value) + " left\"")
content.write(" loading=\"lazy\">")
content.write("
\n")
+ donations = []
+ try:
+ for deck in variables.donations["decks"]:
+ donations.append(deck + "00")
+ except:
+ pass
+ try:
+ for card in variables.donations["scrapbook"]:
+ donations.append(card)
+ except:
+ pass
+ if len(donations) > 0:
+ donations = sorted(donations)
+ content.write("donations
\n")
+ for donation in donations:
+ if donation[-2:] == "00":
+ content.write("")
+ else:
+ content.write(tcgcore.printcard(card))
+ content.write("
\n")
content.close()
skel.footerwrite(thefile)