// ============================================================ // Code-generation of template tags // The `CodeGen` class currently has no instance state, but in theory // it could be useful to track per-function state, like whether we // need to emit `var self = this` or not. var CodeGen = SpacebarsCompiler.CodeGen = function () {}; var builtInBlockHelpers = SpacebarsCompiler._builtInBlockHelpers = { 'if': 'Blaze.If', 'unless': 'Blaze.Unless', 'with': 'Spacebars.With', 'each': 'Blaze.Each' }; // Some `UI.*` paths are special in that they generate code that // doesn't folow the normal lookup rules for dotted symbols. The // following names must be prefixed with `UI.` when you use them in a // template. var builtInUIPaths = { // `template` is a local variable defined in the generated render // function for the template in which `UI.contentBlock` (or // `UI.elseBlock`) is invoked. `template` is a reference to the // template itself. 'contentBlock': 'view.templateContentBlock', 'elseBlock': 'view.templateElseBlock', // `Template` is the global template namespace. If you define a // template named `foo` in Spacebars, it gets defined as // `Template.foo` in JavaScript. 'dynamic': 'Template.__dynamic' }; // A "reserved name" can't be used as a