Skip to content

Commit a272f04

Browse files
committed
parseSrt(): allow multi-line empty lines between blocks, and test
1 parent 94f7507 commit a272f04

File tree

2 files changed

+2
-1
lines changed

2 files changed

+2
-1
lines changed

srt.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ func parseSrt(s string) []caption {
3434

3535
seq := strings.Trim(lines[i], "\r ")
3636
if seq == "" {
37-
break
37+
continue
3838
}
3939

4040
_, err := strconv.Atoi(seq)

srt_test.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,7 @@ func TestParseSrt(t *testing.T) {
3333
"00:00:10,000 --> 00:00:11,000\n" +
3434
"Subtitles By MrCool\n" +
3535
"\n" +
36+
"\n" + // NOTE make sure we allow slightly sloppy input
3637
"3\n" +
3738
"00:01:09,630 --> 00:01:11,005\n" +
3839
"No ninja!\n"

0 commit comments

Comments
 (0)