diff --git a/src/Forms/FixCommonErrors.cs b/src/Forms/FixCommonErrors.cs index 9f62d3d80..04da6c4a7 100644 --- a/src/Forms/FixCommonErrors.cs +++ b/src/Forms/FixCommonErrors.cs @@ -1843,16 +1843,11 @@ namespace Nikse.SubtitleEdit.Forms if (prev != null) prevText = Utilities.RemoveHtmlTags(prev.Text); + bool isPrevEndOfLine = IsPrevoiusTextEndOfParagraph(prevText); if (!text.StartsWith("www.") && firstLetter != firstLetter.ToUpper() && !"0123456789".Contains(firstLetter) && - prevText.Length > 1 && - !prevText.EndsWith("...") && - (prevText.EndsWith(".") || - prevText.EndsWith("!") || - prevText.EndsWith("?") || - prevText.EndsWith(":") || - prevText.EndsWith(";"))) + isPrevEndOfLine) { bool isMatchInKnowAbbreviations = _autoDetectGoogleLanguage == "en" && (prevText.EndsWith(" o.r.") || @@ -1900,17 +1895,11 @@ namespace Nikse.SubtitleEdit.Forms string oldText = p.Text; string firstLetter = text.Substring(0, 1); string prevText = Utilities.RemoveHtmlTags(arr[0]); - + bool isPrevEndOfLine = IsPrevoiusTextEndOfParagraph(prevText); if (!text.StartsWith("www.") && firstLetter != firstLetter.ToUpper() && !prevText.EndsWith("...") && - prevText.Length > 1 && - !"0123456789".Contains(firstLetter) && - (prevText.EndsWith(".") || - prevText.EndsWith("!") || - prevText.EndsWith("?") || - prevText.EndsWith(":") || - prevText.EndsWith(";"))) + isPrevEndOfLine) { bool isMatchInKnowAbbreviations = _autoDetectGoogleLanguage == "en" && (prevText.EndsWith(" o.r.") || @@ -1964,6 +1953,23 @@ namespace Nikse.SubtitleEdit.Forms LogStatus(_language.StartWithUppercaseLetterAfterParagraph, fixedStartWithUppercaseLetterAfterParagraphTicked.ToString()); } + private static bool IsPrevoiusTextEndOfParagraph(string prevText) + { + bool isPrevEndOfLine = prevText.Length > 1 && + !prevText.EndsWith("...") && + (prevText.EndsWith(".") || + prevText.EndsWith("!") || + prevText.EndsWith("?") || + prevText.EndsWith(":") || + prevText.EndsWith(";")); + + if (isPrevEndOfLine && prevText.Length > 5 && prevText.EndsWith(".") && + prevText[prevText.Length - 3] == '.' && + Utilities.GetLetters(true, true, false).Contains(prevText[prevText.Length - 2].ToString())) + isPrevEndOfLine = false; + return isPrevEndOfLine; + } + private void FixStartWithUppercaseLetterAfterPeriodInsideParagraph() { string fixAction = _language.StartWithUppercaseLetterAfterPeriodInsideParagraph; diff --git a/src/Forms/Main.cs b/src/Forms/Main.cs index 8adfb7352..605100877 100644 --- a/src/Forms/Main.cs +++ b/src/Forms/Main.cs @@ -521,12 +521,17 @@ namespace Nikse.SubtitleEdit.Forms Subtitle newSub = new Subtitle(); foreach (Paragraph p in sub.Paragraphs) { - if (p.Extra == className) + if (p.Extra.ToLower().Trim() == className.ToLower().Trim()) newSub.Paragraphs.Add(p); } if (newSub.Paragraphs.Count > 0 && newSub.Paragraphs.Count < sub.Paragraphs.Count) { - outputFileName = FormatOutputFileNameForBatchConvert(fileName + "_" + className, sf.Extension); + string s = fileName; + if (s.LastIndexOf('.') > 0) + s = s.Insert(s.LastIndexOf('.'), "_" + className); + else + s += "_" + className + format.Extension; + outputFileName = FormatOutputFileNameForBatchConvert(s , sf.Extension); System.IO.File.WriteAllText(outputFileName, newSub.ToText(sf), targetEncoding); } }