SiteCounterParser
Ecng.Markdown.Extensions
Parses the site counters the host registered ("@user_count"), each optionally followed by its word forms: "@user_count(пользователь/пользователя/пользователей)".
Наследует: InlineParser
Конструкторы
SiteCounterParser
public SiteCounterParser()
siteCounterParser = SiteCounterParser()
Initializes a new instance of the SiteCounterParser class.
Методы
Match
public override bool Match(InlineProcessor processor, StringSlice slice)
result = siteCounterParser.Match(processor, slice)
Register
public static void Register(string name, string key)
SiteCounterParser.Register(name, key)
Makes "@_count" a counter the host resolves by . Registering the same pair again changes nothing.
- name
- The name as written in a text, lower-case letters: "user" for "@user_count".
- key
- The key the host resolves the counter by, and the key of its value in Counters.
ToToken
public static string ToToken(string name, IReadOnlyCollection<string> forms)
result = SiteCounterParser.ToToken(name, forms)
The token a counter is written as, so an unresolved one can be put back the way it was typed.
- name
- The counter's name as written.
- forms
- The word forms written after it, empty when none.
Возвращает: The token.
TryParseName
public static bool TryParseName(string name, string key)
result = SiteCounterParser.TryParseName(name, key)
The key of the counter a written name stands for, e.g. the host's key for "user".