Fix embarrassing point counting bug
This commit is contained in:
parent
b475e4bb8d
commit
2a2d6cd88a
@ -6,14 +6,14 @@
|
||||
#let solution_mode = { sys.inputs.at("mode", default: "") == "solution" };
|
||||
|
||||
#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)
|
||||
.after(h.location())
|
||||
.after(h.location(), inclusive: false)
|
||||
).filter(nh => nh.level <= h.level);
|
||||
|
||||
let start_value = pctr.at(h.location())
|
||||
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)
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user