Minor improve of "Fix italic" - thx Aleksander :)

This commit is contained in:
Nikolaj Olsson 2020-06-20 08:11:45 +02:00
parent c3c3aac69f
commit 522d4639f8
2 changed files with 12 additions and 0 deletions

View File

@ -563,6 +563,8 @@ namespace Nikse.SubtitleEdit.Core
text = text.Replace("< I >", beginTag);
text = text.Replace("< I>", beginTag);
text = text.Replace("<I >", beginTag);
text = text.Replace("<i<", beginTag);
text = text.Replace("<I<", beginTag);
text = text.Replace("< / i >", endTag);
text = text.Replace("< /i>", endTag);
@ -579,6 +581,8 @@ namespace Nikse.SubtitleEdit.Core
text = text.Replace("</I >", endTag);
text = text.Replace("</ I >", endTag);
text = text.Replace("< / I>", endTag);
text = text.Replace("</i<", beginTag);
text = text.Replace("</I<", beginTag);
text = text.Replace("<I>", beginTag);
text = text.Replace("</I>", endTag);

View File

@ -437,6 +437,14 @@ namespace Test.Logic
Assert.AreEqual(s2, "{\\an8}<i>Hallo!" + Environment.NewLine + "Hallo!</i>");
}
[TestMethod]
public void FixInvalidItalicTagsBadStartTag()
{
var s1 = "<i<Hallo!<i/>";
string s2 = HtmlUtil.FixInvalidItalicTags(s1);
Assert.AreEqual( "<i>Hallo!</i>", s2);
}
[TestMethod]
public void FixUnneededSpacesDoubleSpace1()
{