private void MakeAttribute(HamlNode childNode)
        {
            var attributeNode = childNode as HamlNodeHtmlAttribute;
            if (attributeNode == null)
                throw new HamlMalformedTagException("Unexpected " + childNode.GetType().FullName + " tag in AttributeCollection node",
                    childNode.SourceFileLineNum);

            var valueFragments = attributeNode.Children.Any(ch => ch is HamlNodeTextContainer)
                                     ? attributeNode.Children.First().Children
                                     : attributeNode.Children;
            ClassBuilder.AppendAttributeNameValuePair(attributeNode.Name, valueFragments.ToList(), attributeNode.QuoteChar);
        }
Exemplo n.º 2
0
 private void AddClassificationSpans(SnapshotSpan span, List<ClassificationSpan> spans, HamlNode node)
 {
     if (node.Metrics.Length > 0 && node.Metrics.ColNo >= 0)
     {
         var classifiedSpan = new SnapshotSpan(span.Snapshot, span.Start.Position + node.Metrics.ColNo, node.Metrics.Length);
         var type = GetClassificationTypeForMarkdownToken(node.GetType());
         spans.Add(new ClassificationSpan(classifiedSpan, type));
     }
     foreach (var childNode in node.Children)
         AddClassificationSpans(span, spans, childNode);
 }