mirror of
https://github.com/SubtitleEdit/subtitleedit.git
synced 2024-11-24 20:22:41 +01:00
Minor fix in "Remove text for hear impaired"
git-svn-id: https://subtitleedit.googlecode.com/svn/trunk@172 99eadd0c-20b8-1223-b5c4-2a2b2df33de2
This commit is contained in:
parent
cb2d2e1c3c
commit
d13a0694f8
@ -330,22 +330,36 @@ namespace Nikse.SubtitleEdit.Forms
|
||||
StripableText st = new StripableText(text, " >-\"'‘`´♪¿¡.", " -\"'`´♪.!?:");
|
||||
var sb = new StringBuilder();
|
||||
string[] parts = st.StrippedText.Trim().Split(Environment.NewLine.ToCharArray(), StringSplitOptions.RemoveEmptyEntries);
|
||||
int lineNumber = 0;
|
||||
bool removedDialogInFirstLine = false;
|
||||
foreach (string s in parts)
|
||||
{
|
||||
{
|
||||
StripableText stSub = new StripableText(s, " >-\"'‘`´♪¿¡.", " -\"'`´♪.!?:");
|
||||
if (!StartAndEndsWithHearImpariedTags(stSub.StrippedText))
|
||||
{
|
||||
if (removedDialogInFirstLine && stSub.Pre.Contains("- "))
|
||||
stSub.Pre = stSub.Pre.Replace("- ", string.Empty);
|
||||
|
||||
string newText = stSub.StrippedText;
|
||||
if (HasHearImpariedTagsAtStart(newText))
|
||||
newText = RemoveStartEndTags(newText);
|
||||
if (HasHearImpariedTagsAtEnd(newText))
|
||||
newText = RemoveEndTags(newText);
|
||||
sb.AppendLine(stSub.Pre + newText + stSub.Post);
|
||||
|
||||
}
|
||||
else if (st.Pre.Contains("<i>") && stSub.Post.Contains("</i>"))
|
||||
else
|
||||
{
|
||||
st.Pre = st.Pre.Replace("<i>", string.Empty);
|
||||
if (st.Pre.Contains("- ") && lineNumber == 0)
|
||||
{
|
||||
st.Pre = st.Pre.Replace("- ", string.Empty);
|
||||
removedDialogInFirstLine = true;
|
||||
}
|
||||
|
||||
if (st.Pre.Contains("<i>") && stSub.Post.Contains("</i>"))
|
||||
st.Pre = st.Pre.Replace("<i>", string.Empty);
|
||||
}
|
||||
lineNumber++;
|
||||
}
|
||||
|
||||
text = st.Pre + sb.ToString().Trim() + st.Post;
|
||||
|
Loading…
Reference in New Issue
Block a user