private string MakeAttributes(HamlNode childNode)
 {
     var attributeNode = childNode as HamlNodeHtmlAttribute;
     if (attributeNode == null)
         throw new HamlMalformedTagException("Unexpected " + childNode.GetType().FullName + " tag in AttributeCollection node");
     return childNode.Content.Length > 0 ? " " + childNode.Content : "";
 }
Пример #2
0
 internal void ValidateThereAreNoChildren(HamlNode node)
 {
     if (node.Children.Any())
     {
         throw new HamlInvalidChildNodeException(node.GetType(), node.Children.First().GetType(),
                                                 node.SourceFileLineNum);
     }
 }
Пример #3
0
        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);
        }