Skip to content

Commit

Permalink
Add line break after last caption #49
Browse files Browse the repository at this point in the history
  • Loading branch information
glut23 committed May 27, 2024
1 parent e2d1f6a commit be5fd30
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 12 deletions.
24 changes: 12 additions & 12 deletions tests/test_webvtt.py
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ def test_write_captions(self):
00:00:07.000 --> 00:00:11.890
New caption text line1
New caption text line2
''').strip()
''').strip() + '\n'
)

def test_write_captions_in_srt(self):
Expand Down Expand Up @@ -167,7 +167,7 @@ def test_save_captions(self):
00:00:07.000 --> 00:00:11.890
New caption text line1
New caption text line2
''').strip()
''').strip() + '\n'
)

def test_srt_conversion(self):
Expand All @@ -189,7 +189,7 @@ def test_srt_conversion(self):
00:00:00.500 --> 00:00:07.000
Caption text #1
''').strip()
''').strip() + '\n'
)

def test_sbv_conversion(self):
Expand Down Expand Up @@ -217,7 +217,7 @@ def test_sbv_conversion(self):
00:00:11.378 --> 00:00:12.305
Caption text #2 (line 1)
Caption text #2 (line 2)
''').strip()
''').strip() + '\n'
)

def test_save_to_other_location(self):
Expand Down Expand Up @@ -453,7 +453,7 @@ def test_content_formatting(self):
00:00:08.000 --> 00:00:15.000
Caption test line 3
Caption test line 4
""").strip()
""").strip() + '\n'
)

def test_repr(self):
Expand Down Expand Up @@ -1088,7 +1088,7 @@ def test_save_file_with_bom(self):
00:00:00.500 --> 00:00:07.000
Caption text #1
''').strip()
''').strip() + '\n'
)

def test_save_file_with_bom_keeps_bom(self):
Expand All @@ -1112,7 +1112,7 @@ def test_save_file_with_bom_keeps_bom(self):
00:00:16.320 --> 00:00:21.580
Caption text #4
''').strip()
''').strip() + '\n'
)

def test_save_file_with_bom_removes_bom_if_requested(self):
Expand All @@ -1136,7 +1136,7 @@ def test_save_file_with_bom_removes_bom_if_requested(self):
00:00:16.320 --> 00:00:21.580
Caption text #4
''').strip()
''').strip() + '\n'
)

def test_save_file_with_encoding(self):
Expand All @@ -1153,7 +1153,7 @@ def test_save_file_with_encoding(self):
00:00:00.500 --> 00:00:07.000
Caption text #1
''').strip()
''').strip() + '\n'
)

def test_save_file_with_encoding_and_bom(self):
Expand All @@ -1171,7 +1171,7 @@ def test_save_file_with_encoding_and_bom(self):
00:00:00.500 --> 00:00:07.000
Caption text #1
''').strip()
''').strip() + '\n'
)

def test_save_new_file_utf_8_default_encoding_no_bom(self):
Expand All @@ -1192,7 +1192,7 @@ def test_save_new_file_utf_8_default_encoding_no_bom(self):
00:00:00.500 --> 00:00:07.000
Caption text #1
''').strip()
''').strip() + '\n'
)

def test_save_new_file_utf_8_default_encoding_with_bom(self):
Expand All @@ -1215,7 +1215,7 @@ def test_save_new_file_utf_8_default_encoding_with_bom(self):
00:00:00.500 --> 00:00:07.000
Caption text #1
''').strip()
''').strip() + '\n'
)

def test_iter_slice(self):
Expand Down
3 changes: 3 additions & 0 deletions webvtt/vtt.py
Original file line number Diff line number Diff line change
Expand Up @@ -391,6 +391,9 @@ def to_str(
])
output.extend(WebVTTCueBlock.format_lines(caption))

if not footer_comments:
output.append('')

for comment in footer_comments:
output.extend([
'',
Expand Down

0 comments on commit be5fd30

Please sign in to comment.