fix: require complete subtitle timing pairs for paste detection
This commit is contained in:
@@ -430,3 +430,7 @@ describe('DubPasteTranslationDialog', () => {
|
||||
it('keeps an hourless timestamp embedded in prose as plain text', () => {
|
||||
expect(detectPasteMode('Continue at 01:30.000 --> the finale')).toBe('plain');
|
||||
});
|
||||
|
||||
it('keeps an incomplete timing line as plain text', () => {
|
||||
expect(detectPasteMode('01:30.000 --> the finale')).toBe('plain');
|
||||
});
|
||||
|
||||
@@ -26,7 +26,8 @@
|
||||
// A timing line, e.g. `00:00:01,000 --> 00:00:04,500` (`.` ms separator,
|
||||
// missing leading zeros and WebVTT's hourless `00:01.000` allowed — mirrors
|
||||
// backend/services/srt_parser.py).
|
||||
const TIMING_RE = /^[^\S\n]*(?:\d{1,2}:)?[0-5]?\d:[0-5]?\d[,.]\d{1,3}[^\S\n]*-->/m;
|
||||
const TIMING_RE =
|
||||
/^[^\S\n]*(?:\d{1,2}:)?[0-5]?\d:[0-5]?\d[,.]\d{1,3}[^\S\n]*-->[^\S\n]*(?:\d{1,2}:)?[0-5]?\d:[0-5]?\d[,.]\d{1,3}/m;
|
||||
|
||||
// `1. text` / `2) text` / `[3] text` / `4 - text` / `5: text`.
|
||||
const NUMBERED_RE = /^\s*(?:\[\s*(\d{1,5})\s*\]|\(\s*(\d{1,5})\s*\)|(\d{1,5}))\s*[.):\-—]?\s+(.*)$/;
|
||||
|
||||
Reference in New Issue
Block a user