You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
First of all thanks for this great library and conversion to typescript.
The problem is that the regex in vtt doesn't capture the first line of a multiline subtitle.
For example:
WEBVTT
00:00:00.000 --> 00:00:10.000 position:45%,line-right align:center size:35%
- Hey
- Hi
00:00:11.000 --> 00:00:20.000
- Hey
- Hi
The first caption's output is '-Hey -Hi' but the second one's is just '- Hi'.
I believe it is related to \s?.*\r?\n regex before the text group ([\s\S]*).
It matches with the first line and completely disregards it.
Explanation:
In the first caption;
`\s?' matches with the space between the times and style
.*\r?\n matches with the style and the new line
In the second caption;
`\s?' doesn't match anything because there is no space
.*\r?\n matches with - Hey because it takes every character until it comes across with a new line which also happens to be the first line of the caption.
First of all thanks for this great library and conversion to typescript.
The problem is that the regex in vtt doesn't capture the first line of a multiline subtitle.
For example:
The first caption's output is '-Hey -Hi' but the second one's is just '- Hi'.
I believe it is related to
\s?.*\r?\n
regex before the text group([\s\S]*)
.It matches with the first line and completely disregards it.
Explanation:
In the first caption;
.*\r?\n
matches with the style and the new lineIn the second caption;
.*\r?\n
matches with- Hey
because it takes every character until it comes across with a new line which also happens to be the first line of the caption.https://github.com/leranjun/subsrt-ts/blob/862a66da48ef883b328ae6ceb5e3b4627fed5f5c/lib/format/vtt.ts#L40-L42
The text was updated successfully, but these errors were encountered: