protected override void AnalyzeSpeakerData(IDocument document, IAnalyzerContext context) { foreach (string linkKey in SpeakerLinkAttribute.GetAll().Keys) { if (document.ContainsKey(linkKey) && !Uri.TryCreate(document.GetString(linkKey), UriKind.Absolute, out _)) { context.Add(document, $"{linkKey} link {document.GetString(linkKey)} is invalid"); } } }
protected override void AnalyzeSpeakerData(IDocument document, IAnalyzerContext context) { IReadOnlyList <string> topics = document.GetList <string>(SiteKeys.Topics); if (topics == null || topics.Count == 0) { // No topics, but that's okay (if we ever want to enforce at least one topic, add an analyzer result here) return; } string[] nonApprovedTopics = topics.Where(x => !Topics.Contains(x)).ToArray(); if (nonApprovedTopics.Length > 0) { context.Add(document, $"Document contains non-approved topic(s): {string.Join(", ", nonApprovedTopics)}"); } }