From 5202f180d34aec9f87ceea828958a6382b87da93 Mon Sep 17 00:00:00 2001 From: drjones Date: Tue, 1 Sep 2026 08:43:51 -0700 Subject: [PATCH] =?UTF-8?q?Add=20WA=20Exam=20Prep=20=E2=80=94=20143=20orig?= =?UTF-8?q?inal=20questions=20(Core/Structural/Ornamental/Ag)=20with=20sco?= =?UTF-8?q?ring=20+=20explanations?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- add_wa_prep.py | 121 ++++++++++++++++++ index.html | 97 ++++++++++++++- wa_exam_data.py | 324 ++++++++++++++++++++++++++++++++++++++++++++++++ 3 files changed, 541 insertions(+), 1 deletion(-) create mode 100644 add_wa_prep.py create mode 100644 wa_exam_data.py diff --git a/add_wa_prep.py b/add_wa_prep.py new file mode 100644 index 0000000..94cc944 --- /dev/null +++ b/add_wa_prep.py @@ -0,0 +1,121 @@ +import json, sys +sys.path.insert(0, "/Users/drjones/pest-nocturne") +from wa_exam_data import WAEXAM + +p = "/Users/drjones/pest-nocturne/index.html" +s = open(p).read() + +# 1. Add WA Prep tab to VIEWS +old_views = 'const VIEWS=[["home","Suite"],["field","Field Guide"],["keys","Keys"],["house","22 Points"],["cards","Flashcards"],["exam","Exam"],["gloss","Glossary"],["wa","WA Cert"]];' +new_views = 'const VIEWS=[["home","Suite"],["field","Field Guide"],["keys","Keys"],["house","22 Points"],["cards","Flashcards"],["exam","Exam"],["gloss","Glossary"],["wa","WA Cert"],["waprep","WA Prep"]];' +assert old_views in s, "VIEWS not found" +s = s.replace(old_views, new_views) + +# 2. Add section +old_sec = '
' +new_sec = old_sec + '\n
' +assert old_sec in s, "v-wa section not found" +s = s.replace(old_sec, new_sec) + +# 3. Build the WA Prep view + quiz (self-contained) +wa_data_json = json.dumps(WAEXAM) # [{cat,q,a:[...],c,x},...] + +RENDER = r''' + + +'''.replace('__WADATA__', wa_data_json) + +s = s.rstrip() + '\n' + RENDER + '\n' + +open(p, "w").write(s) +print(f"injected WA Prep view with {len(WAEXAM)} questions; size {len(s)}") diff --git a/index.html b/index.html index ee28f26..8634001 100644 --- a/index.html +++ b/index.html @@ -358,6 +358,7 @@ mark{background:color-mix(in srgb,var(--brass) 30%,transparent); color:inherit;
+