fix: preserve Huizhou title ownership across formatting

This commit is contained in:
abaishu0730 committed 2026-10-21 15:56:04 +08:00
1 parent 90b7e50036
commit 80f9bde3cb
2 files changed
+24 -3

No files matched your search

+9 -3
View File
@@ -21,10 +21,16 @@ function extractTitle(title){
if(label==='业务模式'){
const nextOrder=matches.findIndex((m,index)=>index>i&&m[1]==='订单号');
const between=nextOrder<0?[]:matches.slice(i+1,nextOrder).map(m=>m[1]);
// BPM starts the next paragraph with business mode + margin before its order number.
// Ordinary summary text remains byte-for-byte compatible with the existing extractor.
// Summary fields after a mode still belong to the current order, irrespective
// of line wrapping. Only a header with no intervening summary binds forward.
const startsParagraph=/[\n|]\s*$/.test(text.slice(0,match.index));
if(!current||nextOrder>=0&&(between.includes('毛利')||startsParagraph)){
const hasOwnSummary=between.some(label=>Object.hasOwn(summaryKeys,label));
const forward=nextOrder>=0&&!hasOwnSummary&&(between.includes('毛利')||startsParagraph);
if(current&&nextOrder>=0&&!hasOwnSummary&&!forward){
// An unmarked boundary cannot establish which adjacent order owns the mode.
current.businessModeAmbiguous=true;pendingMode=value;pendingAmbiguous=true;
}
else if(!current||forward){
if(pendingMode&&pendingMode!==value)pendingAmbiguous=true;
pendingMode=value;
}