mirror of
https://github.com/SubtitleEdit/subtitleedit.git
synced 2024-11-23 03:33:18 +01:00
Fixed another case with italics
This commit is contained in:
parent
8469aa7345
commit
2315a0f9cf
@ -2679,6 +2679,24 @@ namespace Nikse.SubtitleEdit.Logic
|
|||||||
{
|
{
|
||||||
var firstLine = text.Substring(0, index).Trim();
|
var firstLine = text.Substring(0, index).Trim();
|
||||||
var secondLine = text.Substring(index + 2).Trim();
|
var secondLine = text.Substring(index + 2).Trim();
|
||||||
|
|
||||||
|
if (firstLine.Length > 10 && firstLine.StartsWith("- <i>") && firstLine.EndsWith(endTag))
|
||||||
|
{
|
||||||
|
text = "<i>- " + firstLine.Remove(0, 5) + Environment.NewLine + secondLine;
|
||||||
|
text = text.Replace("<i>- ", "<i>- ");
|
||||||
|
index = text.IndexOf(Environment.NewLine, StringComparison.Ordinal);
|
||||||
|
firstLine = text.Substring(0, index).Trim();
|
||||||
|
secondLine = text.Substring(index + 2).Trim();
|
||||||
|
}
|
||||||
|
if (secondLine.Length > 10 && secondLine.StartsWith("- <i>") && secondLine.EndsWith(endTag))
|
||||||
|
{
|
||||||
|
text = firstLine + Environment.NewLine + "<i>- " + secondLine.Remove(0, 5);
|
||||||
|
text = text.Replace("<i>- ", "<i>- ");
|
||||||
|
index = text.IndexOf(Environment.NewLine, StringComparison.Ordinal);
|
||||||
|
firstLine = text.Substring(0, index).Trim();
|
||||||
|
secondLine = text.Substring(index + 2).Trim();
|
||||||
|
}
|
||||||
|
|
||||||
if (StartsAndEndsWithTag(firstLine, beginTag, endTag) && StartsAndEndsWithTag(secondLine, beginTag, endTag))
|
if (StartsAndEndsWithTag(firstLine, beginTag, endTag) && StartsAndEndsWithTag(secondLine, beginTag, endTag))
|
||||||
{
|
{
|
||||||
text = text.Replace(beginTag, String.Empty).Replace(endTag, String.Empty);
|
text = text.Replace(beginTag, String.Empty).Replace(endTag, String.Empty);
|
||||||
|
@ -88,6 +88,15 @@ namespace Test
|
|||||||
Assert.AreEqual(s2, "<i>- It is a telegram?" + Environment.NewLine + "- It is.</i>");
|
Assert.AreEqual(s2, "<i>- It is a telegram?" + Environment.NewLine + "- It is.</i>");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
[TestMethod]
|
||||||
|
[DeploymentItem("SubtitleEdit.exe")]
|
||||||
|
public void FixInvalidItalicTags6()
|
||||||
|
{
|
||||||
|
string s1 = "- <i>Text1!</i>" + Environment.NewLine + "- <i>Text2.</i>";
|
||||||
|
string s2 = Utilities.FixInvalidItalicTags(s1);
|
||||||
|
Assert.AreEqual(s2, "<i>- Text1!" + Environment.NewLine + "- Text2.</i>");
|
||||||
|
}
|
||||||
|
|
||||||
[TestMethod]
|
[TestMethod]
|
||||||
[DeploymentItem("SubtitleEdit.exe")]
|
[DeploymentItem("SubtitleEdit.exe")]
|
||||||
public void FixUnneededSpacesDoubleSpace1()
|
public void FixUnneededSpacesDoubleSpace1()
|
||||||
|
Loading…
Reference in New Issue
Block a user