mirror of
https://github.com/hanzoai/handlebars.js.git
synced 2026-09-24 16:59:42 +00:00
26 lines
674 B
JavaScript
26 lines
674 B
JavaScript
import { extend } from '../utils.js';
|
|
|
|
export default function (instance) {
|
|
instance.registerDecorator(
|
|
'inline',
|
|
function (fn, props, container, options) {
|
|
let ret = fn;
|
|
if (!props.partials) {
|
|
props.partials = {};
|
|
ret = function (context, options) {
|
|
// Create a new partials stack frame prior to exec.
|
|
let original = container.partials;
|
|
container.partials = extend({}, original, props.partials);
|
|
let ret = fn(context, options);
|
|
container.partials = original;
|
|
return ret;
|
|
};
|
|
}
|
|
|
|
props.partials[options.args[0]] = options.fn;
|
|
|
|
return ret;
|
|
}
|
|
);
|
|
}
|