mirror of
https://github.com/SubtitleEdit/subtitleedit.git
synced 2024-11-22 03:02:35 +01:00
Fixadding music notation to italics, removes italics - thx Charvelx04 :)
Work on #7905
This commit is contained in:
parent
22173fb253
commit
4b613fffd8
@ -3178,30 +3178,32 @@ namespace Nikse.SubtitleEdit.Core.Common
|
||||
return text;
|
||||
}
|
||||
|
||||
public static string RemoveSymbols(string tag, string text, string endTag)
|
||||
public static string RemoveSymbols(string tag, string input, string endTag)
|
||||
{
|
||||
var pre = string.Empty;
|
||||
var post = string.Empty;
|
||||
text = SplitStartTags(text, ref pre);
|
||||
var text = SplitStartTags(input, ref pre);
|
||||
text = SplitEndTags(text, ref post);
|
||||
|
||||
if (!string.IsNullOrEmpty(tag) && text.Contains(tag) || string.IsNullOrEmpty(tag) && !string.IsNullOrEmpty(endTag) && text.Contains(endTag))
|
||||
{
|
||||
if (!string.IsNullOrEmpty(endTag) && !string.IsNullOrEmpty(tag))
|
||||
{
|
||||
text = pre + text.Replace(tag, string.Empty).Replace(endTag, string.Empty).Replace(Environment.NewLine + " ", Environment.NewLine).Replace(" " + Environment.NewLine, Environment.NewLine).Trim() + post;
|
||||
return pre + text.Replace(tag, string.Empty).Replace(endTag, string.Empty).Replace(Environment.NewLine + " ", Environment.NewLine).Replace(" " + Environment.NewLine, Environment.NewLine).Trim() + post;
|
||||
}
|
||||
else if (string.IsNullOrEmpty(endTag) && !string.IsNullOrEmpty(tag))
|
||||
|
||||
if (string.IsNullOrEmpty(endTag) && !string.IsNullOrEmpty(tag))
|
||||
{
|
||||
text = pre + text.Replace(tag, string.Empty).Replace(Environment.NewLine + " ", Environment.NewLine).Replace(" " + Environment.NewLine, Environment.NewLine).Trim() + post;
|
||||
return pre + text.Replace(tag, string.Empty).Replace(Environment.NewLine + " ", Environment.NewLine).Replace(" " + Environment.NewLine, Environment.NewLine).Trim() + post;
|
||||
}
|
||||
else if (!string.IsNullOrEmpty(endTag))
|
||||
|
||||
if (!string.IsNullOrEmpty(endTag))
|
||||
{
|
||||
text = pre + text.Replace(endTag, string.Empty).Replace(Environment.NewLine + " ", Environment.NewLine).Replace(" " + Environment.NewLine, Environment.NewLine).Trim() + post;
|
||||
return pre + text.Replace(endTag, string.Empty).Replace(Environment.NewLine + " ", Environment.NewLine).Replace(" " + Environment.NewLine, Environment.NewLine).Trim() + post;
|
||||
}
|
||||
}
|
||||
|
||||
return text;
|
||||
return pre + text + post;
|
||||
}
|
||||
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user