public static List<IHtmlSchema> GetSchemas() { HtmlSchemaManager mng = new HtmlSchemaManager(); IHtmlSchema html = mng.GetSchema("http://schemas.microsoft.com/intellisense/html"); var schemas = mng.CustomAttributePrefixes.SelectMany(p => mng.GetSupplementalSchemas(p)).ToList(); schemas.Insert(0, html); return schemas; }
private static IEnumerable <string> BuildCache() { yield return("*"); HtmlSchemaManager mng = new HtmlSchemaManager(); IHtmlSchema schema = mng.GetSchema("http://schemas.microsoft.com/intellisense/html"); foreach (var element in schema.GetTopLevelElements()) { yield return(element.Name); } }
private IEnumerable<ICssCompletionListEntry> KnownTagName(IHtmlSchema schema, string tagName) { var element = schema.GetElementInfo(tagName); if (element != null) { foreach (var attr in element.GetAttributes()) { if (IsAllowed(attr.Name)) yield return new CompletionListEntry(attr.Name); } } }
private IEnumerable<ICssCompletionListEntry> UnknownTagName(IHtmlSchema schema) { if (_allAttributes == null) { _allAttributes = new HashSet<string>(); foreach (var element in schema.GetTopLevelElements()) foreach (var attr in element.GetAttributes()) { if (!_allAttributes.Contains(attr.Name) && IsAllowed(attr.Name)) _allAttributes.Add(attr.Name); } } return _allAttributes.Select(n => new CompletionListEntry(n)); }
private IEnumerable<ICssCompletionListEntry> KnownTagName(IHtmlSchema schema, string tagName, string attrName) { var element = schema.GetElementInfo(tagName); if (element != null) { var attr = element.GetAttribute(attrName); if (attr == null) yield break; foreach (var value in attr.GetValues()) { yield return new CompletionListEntry(value.Value); } } }
private IEnumerable <ICssCompletionListEntry> KnownTagName(IHtmlSchema schema, string tagName, string attrName) { var element = schema.GetElementInfo(tagName); if (element != null) { var attr = element.GetAttribute(attrName); if (attr == null) { yield break; } foreach (var value in attr.GetValues()) { yield return(new CompletionListEntry(value.Value)); } } }
public IEnumerable <ICssCompletionListEntry> GetListEntries(CssCompletionContext context) { HtmlSchemaManager mng = new HtmlSchemaManager(); IHtmlSchema schema = mng.GetSchema("http://schemas.microsoft.com/intellisense/html"); var tag = context.ContextItem.FindType <SimpleSelector>(); var attr = context.ContextItem as AttributeSelector; if (tag != null && tag.Name != null && attr != null && attr.AttributeName != null) { return(KnownTagName(schema, tag.Name.Text, attr.AttributeName.Text)); } else if (attr != null && attr.AttributeName != null) { return(UnknownTagName(schema, attr.AttributeName.Text)); } return(new List <ICssCompletionListEntry>()); }
private static IEnumerable<ICssCompletionListEntry> UnknownTagName(IHtmlSchema schema, string attrName) { var cache = new HashSet<string>(); foreach (var element in schema.GetTopLevelElements()) { var attr = element.GetAttribute(attrName); if (attr != null) { foreach (var value in attr.GetValues()) { cache.Add(value.Value); } } } return cache.Select(n => new CompletionListEntry(n)); }
public static IEnumerable <string> GetAttributeValue(string elementName, string attributeName) { HtmlSchemaManager mng = new HtmlSchemaManager(); IHtmlSchema schema = mng.GetSchema("http://schemas.microsoft.com/intellisense/html"); IHtmlElementInfo element = schema.GetElementInfo(elementName); if (element != null) { IHtmlAttributeInfo attribute = element.GetAttribute(attributeName); if (attribute != null) { foreach (IHtmlAttributeValueInfo value in attribute.GetValues()) { yield return(value.Value); } } } }
private static IEnumerable <ICssCompletionListEntry> UnknownTagName(IHtmlSchema schema, string attrName) { var cache = new HashSet <string>(); foreach (var element in schema.GetTopLevelElements()) { var attr = element.GetAttribute(attrName); if (attr != null) { foreach (var value in attr.GetValues()) { cache.Add(value.Value); } } } return(cache.Select(n => new CompletionListEntry(n))); }