mirror of
https://github.com/SubtitleEdit/subtitleedit.git
synced 2024-11-23 03:33:18 +01:00
Small improvement to 'fix italic tags' - thx azu :)
git-svn-id: https://subtitleedit.googlecode.com/svn/trunk@1610 99eadd0c-20b8-1223-b5c4-2a2b2df33de2
This commit is contained in:
parent
fce087dbd2
commit
b7fa10a68e
@ -2231,11 +2231,20 @@ namespace Nikse.SubtitleEdit.Logic
|
||||
|
||||
if (italicBeginTagCount == 2 && italicEndTagCount == 1)
|
||||
{
|
||||
int lastIndex = text.LastIndexOf(beginTag);
|
||||
if (text.Length > lastIndex + endTag.Length)
|
||||
text = text.Substring(0, lastIndex) + text.Substring(lastIndex - 1 + endTag.Length);
|
||||
var lines = text.Replace(Environment.NewLine, "\n").Split('\n');
|
||||
if (lines.Length == 2 && lines[0].StartsWith("<i>") && lines[0].EndsWith("</i>") &&
|
||||
lines[1].StartsWith("<i>"))
|
||||
{
|
||||
text = text.TrimEnd() + "</i>";
|
||||
}
|
||||
else
|
||||
text = text.Substring(0, lastIndex - 1) + endTag;
|
||||
{
|
||||
int lastIndex = text.LastIndexOf(beginTag);
|
||||
if (text.Length > lastIndex + endTag.Length)
|
||||
text = text.Substring(0, lastIndex) + text.Substring(lastIndex - 1 + endTag.Length);
|
||||
else
|
||||
text = text.Substring(0, lastIndex - 1) + endTag;
|
||||
}
|
||||
}
|
||||
|
||||
if (italicBeginTagCount == 1 && italicEndTagCount == 0)
|
||||
|
Loading…
Reference in New Issue
Block a user