fix: prevent heuristic split on final English-only fragment

This commit is contained in:
Kantine Wrapper
2026-03-05 11:56:55 +01:00
parent 8e7ec468d4
commit b66030dce5
5 changed files with 26 additions and 16 deletions

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

4
dist/install.html vendored

File diff suppressed because one or more lines are too long

View File

@@ -4565,12 +4565,17 @@ body {
}
} else {
// No allergen code found!
// If it's not the last part (or even if it is, but we highly suspect merged languages),
// we use the heuristic to find the hidden split-point.
const split = heuristicSplitEnDe(fragment);
enParts.push(split.enPart);
if (split.nextDe) {
deParts.push(split.nextDe);
// If this is the last fragment, it contains only the English text of the final course.
// It should not be split again.
if (i === parts.length - 1) {
enParts.push(fragment);
} else {
// We use the heuristic to find the hidden split-point.
const split = heuristicSplitEnDe(fragment);
enParts.push(split.enPart);
if (split.nextDe) {
deParts.push(split.nextDe);
}
}
}
}