Exemplo n.º 1
0
 public RichTextToken(RichTextToken token, int index, int length)
 {
     Index           = index;
     Length          = length;
     Type            = token.Type;
     IsHighlighted   = token.IsHighlighted;
     IsContext       = token.IsContext;
     IconName        = token.IconName;
     IconNeedsShadow = token.IconNeedsShadow;
 }
        public static string GetTagName(
            this RichTextToken token)
        {
            if (!token.IsTagToken())
            {
                throw new ArgumentException(nameof(token));
            }

            var pattern = new Regex(TagNameRegex);
            var matches = pattern.Matches(token.Value);

            if (matches.Count <= 0)
            {
                return(null);
            }

            return(matches[0].Groups[1].Value);
        }
 public static bool IsTagToken(
     this RichTextToken token)
 {
     return(token.Type == RichTextTokenType.OpenTag ||
            token.Type == RichTextTokenType.CloseTag);
 }