DocSpace-buildtools/common/ASC.Textile/States/UnorderedListFormatterState.cs

33 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 bulleted list.
/// </summary>
[FormatterState(ListFormatterState.PatternBegin + @"\*+" + ListFormatterState.PatternEnd)]
public class UnorderedListFormatterState : ListFormatterState
2019-08-19 12:35:39 +00:00
{
2022-02-17 09:08:01 +00:00
public UnorderedListFormatterState(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("<ul" + FormattedStylesAndAlignment("ul") + ">");
}
2019-08-19 12:35:39 +00:00
2022-02-17 09:08:01 +00:00
protected override void WriteOutdent()
{
Formatter.Output.WriteLine("</ul>");
}
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 + @"," + maxNestingDepth + @"}" + 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 + @"," + maxNestingDepth + @"}" + Globals.BlockModifiersPattern + @"\s");
2019-08-19 12:35:39 +00:00
}
2022-02-17 09:08:01 +00:00
}