public virtual bool IsCoveredBy(AttributeMatcher attributeMatcher)
        {
            if (attributeMatcher == this)
            {
                return(true);
            }

            IList <Tag> tags = new List <Tag>(this.values.Count);

            for (int i = 0, n = this.values.Count; i < n; ++i)
            {
                tags.Add(new Tag(null, this.values[i]));
            }
            return(attributeMatcher.Matches(tags));
        }
Exemple #2
0
        public MvcHtmlString Parse(IHtmlHelper htmlHelper, string current)
        {
            if (string.IsNullOrWhiteSpace(current))
            {
                return(MvcHtmlString.Empty);
            }

            current = ShortcodeMatcher.Replace(current, match =>
            {
                var tagName = match.Groups[1].Value;
                if (!_renderShortcode.CanRender(tagName))
                {
                    return(string.Empty);
                }

                var matches = AttributeMatcher.Matches(match.Groups[2].Value);

                var attributes = matches.Cast <Match>().ToDictionary(m => m.Groups[1].Value, m => m.Groups[2].Value);

                return(_renderShortcode.Render(htmlHelper, tagName, attributes));
            });

            return(MvcHtmlString.Create(current));
        }