mirror of
https://github.com/SubtitleEdit/subtitleedit.git
synced 2024-11-22 11:12:36 +01:00
Fix minor space issue with "Fix italic tags" - thx Adam :)
This commit is contained in:
parent
f3bc862339
commit
eb10eaebcc
@ -15,6 +15,7 @@
|
|||||||
* Update yt-dlp to 2023-11-16
|
* Update yt-dlp to 2023-11-16
|
||||||
* FIXED:
|
* FIXED:
|
||||||
* Fix Whisper CPP cuBLAS new hash (DLL files now included)
|
* Fix Whisper CPP cuBLAS new hash (DLL files now included)
|
||||||
|
* Fix minor space issue with "Fix italic tags" - thx Adam
|
||||||
|
|
||||||
|
|
||||||
4.0.2 (19th November 2023)
|
4.0.2 (19th November 2023)
|
||||||
|
@ -463,6 +463,14 @@ namespace Test.Logic
|
|||||||
Assert.AreEqual("ADULT MARK: <i>New friends</i>", s2);
|
Assert.AreEqual("ADULT MARK: <i>New friends</i>", s2);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
[TestMethod]
|
||||||
|
public void FixInvalidItalicColonBracketItalic()
|
||||||
|
{
|
||||||
|
var s1 = "[König:]<i> Ich weiß, dass du dagegen</i>" + Environment.NewLine + "<i>bist.</i>";
|
||||||
|
var s2 = HtmlUtil.FixInvalidItalicTags(s1);
|
||||||
|
Assert.AreEqual("[König:] <i>Ich weiß, dass du dagegen</i>" + Environment.NewLine + "<i>bist.</i>", s2);
|
||||||
|
}
|
||||||
|
|
||||||
[TestMethod]
|
[TestMethod]
|
||||||
public void FixUnneededSpacesDoubleSpace1()
|
public void FixUnneededSpacesDoubleSpace1()
|
||||||
{
|
{
|
||||||
|
@ -3,6 +3,7 @@ using System.Collections.Generic;
|
|||||||
using System.Drawing;
|
using System.Drawing;
|
||||||
using System.Globalization;
|
using System.Globalization;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
|
using System.Runtime.InteropServices;
|
||||||
using System.Text;
|
using System.Text;
|
||||||
using System.Text.RegularExpressions;
|
using System.Text.RegularExpressions;
|
||||||
|
|
||||||
@ -651,6 +652,11 @@ namespace Nikse.SubtitleEdit.Core.Common
|
|||||||
text = text.Replace("<I/>", string.Empty);
|
text = text.Replace("<I/>", string.Empty);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
text = text.Replace("]<i> ", "] <i>");
|
||||||
|
text = text.Replace(")<i> ", ") <i>");
|
||||||
|
text = text.Replace("] </i>", "] </i>");
|
||||||
|
text = text.Replace(") </i>", ") </i>");
|
||||||
|
|
||||||
text = text.Replace(beginTag + beginTag, beginTag);
|
text = text.Replace(beginTag + beginTag, beginTag);
|
||||||
text = text.Replace(endTag + endTag, endTag);
|
text = text.Replace(endTag + endTag, endTag);
|
||||||
|
|
||||||
@ -852,7 +858,11 @@ namespace Nikse.SubtitleEdit.Core.Common
|
|||||||
if (idx > 1)
|
if (idx > 1)
|
||||||
{
|
{
|
||||||
var pre = text.Substring(0, idx + 1).TrimStart();
|
var pre = text.Substring(0, idx + 1).TrimStart();
|
||||||
text = text.Remove(0, idx + 1);
|
var tempText = text.Remove(0, idx + 1);
|
||||||
|
|
||||||
|
if (!tempText.StartsWith(']') && !tempText.StartsWith(')'))
|
||||||
|
{
|
||||||
|
text = tempText;
|
||||||
text = FixInvalidItalicTags(text).Trim();
|
text = FixInvalidItalicTags(text).Trim();
|
||||||
if (text.StartsWith("<i> ", StringComparison.OrdinalIgnoreCase))
|
if (text.StartsWith("<i> ", StringComparison.OrdinalIgnoreCase))
|
||||||
{
|
{
|
||||||
@ -864,6 +874,7 @@ namespace Nikse.SubtitleEdit.Core.Common
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
//<i>- You think they're they gone?<i>
|
//<i>- You think they're they gone?<i>
|
||||||
//<i>- That can't be.</i>
|
//<i>- That can't be.</i>
|
||||||
|
Loading…
Reference in New Issue
Block a user