function(template, context, partials) {
        if(!includes("#", template) && !includes("^", template)) {
            return template;
        }

        var that = this;

        // for each {{#foo}}{{/foo}} section do...
        return template.replace(sectionRegex,
            function(match, type, name, content) {

            var value = that.find(name, context);
            if(type == "^") { // inverted section
                if(!value || is_array(value) && value.length === 0) {
                    // false or empty list, render it
                    return that.render(content, context, partials, true);
                } else {
                    return "";
                }
            } else if(type == "#") { // normal section
                if(is_array(value)) { // Enumerable, Let's loop!
                    return utils.map(value, function(row) {
                        return that.render(content, that.create_context(row),
                            partials, true);
                    }).join("");
                } else if(is_object(value)) { // Object, Use it as subcontext!
                    return that.render(content, that.create_context(value),
                        partials, true);
                } else if(typeof value === "function") {
                    // higher order section
                    return value.call(context, content, function(text) {
                        return that.render(text, context, partials, true);
                    });
                } else if(value) { // boolean section
                    return that.render(content, context, partials, true);
                } else {
                    return "";
                }
            }
        });
    }
function(template, context, partials) {
        if(!includes("#", template) && !includes("^", template)) {
            return template;
        }

        var that = this;

        
        return template.replace(sectionRegex,
            function(match, type, name, content) {

            var value = that.find(name, context);
            if(type == "^") { 
                if(!value || is_array(value) && value.length === 0) {
                    
                    return that.render(content, context, partials, true);
                } else {
                    return "";
                }
            } else if(type == "#") { 
                if(is_array(value)) { 
                    return utils.map(value, function(row) {
                        return that.render(content, that.create_context(row),
                            partials, true);
                    }).join("");
                } else if(is_object(value)) { 
                    return that.render(content, that.create_context(value),
                        partials, true);
                } else if(typeof value === "function") {
                    
                    return value.call(context, content, function(text) {
                        return that.render(text, context, partials, true);
                    });
                } else if(value) { 
                    return that.render(content, context, partials, true);
                } else {
                    return "";
                }
            }
        });
    }
function ( template , context , partials ) { if ( ! includes ( "#" , template ) && ! includes ( "^" , template ) ) { return template ; } var that = this ; // for each {{#foo}}{{/foo}} section do... return template . replace ( sectionRegex , function ( match , type , name , content ) { var value = that . find ( name , context ) ; if ( type == "^" ) { // inverted section if ( ! value || is_array ( value ) && value . length === 0 ) { // false or empty list, render it return that . render ( content , context , partials , true ) ; } else { return "" ; } } else if ( type == "#" ) { // normal section if ( is_array ( value ) ) { // Enumerable, Let's loop! return utils . map ( value , function ( row ) { return that . render ( content , that . create_context ( row ) , partials , true ) ; } ) . join ( "" ) ; } else if ( is_object ( value ) ) { // Object, Use it as subcontext! return that . render ( content , that . create_context ( value ) , partials , true ) ; } else if ( typeof value === "function" ) { // higher order section return value . call ( context , content , function ( text ) { return that . render ( text , context , partials , true ) ; } ) ; } else if ( value ) { // boolean section return that . render ( content , context , partials , true ) ; } else { return "" ; } } } ) ; }
/*
Renders inverted (^) and normal (#) sections
/ * Renders inverted ( ^ ) and normal ( # ) sections