mirror of
https://github.com/ksyasuda/SubMiner.git
synced 2026-09-01 12:15:27 -07:00
fix(anki): close trailing Senren markup
This commit is contained in:
@@ -394,6 +394,24 @@ test('Senren merge closes unclosed group spans so later scenes stay siblings', a
|
|||||||
assert.equal(openTags, closeTags);
|
assert.equal(openTags, closeTags);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
test('Senren merge closes unclosed trailing markup before appending later scenes', async () => {
|
||||||
|
const { collaborator } = createCollaborator({ fieldGroupingProvider: 'senren' });
|
||||||
|
|
||||||
|
const merged = await collaborator.computeFieldGroupingMergedFields(
|
||||||
|
300,
|
||||||
|
200,
|
||||||
|
makeNote(300, { miscInfo: 'leading<span class="highlight">tail' }),
|
||||||
|
makeNote(200, { miscInfo: '<span class="group">next</span>' }),
|
||||||
|
false,
|
||||||
|
);
|
||||||
|
|
||||||
|
assert.equal(
|
||||||
|
merged.miscInfo,
|
||||||
|
'<span class="group">leading<span class="highlight">tail</span></span>' +
|
||||||
|
'<span class="group">next</span>',
|
||||||
|
);
|
||||||
|
});
|
||||||
|
|
||||||
test('Kiku merge clears SentenceFurigana when either note lacks it', async () => {
|
test('Kiku merge clears SentenceFurigana when either note lacks it', async () => {
|
||||||
const { collaborator } = createCollaborator();
|
const { collaborator } = createCollaborator();
|
||||||
|
|
||||||
|
|||||||
@@ -441,7 +441,7 @@ export class FieldGroupingMergeCollaborator {
|
|||||||
// markup) so the following scenes are siblings rather than nested inside it.
|
// markup) so the following scenes are siblings rather than nested inside it.
|
||||||
entries.push(`${value.slice(entryStart)}${'</span>'.repeat(depth)}`);
|
entries.push(`${value.slice(entryStart)}${'</span>'.repeat(depth)}`);
|
||||||
} else {
|
} else {
|
||||||
pushUngrouped(value.slice(cursor));
|
pushUngrouped(`${value.slice(cursor)}${'</span>'.repeat(depth)}`);
|
||||||
}
|
}
|
||||||
return entries;
|
return entries;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user