mirror of
https://github.com/SubtitleEdit/subtitleedit.git
synced 2024-11-22 19:22:53 +01:00
parent
c52a279300
commit
2aba793f53
@ -1959,6 +1959,32 @@ namespace Test.Logic.Forms
|
||||
Assert.AreEqual("<i>- and many were imm..." + Environment.NewLine + "- We believe" + Environment.NewLine + "the future of food...</i>", actual);
|
||||
}
|
||||
|
||||
[TestMethod]
|
||||
public void RemoveTextForHiSecondDialogEmpty()
|
||||
{
|
||||
var target = GetRemoveTextForHiLib();
|
||||
target.Settings.RemoveTextBeforeColon = true;
|
||||
target.Settings.RemoveTextBeforeColonOnlyUppercase = false;
|
||||
target.Settings.RemoveInterjections = false;
|
||||
target.Settings.RemoveTextBetweenBrackets = false;
|
||||
target.Settings.OnlyIfInSeparateLine = false;
|
||||
string actual = target.RemoveTextFromHearImpaired("- Oh. No." + Environment.NewLine + "-");
|
||||
Assert.AreEqual("Oh. No.", actual);
|
||||
}
|
||||
|
||||
[TestMethod]
|
||||
public void RemoveTextForHiFirstDialogEmpty()
|
||||
{
|
||||
var target = GetRemoveTextForHiLib();
|
||||
target.Settings.RemoveTextBeforeColon = true;
|
||||
target.Settings.RemoveTextBeforeColonOnlyUppercase = false;
|
||||
target.Settings.RemoveInterjections = false;
|
||||
target.Settings.RemoveTextBetweenBrackets = false;
|
||||
target.Settings.OnlyIfInSeparateLine = false;
|
||||
string actual = target.RemoveTextFromHearImpaired("-" + Environment.NewLine + "- Oh. No.");
|
||||
Assert.AreEqual("Oh. No.", actual);
|
||||
}
|
||||
|
||||
[TestMethod]
|
||||
public void RemoveInterjectionsAfterComma()
|
||||
{
|
||||
|
@ -833,6 +833,24 @@ namespace Nikse.SubtitleEdit.Core.Forms
|
||||
pre = pre.Replace(Settings.CustomStart, string.Empty);
|
||||
post = post.Replace(Settings.CustomEnd, string.Empty);
|
||||
}
|
||||
|
||||
// fix empty ending dialog line "-"
|
||||
var inputLines = text.SplitToLines();
|
||||
if (inputLines.Count == 2)
|
||||
{
|
||||
if (inputLines[0].HasSentenceEnding() && inputLines[1] == "-")
|
||||
{
|
||||
text = inputLines[0].TrimStart('-').TrimStart();
|
||||
}
|
||||
}
|
||||
else if (inputLines.Count == 3)
|
||||
{
|
||||
if (inputLines[1].HasSentenceEnding() && inputLines[2] == "-")
|
||||
{
|
||||
text = inputLines[0] + Environment.NewLine + inputLines[1];
|
||||
}
|
||||
}
|
||||
|
||||
var st = new StrippableText(text, pre, post);
|
||||
var sb = new StringBuilder();
|
||||
var parts = st.StrippedText.Trim().SplitToLines();
|
||||
|
Loading…
Reference in New Issue
Block a user