Jaml-all.js
function(lpad) {
    lpad = lpad || 0;
    
    var node      = [],
        attrs     = [],
        textnode  = (this instanceof Jaml.TextNode),
        multiline = this.multiLineTag();
    
    
    //add any left padding
    if (!textnode) node.push(this.getPadding(lpad));
    
    //open the tag
    node.push("<" + this.tagName);

    for (var key in this.attributes) {
      attrs.push(key + "=\"" + this.attributes[key] + "\"");
    }    
    attrs.sort()
    //add any tag attributes
    for (var i=0; i<attrs.length; i++) {
      node.push(" " + attrs[i]);
    }
    
    if (this.isSelfClosing() && this.children.length==0) {
      node.push("/>\n");
    } else {
      node.push(">");
      
      if (multiline) node.push("\n");
      
      this.renderChildren(node, this.children, lpad);
            
      if (multiline) node.push(this.getPadding(lpad));
      node.push("</", this.tagName, ">\n");
    }
    
    return node.join("");
  }
function(lpad) {
    lpad = lpad || 0;
    
    var node      = [],
        attrs     = [],
        textnode  = (this instanceof Jaml.TextNode),
        multiline = this.multiLineTag();
    
    
    //add any left padding
    if (!textnode) node.push(this.getPadding(lpad));
    
    //open the tag
    node.push("<" + this.tagName);

    for (var key in this.attributes) {
      attrs.push(key + "=\"" + this.attributes[key] + "\"");
    }    
    attrs.sort()
    //add any tag attributes
    for (var i=0; i<attrs.length; i++) {
      node.push(" " + attrs[i]);
    }
    
    if (this.isSelfClosing() && this.children.length==0) {
      node.push("/>\n");
    } else {
      node.push(">");
      
      if (multiline) node.push("\n");
      
      this.renderChildren(node, this.children, lpad);
            
      if (multiline) node.push(this.getPadding(lpad));
      node.push("</", this.tagName, ">\n");
    }
    
    return node.join("");
  }
function ( lpad ) { lpad = lpad || 0 ; var node = [ ] , attrs = [ ] , textnode = ( this instanceof Jaml . TextNode ) , multiline = this . multiLineTag ( ) ; //add any left padding if ( ! textnode ) node . push ( this . getPadding ( lpad ) ) ; //open the tag node . push ( "<" + this . tagName ) ; for ( var key in this . attributes ) { attrs . push ( key + "=\"" + this . attributes [ key ] + "\"" ) ; } attrs . sort ( ) //add any tag attributes for ( var i = 0 ; i < attrs . length ; i ++ ) { node . push ( " " + attrs [ i ] ) ; } if ( this . isSelfClosing ( ) && this . children . length == 0 ) { node . push ( "/>\n" ) ; } else { node . push ( ">" ) ; if ( multiline ) node . push ( "\n" ) ; this . renderChildren ( node , this . children , lpad ) ; if ( multiline ) node . push ( this . getPadding ( lpad ) ) ; node . push ( "</" , this . tagName , ">\n" ) ; } return node . join ( "" ) ; }
Renders this node with its attributes and children
@param {Number} lpad Amount of whitespace to add to the left of the string (defaults to 0)
@return {String} The rendered node
Renders this node with its attributes and children