diff --git a/src/views.rs b/src/views.rs index 4617ae9..30aeb30 100644 --- a/src/views.rs +++ b/src/views.rs @@ -17,6 +17,23 @@ pub fn esc(s: &str) -> String { o } +/// Strip HTML/math to a short plain string, for title attributes. +fn plain(s: &str) -> String { + let mut out = s.replace("$$", " ").replace("\\(", " ").replace("\\)", " "); + loop { + match out.find('<') { + Some(i) => match out[i..].find('>') { + Some(j) => { + out.replace_range(i..i + j + 1, ""); + } + None => break, + }, + None => break, + } + } + out.chars().take(80).collect() +} + /// Render question body HTML stored in the DB. The importer sanitizes at write /// time; this re-sanitizes on read so a hand-edited row can never inject a /// script. Only the sanitizer's allowlist survives — see @@ -465,7 +482,22 @@ pub fn build(ctx: &Ctx, user: &str, blocks: Vec, _form: &BuildForm let body = format!( r#"

Prepare a JEE Main test

-

Build a paper from the chapters you choose. {available} authentic JEE Main PYQs in the bank.

+

Build your own paper from the chapters you choose, or take an actual JEE Main paper year by year. {available} authentic PYQs in the bank.

+ + +
+
+ Build your own paper + Chapters you choose, or the complete syllabus +
+
+ Previous year paper + An actual JEE Main paper: pick the year and shift +
+
+ + +

Selects every chapter in all three subjects. You can still remove any you don't want.

@@ -498,6 +530,7 @@ pub fn build(ctx: &Ctx, user: &str, blocks: Vec, _form: &BuildForm
+
@@ -509,84 +542,60 @@ pub fn build(ctx: &Ctx, user: &str, blocks: Vec, _form: &BuildForm
{picker}
- - -
-
- DIFFICULTY -
- - - -
-
- -
- YEARS -
- - - - - - - - -
-
-
- - -
-
-
- - -
- -
- - -
- - -
- - {e} - -
-
- 0 chapters selected - Pick chapters above -
- -
-
+ + + +