Breaking API change for QCM
This commit is contained in:
parent
7181717ba0
commit
9bf9046073
45
exam/lib.typ
45
exam/lib.typ
@ -33,26 +33,6 @@
|
||||
// Rend les réponses visibles seulement si compilé avec `--input mode=solution`
|
||||
#let solution(content) = if enable_solutions { set text(fill: olive); content } else { hide(content) }
|
||||
|
||||
#let qcm(qcm_list) = {
|
||||
//let checked_box = "☑";
|
||||
//let unchecked_box = "☐";
|
||||
let checked_box = box(stroke: black, outset: 0.2em, "X") + " ";
|
||||
let unchecked_box = box(stroke: black, outset: 0.2em, hide("X")) + " ";
|
||||
set list(marker: unchecked_box, indent: 2em)
|
||||
if enable_solutions {
|
||||
show <yes>: i => {
|
||||
show box: b => checked_box;
|
||||
set text(fill: olive);
|
||||
i
|
||||
};
|
||||
qcm_list
|
||||
} else {
|
||||
qcm_list
|
||||
}
|
||||
v(1em)
|
||||
}
|
||||
|
||||
|
||||
#let exam(title: "Exam", course: none, date: none, class: none,
|
||||
year: none, author: none, subtitle: none, indications: none,
|
||||
time: none, allowed: none) = doc => {
|
||||
@ -149,4 +129,29 @@
|
||||
|
||||
}
|
||||
|
||||
#let qcm(points: 1, question_text, qcm_list) = {
|
||||
//let checked_box = "☑";
|
||||
//let unchecked_box = "☐";
|
||||
|
||||
let checked_box = box(stroke: black, outset: 0.2em, "X") + " ";
|
||||
let unchecked_box = box(stroke: black, outset: 0.2em, hide("X")) + " ";
|
||||
set list(marker: unchecked_box, indent: 2em)
|
||||
let qcm_box = if enable_solutions {
|
||||
show <yes>: i => {
|
||||
show box: b => checked_box;
|
||||
set text(fill: olive);
|
||||
i
|
||||
};
|
||||
qcm_list
|
||||
} else {
|
||||
qcm_list
|
||||
};
|
||||
|
||||
block(breakable: false)[
|
||||
#question(points: points, question_text)
|
||||
#v(0.5em)
|
||||
#qcm_box
|
||||
]
|
||||
v(2em, weak: true)
|
||||
|
||||
}
|
||||
|
@ -1,6 +1,6 @@
|
||||
[package]
|
||||
name = "exam"
|
||||
version = "0.1.0"
|
||||
version = "0.2.0"
|
||||
entrypoint = "lib.typ"
|
||||
authors = ["Maxime Augier <max@xolus.net>"]
|
||||
license = "MIT"
|
||||
|
Loading…
Reference in New Issue
Block a user