DocSpace-client/common/ASC.Textile/States/OrderedListFormatterState.cs

34 lines
1.1 KiB
C#
Raw Normal View History

2022-02-17 09:08:01 +00:00
namespace Textile.States;
/// <summary>
/// Formatting state for a numbered list.
/// </summary>
[FormatterState(ListFormatterState.PatternBegin + @"#+" + ListFormatterState.PatternEnd)]
public class OrderedListFormatterState : ListFormatterState
2019-08-19 12:35:39 +00:00
{
2022-02-17 09:08:01 +00:00
public OrderedListFormatterState(TextileFormatter formatter)
: base(formatter)
2020-08-27 14:01:37 +00:00
{
2022-02-17 09:08:01 +00:00
}
2019-08-19 12:35:39 +00:00
2022-02-17 09:08:01 +00:00
protected override void WriteIndent()
{
Formatter.Output.WriteLine("<ol" + FormattedStylesAndAlignment("ol") + ">");
}
2019-08-19 12:35:39 +00:00
2022-02-17 09:08:01 +00:00
protected override void WriteOutdent()
{
Formatter.Output.WriteLine("</ol>");
}
2019-08-19 12:35:39 +00:00
2022-02-17 09:08:01 +00:00
protected override bool IsMatchForMe(string input, int minNestingDepth, int maxNestingDepth)
{
return Regex.IsMatch(input, @"^\s*([\*#]{" + (minNestingDepth - 1) + @"," + (maxNestingDepth - 1) + @"})#" + Globals.BlockModifiersPattern + @"\s");
}
2019-08-19 12:35:39 +00:00
2022-02-17 09:08:01 +00:00
protected override bool IsMatchForOthers(string input, int minNestingDepth, int maxNestingDepth)
{
return Regex.IsMatch(input, @"^\s*([\*#]{" + (minNestingDepth - 1) + @"," + (maxNestingDepth - 1) + @"})\*" + Globals.BlockModifiersPattern + @"\s");
2020-08-27 14:01:37 +00:00
}
2019-08-19 12:35:39 +00:00
}