mirror of
https://github.com/SubtitleEdit/subtitleedit.git
synced 2024-11-22 19:22:53 +01:00
Fix for colors in WebVTT - thx Caleb :)
This commit is contained in:
parent
02eeb165fc
commit
7202bd73c1
@ -767,7 +767,7 @@ namespace Nikse.SubtitleEdit.Core.SubtitleFormats
|
||||
}
|
||||
|
||||
private static readonly Regex RegexWebVttColor = new Regex(@"<c.[a-z]*>", RegexOptions.Compiled);
|
||||
private static readonly Regex RegexWebVttColorHex = new Regex(@"<c.[a-z]*\d+>", RegexOptions.Compiled);
|
||||
private static readonly Regex RegexWebVttColorHex = new Regex(@"<c.[a-z0123456789]*>", RegexOptions.Compiled);
|
||||
|
||||
internal static string ColorWebVttToHtml(string text)
|
||||
{
|
||||
@ -783,7 +783,8 @@ namespace Nikse.SubtitleEdit.Core.SubtitleFormats
|
||||
while (match.Success)
|
||||
{
|
||||
var value = match.Value.Substring(3, match.Value.Length - 4);
|
||||
if (match.Value.StartsWith("<c.color", StringComparison.Ordinal))
|
||||
if (match.Value.StartsWith("<c.color", StringComparison.Ordinal) &&
|
||||
match.Length == 15 && match.Value.EndsWith('>'))
|
||||
{
|
||||
value = "#" + match.Value.Substring(3 + 5, match.Value.Length - 4 - 5);
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user