Compare commits

...

2 Commits

2 changed files with 7 additions and 8 deletions

View File

@ -1,13 +1,12 @@
#import "@ysec/exam:0.1.0": exam, question, reponse #import "@y-sec/exam:0.1.0": exam, question, reponse
#show: doc => exam( #show: exam(
title: "Examen en Typst", title: "Examen en Typst",
subtitle: "Y-Security - Typst Essentials", subtitle: "Y-Security - Typst Essentials",
course: "TES", course: "TES",
date: datetime(year: 2024, month: 5, day: 27), date: datetime(year: 2050, month: 1, day: 1),
author: "Maxime Augier", author: "Maxime Augier",
time: "45 minutes", time: "45 minutes",
allowed: "une page A4 (recto-verso) de résumé personnel", allowed: "une page A4 (recto-verso) de résumé personnel",
doc
) )
= Questions et Réponses = Questions et Réponses

View File

@ -6,14 +6,14 @@
#let solution_mode = { sys.inputs.at("mode", default: "") == "solution" }; #let solution_mode = { sys.inputs.at("mode", default: "") == "solution" };
#let points_counter(h) = { #let points_counter(h) = {
// Find the first heading at a level equal or higher than this one // Find the first heading at a level equal or lower (more important) than this one
let headings_after = query(selector(heading) let headings_after = query(selector(heading)
.after(h.location()) .after(h.location(), inclusive: false)
).filter(nh => nh.level <= h.level); ).filter(nh => nh.level <= h.level);
let start_value = pctr.at(h.location()) let start_value = pctr.at(h.location())
let stop_value = if headings_after.len() == 0 { pctr.final() } let stop_value = if headings_after.len() == 0 { pctr.final() }
else { pctr.at(headings_after.last().location()) } else { pctr.at(headings_after.first().location()) }
stop_value.at(0) - start_value.at(0) stop_value.at(0) - start_value.at(0)
} }
@ -29,7 +29,7 @@
#let exam(title: "Exam", course: none, date: none, class: none, #let exam(title: "Exam", course: none, date: none, class: none,
year: none, author: none, subtitle: none, indications: none, year: none, author: none, subtitle: none, indications: none,
time: none, allowed: none, doc) = { time: none, allowed: none) = doc => {
{ {
set text(font: "Montserrat") set text(font: "Montserrat")