mirror of
https://github.com/SubtitleEdit/subtitleedit.git
synced 2024-11-22 11:12:36 +01:00
parent
48dd4b54d9
commit
c4b8255f45
@ -1363,6 +1363,26 @@ namespace Test.FixCommonErrors
|
||||
Assert.AreEqual(s.Paragraphs[0].Text, "The house seemed desolate to me and");
|
||||
}
|
||||
|
||||
[TestMethod]
|
||||
public void AddPeriodChineseDoNotAdd1()
|
||||
{
|
||||
var s = new Subtitle();
|
||||
s.Paragraphs.Add(new Paragraph("→「Adobe」の順に移動します。", 0, 2000));
|
||||
s.Paragraphs.Add(new Paragraph("Bye.", 7000, 9000));
|
||||
new FixMissingPeriodsAtEndOfLine().Fix(s, new EmptyFixCallback());
|
||||
Assert.AreEqual(s.Paragraphs[0].Text, "→「Adobe」の順に移動します。");
|
||||
}
|
||||
|
||||
[TestMethod]
|
||||
public void AddPeriodChineseDoNotAdd2()
|
||||
{
|
||||
var s = new Subtitle();
|
||||
s.Paragraphs.Add(new Paragraph("この新しいplistファイルを\r\n作成するには、", 0, 2000));
|
||||
s.Paragraphs.Add(new Paragraph("Bye.", 7000, 9000));
|
||||
new FixMissingPeriodsAtEndOfLine().Fix(s, new EmptyFixCallback());
|
||||
Assert.AreEqual(s.Paragraphs[0].Text, "この新しいplistファイルを\r\n作成するには、");
|
||||
}
|
||||
|
||||
#endregion Fix missing periods at end of line
|
||||
|
||||
#region Start with uppercase after paragraph
|
||||
|
@ -48,7 +48,7 @@ namespace Nikse.SubtitleEdit.Core.Forms.FixCommonErrors
|
||||
|
||||
// Cached variables
|
||||
private static readonly char[] ExpectedChars = { '♪', '♫' };
|
||||
private const string ExpectedString1 = ",.!?:;>-])♪♫…";
|
||||
private const string DoNotAddPeriodAfterChars = ",.!?:;>-])♪♫…、。";
|
||||
private const string ExpectedString2 = ")]*#¶.!?";
|
||||
|
||||
public void Fix(Subtitle subtitle, IFixCallbacks callbacks)
|
||||
@ -79,7 +79,7 @@ namespace Nikse.SubtitleEdit.Core.Forms.FixCommonErrors
|
||||
next.Text.Length > 0 &&
|
||||
char.IsUpper(nextText[0]) &&
|
||||
tempNoHtml.Length > 0 &&
|
||||
!ExpectedString1.Contains(tempNoHtml[tempNoHtml.Length - 1]))
|
||||
!DoNotAddPeriodAfterChars.Contains(tempNoHtml[tempNoHtml.Length - 1]))
|
||||
{
|
||||
var tempTrimmed = tempNoHtml.TrimEnd().TrimEnd('\'', '"', '“', '”').TrimEnd();
|
||||
if (tempTrimmed.Length > 0 && !ExpectedString2.Contains(tempTrimmed[tempTrimmed.Length - 1]) && p.Text != p.Text.ToUpperInvariant())
|
||||
|
Loading…
Reference in New Issue
Block a user