Fix context duplication in pdf output

This commit is contained in:
sebastien committed 2026-10-11 20:02:11 +02:00
1 parent 370f3252ef
commit 3754c0c11a
4 files changed
+53 -37

No files matched your search

+11 -6
View File
@@ -177,17 +177,22 @@ For each retained answer, the PDF stacks the following available material:
3. The model solution from `Sol2/<label>.pdf`.
4. The same compiled answer block used for the JPEG.
Missing supplementary PDFs are skipped. Contexts can repeat for successive
questions. Each question's complete group stays together on one page; groups
Missing supplementary PDFs are skipped. Each distinct context appears only once
per student PDF, before its first retained question. Duplicate detection uses
extracted PDF text with Unicode and whitespace normalization, including contexts
stored under different filenames or validity ranges. Numbers, mathematical
symbols and case remain significant. Contexts without extractable text use a
PDF-content hash instead, so unrelated image-only contexts are not collapsed.
The same rule applies to selective redo and manual annotation modifications.
Each question's complete group stays together on one page; groups
are packed until the next would exceed the target height. An oversized group
gets its own taller page, rather than being split. Pages are raster images saved
as PDF at 100 dpi, with variable heights, not fixed A4 sheets or searchable text.
The target height is `int(max_image_width * 1.414 * 1.25)` pixels. Small white
margins are added on the left and above/below the page. The first image of each
group receives a black border and the second a blue border. These borders are
assigned by position, so they do not consistently identify question and solution
when contexts are present or supplementary files are missing.
margins are added on the left and above/below the page. The question receives
a black border and the model solution a blue border. Context and student answer
blocks receive neither border, including when supplementary files are missing.
If nothing survives filtering, `read-grouped` removes old `Concat_F` outputs and
does not create a new PDF. During a selective `--refaire` merge, saved answer