From 7c4b1a4009d639f14a0db56c5b81ed31c1b93a6a Mon Sep 17 00:00:00 2001 From: dev Date: Wed, 14 Oct 2026 16:30:17 +0530 Subject: [PATCH] Fix stray dollars, remove dead UI, clear selection feedback, count input Dollar fix: 5,634 questions had a lone $ before \( or $$ from the source data. fix_single_dollar now strips any orphan single $ while preserving $$..$$ display pairs; the live tablet DB was patched in place and the importer inherits the fix. UI: removed the non-functional 'previous year paper' mode card, the complete-syllabus button, the tick glyph inside filter pills, and the '2025 Syllabus' badge beside the header title. Question count pills replaced by a plain number input (5-75). Checked chapters now show a blue left-edge highlight so a second click visibly deselects; checked subtopics tint blue the same way. --- scripts/fix_math.py | 20 ++++++++--- src/views.rs | 88 ++++++++++++--------------------------------- static/style.css | 12 +++++++ 3 files changed, 49 insertions(+), 71 deletions(-) diff --git a/scripts/fix_math.py b/scripts/fix_math.py index 3017b77..f6f4fd1 100644 --- a/scripts/fix_math.py +++ b/scripts/fix_math.py @@ -124,13 +124,23 @@ def fix_delims(text: str) -> str: def fix_single_dollar(text: str) -> str: - """A lone $ on its own line is an empty fragment left where an - image-equation was stripped upstream — drop those lines.""" + """Strip stray $ left after delimiter pairing: a lone $ before \\( or + before $$, and any orphan single $ in text segments between display + pairs. Everything inside $$..$$ pairs is preserved.""" if not text or "$" not in text: return text - lines = text.split("\n") - cleaned = [ln for ln in lines if ln.strip().strip("$").strip() != "" or "$" not in ln] - return "\n".join(cleaned) + # "$ $$" -> "$$" ; "$ \\(" -> "\\(" (junk dollar stuck to real math) + text = re.sub(r"\$(\s*\$\$)", r"\1", text) + text = re.sub(r"\$(\s*\\\()", r"\1", text) + # Drop any remaining single $ in text segments; keep display pairs. + parts = text.split("$$") + out = [] + for i, part in enumerate(parts): + if i % 2 == 1: + out.append("$$" + part + "$$") + else: + out.append(part.replace("$", "")) + return "".join(out) def fix_tex_isms(text: str) -> str: diff --git a/src/views.rs b/src/views.rs index 066062d..63f3270 100644 --- a/src/views.rs +++ b/src/views.rs @@ -110,7 +110,7 @@ fn head(ctx: &Ctx, title: &str) -> String { fn nav(ctx: &Ctx, user: Option<&str>) -> String { let brand = format!( - r##"
WhalePrep2025 Syllabus