NotifyTextile: cosmetic changes

This commit is contained in:
Maksim Chegulov 2022-02-16 18:32:18 +03:00
parent dedf773571
commit 0d2d33a625
3 changed files with 36 additions and 9 deletions

View File

@ -28,13 +28,36 @@ namespace ASC.Notify.Textile
[Scope]
public class JabberStyler : IPatternStyler
{
private static readonly Regex _velocityArguments = new Regex(NVelocityPatternFormatter.NoStylePreffix + "(?<arg>.*?)" + NVelocityPatternFormatter.NoStyleSuffix, RegexOptions.IgnoreCase | RegexOptions.Singleline | RegexOptions.Compiled);
private static readonly Regex _linkReplacer = new Regex(@"""(?<text>[\w\W]+?)"":""(?<link>[^""]+)""", RegexOptions.Singleline | RegexOptions.Compiled);
private static readonly Regex _textileReplacer = new Regex(@"(h1\.|h2\.|\*|h3\.|\^)", RegexOptions.Singleline | RegexOptions.Compiled);
private static readonly Regex _brReplacer = new Regex(@"<br\s*\/*>", RegexOptions.IgnoreCase | RegexOptions.CultureInvariant | RegexOptions.IgnorePatternWhitespace | RegexOptions.Compiled | RegexOptions.Singleline);
private static readonly Regex _closedTagsReplacer = new Regex(@"</(p|div)>", RegexOptions.IgnoreCase | RegexOptions.CultureInvariant | RegexOptions.IgnorePatternWhitespace | RegexOptions.Compiled | RegexOptions.Singleline);
private static readonly Regex _tagReplacer = new Regex(@"<(.|\n)*?>", RegexOptions.IgnoreCase | RegexOptions.CultureInvariant | RegexOptions.IgnorePatternWhitespace | RegexOptions.Compiled | RegexOptions.Singleline);
private static readonly Regex _multiLineBreaksReplacer = new Regex(@"(?:\r\n|\r(?!\n)|(?!<\r)\n){3,}", RegexOptions.IgnoreCase | RegexOptions.CultureInvariant);
private static readonly Regex _velocityArguments
= new Regex(NVelocityPatternFormatter.NoStylePreffix + "(?<arg>.*?)" + NVelocityPatternFormatter.NoStyleSuffix,
RegexOptions.IgnoreCase | RegexOptions.Singleline | RegexOptions.Compiled);
private static readonly Regex _linkReplacer
= new Regex(@"""(?<text>[\w\W]+?)"":""(?<link>[^""]+)""",
RegexOptions.Singleline | RegexOptions.Compiled);
private static readonly Regex _textileReplacer
= new Regex(@"(h1\.|h2\.|\*|h3\.|\^)",
RegexOptions.Singleline | RegexOptions.Compiled);
private static readonly Regex _brReplacer
= new Regex(@"<br\s*\/*>",
RegexOptions.IgnoreCase | RegexOptions.CultureInvariant | RegexOptions.IgnorePatternWhitespace
| RegexOptions.Compiled | RegexOptions.Singleline);
private static readonly Regex _closedTagsReplacer
= new Regex(@"</(p|div)>",
RegexOptions.IgnoreCase | RegexOptions.CultureInvariant | RegexOptions.IgnorePatternWhitespace
| RegexOptions.Compiled | RegexOptions.Singleline);
private static readonly Regex _tagReplacer
= new Regex(@"<(.|\n)*?>",
RegexOptions.IgnoreCase | RegexOptions.CultureInvariant | RegexOptions.IgnorePatternWhitespace
| RegexOptions.Compiled | RegexOptions.Singleline);
private static readonly Regex _multiLineBreaksReplacer
= new Regex(@"(?:\r\n|\r(?!\n)|(?!<\r)\n){3,}",
RegexOptions.IgnoreCase | RegexOptions.CultureInvariant);
public void ApplyFormating(NoticeMessage message)
{

View File

@ -28,7 +28,9 @@ namespace ASC.Notify.Textile
[Scope]
public class PushStyler : IPatternStyler
{
private static readonly Regex _velocityArgumentsRegex = new Regex(NVelocityPatternFormatter.NoStylePreffix + "(?'arg'.*?)" + NVelocityPatternFormatter.NoStyleSuffix, RegexOptions.IgnoreCase | RegexOptions.Singleline | RegexOptions.Compiled);
private static readonly Regex _velocityArgumentsRegex
= new Regex(NVelocityPatternFormatter.NoStylePreffix + "(?'arg'.*?)" + NVelocityPatternFormatter.NoStyleSuffix,
RegexOptions.IgnoreCase | RegexOptions.Singleline | RegexOptions.Compiled);
public void ApplyFormating(NoticeMessage message)
{

View File

@ -28,7 +28,9 @@ namespace ASC.Notify.Textile
[Scope]
public class TextileStyler : IPatternStyler
{
private static readonly Regex _velocityArguments = new Regex(NVelocityPatternFormatter.NoStylePreffix + "(?<arg>.*?)" + NVelocityPatternFormatter.NoStyleSuffix, RegexOptions.IgnoreCase | RegexOptions.Singleline | RegexOptions.Compiled);
private static readonly Regex _velocityArguments
= new Regex(NVelocityPatternFormatter.NoStylePreffix + "(?<arg>.*?)" + NVelocityPatternFormatter.NoStyleSuffix,
RegexOptions.IgnoreCase | RegexOptions.Singleline | RegexOptions.Compiled);
private readonly CoreBaseSettings _coreBaseSettings;
private readonly IConfiguration _configuration;