fix: prevent heuristic split on final English-only fragment
This commit is contained in:
2
dist/bookmarklet-payload.js
vendored
2
dist/bookmarklet-payload.js
vendored
File diff suppressed because one or more lines are too long
2
dist/bookmarklet.txt
vendored
2
dist/bookmarklet.txt
vendored
File diff suppressed because one or more lines are too long
4
dist/install.html
vendored
4
dist/install.html
vendored
File diff suppressed because one or more lines are too long
9
dist/kantine-standalone.html
vendored
9
dist/kantine-standalone.html
vendored
@@ -4565,8 +4565,12 @@ body {
|
|||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
// No allergen code found!
|
// No allergen code found!
|
||||||
// If it's not the last part (or even if it is, but we highly suspect merged languages),
|
// If this is the last fragment, it contains only the English text of the final course.
|
||||||
// we use the heuristic to find the hidden split-point.
|
// 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);
|
const split = heuristicSplitEnDe(fragment);
|
||||||
enParts.push(split.enPart);
|
enParts.push(split.enPart);
|
||||||
if (split.nextDe) {
|
if (split.nextDe) {
|
||||||
@@ -4574,6 +4578,7 @@ body {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
return {
|
return {
|
||||||
de: deParts.map(p => '• ' + p).join('\n'),
|
de: deParts.map(p => '• ' + p).join('\n'),
|
||||||
|
|||||||
@@ -2524,8 +2524,12 @@
|
|||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
// No allergen code found!
|
// No allergen code found!
|
||||||
// If it's not the last part (or even if it is, but we highly suspect merged languages),
|
// If this is the last fragment, it contains only the English text of the final course.
|
||||||
// we use the heuristic to find the hidden split-point.
|
// 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);
|
const split = heuristicSplitEnDe(fragment);
|
||||||
enParts.push(split.enPart);
|
enParts.push(split.enPart);
|
||||||
if (split.nextDe) {
|
if (split.nextDe) {
|
||||||
@@ -2533,6 +2537,7 @@
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
return {
|
return {
|
||||||
de: deParts.map(p => '• ' + p).join('\n'),
|
de: deParts.map(p => '• ' + p).join('\n'),
|
||||||
|
|||||||
Reference in New Issue
Block a user