diff options
author | kpdecker <kpdecker@gmail.com> | 2015-08-22 10:54:54 -0700 |
---|---|---|
committer | kpdecker <kpdecker@gmail.com> | 2015-08-22 11:13:08 -0700 |
commit | 495cd05a7e27bf0485ffc07cb32324402422868b (patch) | |
tree | c67149a36bc831e6e654b0af4993f3fb2ac0dd23 /lib/handlebars/runtime.js | |
parent | 452afbf2ffdf32a6d7112b727cc95cc6b415e8a5 (diff) | |
download | handlebars.js-495cd05a7e27bf0485ffc07cb32324402422868b.zip handlebars.js-495cd05a7e27bf0485ffc07cb32324402422868b.tar.gz handlebars.js-495cd05a7e27bf0485ffc07cb32324402422868b.tar.bz2 |
Implement inline partials
Allows for partials to be defined within the current template to allow for localized code reuse as well as for conditional behavior within nested partials.
Fixes #1018
Diffstat (limited to 'lib/handlebars/runtime.js')
-rw-r--r-- | lib/handlebars/runtime.js | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/lib/handlebars/runtime.js b/lib/handlebars/runtime.js index e1b069e..6ee5c84 100644 --- a/lib/handlebars/runtime.js +++ b/lib/handlebars/runtime.js @@ -239,6 +239,10 @@ export function invokePartial(partial, context, options) { let partialBlock; if (options.fn && options.fn !== noop) { partialBlock = options.data['partial-block'] = options.fn; + + if (partialBlock.partials) { + options.partials = Utils.extend({}, options.partials, partialBlock.partials); + } } if (partial === undefined && partialBlock) { |