mirror of
https://github.com/SubtitleEdit/subtitleedit.git
synced 2024-11-22 03:02:35 +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
|
||||
* FIXED:
|
||||
* 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)
|
||||
|
@ -463,6 +463,14 @@ namespace Test.Logic
|
||||
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]
|
||||
public void FixUnneededSpacesDoubleSpace1()
|
||||
{
|
||||
|
@ -3,6 +3,7 @@ using System.Collections.Generic;
|
||||
using System.Drawing;
|
||||
using System.Globalization;
|
||||
using System.Linq;
|
||||
using System.Runtime.InteropServices;
|
||||
using System.Text;
|
||||
using System.Text.RegularExpressions;
|
||||
|
||||
@ -651,6 +652,11 @@ namespace Nikse.SubtitleEdit.Core.Common
|
||||
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(endTag + endTag, endTag);
|
||||
|
||||
@ -852,14 +858,19 @@ namespace Nikse.SubtitleEdit.Core.Common
|
||||
if (idx > 1)
|
||||
{
|
||||
var pre = text.Substring(0, idx + 1).TrimStart();
|
||||
text = text.Remove(0, idx + 1);
|
||||
text = FixInvalidItalicTags(text).Trim();
|
||||
if (text.StartsWith("<i> ", StringComparison.OrdinalIgnoreCase))
|
||||
{
|
||||
text = Utilities.RemoveSpaceBeforeAfterTag(text, beginTag);
|
||||
}
|
||||
var tempText = text.Remove(0, idx + 1);
|
||||
|
||||
text = pre + " " + text;
|
||||
if (!tempText.StartsWith(']') && !tempText.StartsWith(')'))
|
||||
{
|
||||
text = tempText;
|
||||
text = FixInvalidItalicTags(text).Trim();
|
||||
if (text.StartsWith("<i> ", StringComparison.OrdinalIgnoreCase))
|
||||
{
|
||||
text = Utilities.RemoveSpaceBeforeAfterTag(text, beginTag);
|
||||
}
|
||||
|
||||
text = pre + " " + text;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user