vault backup: 2025-12-09 19:47:06
All checks were successful
Deploy Quartz site to GitHub Pages / build (push) Successful in 1m45s
All checks were successful
Deploy Quartz site to GitHub Pages / build (push) Successful in 1m45s
This commit is contained in:
@@ -1,4 +1,5 @@
|
||||
import argparse
|
||||
import collections
|
||||
import http.server
|
||||
import json
|
||||
import os
|
||||
@@ -142,6 +143,11 @@ def write_note(item):
|
||||
f.write(data)
|
||||
|
||||
|
||||
def write_json(output_path, tree):
|
||||
tree_json = json.dumps(tree)
|
||||
with output_path.open("w") as f:
|
||||
f.write(tree_json)
|
||||
|
||||
def build():
|
||||
"""Build the static site."""
|
||||
print("Building...")
|
||||
@@ -157,9 +163,20 @@ def build():
|
||||
attachments_dst.symlink_to(attachments_src)
|
||||
|
||||
tree = build_tree(vault)
|
||||
tree_json = json.dumps(tree)
|
||||
with (output_dir / "index.json").open("w") as f:
|
||||
f.write(tree_json)
|
||||
write_json(output_dir / "index.json", tree)
|
||||
|
||||
# write quiz
|
||||
quiz = []
|
||||
for note in vault.get_notes_with_tag("provfråga"):
|
||||
# assuming structure content/exams/YYYY-MM-DD/Note.md
|
||||
exam_date = note.path.parent.parent.name
|
||||
quiz.append({
|
||||
"question": note.title,
|
||||
"date": exam_date,
|
||||
"number": note.path.name,
|
||||
})
|
||||
write_json(output_dir / "quiz.json", quiz)
|
||||
|
||||
|
||||
# 3. Write out each note as html
|
||||
write_note({"children": tree})
|
||||
|
||||
Reference in New Issue
Block a user