Exemplo n.º 1
0
        protected override void Validate(HtmlDocument doc, DescriptionValidatorSettings settings)
        {
            TextLengthValidator.Validate(doc, "//head/meta[@name='description']",
                                         settings.MinLength, settings.MaxLength,
                                         "<meta description>", n =>
            {
                var desc = n.Attributes["content"]?.Value;

                if (string.IsNullOrEmpty(desc))
                {
                    return(0);
                }
                else
                {
                    return(desc.Length);
                }
            });
        }
Exemplo n.º 2
0
 protected override void Validate(HtmlDocument doc, ContentValidatorSettings settings)
 {
     TextLengthValidator.Validate(doc, settings.ContentNodeSelector,
                                  settings.MinWords, settings.MaxWords,
                                  "{page content}", n => TextHelper.GetWords(HtmlHelper.HtmlToPlainText(n)).Count());
 }
Exemplo n.º 3
0
 protected override void Validate(HtmlDocument doc, TitleValidatorSettings settings)
 {
     TextLengthValidator.Validate(doc, "//head/title",
                                  settings.MinLength, settings.MaxLength,
                                  "<title>", n => n.InnerText.Length);
 }