1
0

vault backup: 2025-12-15 09:55:24
All checks were successful
Deploy Quartz site to GitHub Pages / build (push) Successful in 1m34s

This commit is contained in:
2025-12-15 09:55:24 +01:00
parent 1b03369877
commit a62d80494c
3 changed files with 428 additions and 673 deletions

File diff suppressed because it is too large Load Diff

View File

@@ -146,19 +146,18 @@ def main(root: Path, out: Path, mode: str = "anki"):
details = answer_html + "\n\n" + meta_html
# construct Anki deck name: use category if present, otherwise fallback to 'FÖRELÄSNING'
deck_suffix = category if category else "FÖRELÄSNING"
deck_name = f"Biokemi::Johan D - Tentafrågor::{deck_suffix}"
deck_suffix = category if category else "?"
deck_name = f"Biokemi::Johan D - Tentafrågor::{deck_suffix.capitalize()}"
# For Anki export, include deck as first column
rows.append((question_html, details, category, deck_name))
# write CSV with semicolon delimiter
out.parent.mkdir(parents=True, exist_ok=True)
with out.open("w", encoding="utf-8", newline="") as f:
f.write("#deck column 4\n")
f.write("#deck column:4\n")
writer = csv.writer(f, delimiter=";", quoting=csv.QUOTE_ALL)
# If exporting for Excel, add a header row matching the columns
if mode == "excel":
writer.writerow(["date", "question_number", "category", "question", "maxpoints", "question", "answer"])
#writer.writerow(["fråga", "svar", "kategori"])
for r in rows:
writer.writerow(r)