diff --git a/mustache.js b/mustache.js index a03e2e0..e1099b0 100644 --- a/mustache.js +++ b/mustache.js @@ -496,8 +496,9 @@ break; case '>': if (!partials) continue; - value = this.parse(isFunction(partials) ? partials(token[1]) : partials[token[1]]); - if (value != null) buffer += this.renderTokens(value, context, partials, originalTemplate); + var partialTemplate = isFunction(partials) ? partials(token[1]) : partials[token[1]]; + value = this.parse(partialTemplate); + if (value != null) buffer += this.renderTokens(value, context, partials, partialTemplate); break; case '&': value = context.lookup(token[1]); diff --git a/test/_files/section_functions_in_partials.js b/test/_files/section_functions_in_partials.js new file mode 100644 index 0000000..4672778 --- /dev/null +++ b/test/_files/section_functions_in_partials.js @@ -0,0 +1,7 @@ +({ + bold: function(){ + return function(text, render) { + return "" + render(text) + ""; + } + } +}) diff --git a/test/_files/section_functions_in_partials.mustache b/test/_files/section_functions_in_partials.mustache new file mode 100644 index 0000000..8164932 --- /dev/null +++ b/test/_files/section_functions_in_partials.mustache @@ -0,0 +1,3 @@ +{{> partial}} + +
some more text
diff --git a/test/_files/section_functions_in_partials.partial b/test/_files/section_functions_in_partials.partial new file mode 100644 index 0000000..3e90b00 --- /dev/null +++ b/test/_files/section_functions_in_partials.partial @@ -0,0 +1 @@ +{{#bold}}Hello There{{/bold}} diff --git a/test/_files/section_functions_in_partials.txt b/test/_files/section_functions_in_partials.txt new file mode 100644 index 0000000..2f5955c --- /dev/null +++ b/test/_files/section_functions_in_partials.txt @@ -0,0 +1,3 @@ +Hello There + +some more text