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 : ""; }
internal void ValidateThereAreNoChildren(HamlNode node) { if (node.Children.Any()) { throw new HamlInvalidChildNodeException(node.GetType(), node.Children.First().GetType(), node.SourceFileLineNum); } }
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); }