// TODO: templates orverwritten could be called by t-call="__super__" ?
// TODO: t-set + t-value + children node == scoped variable ?
var QWeb2 = {
- expressions_cache: {
- // special case for template bodies, __content__ doesn't work in
- // Python impl because safe_eval -> assert_no_dunder_name so use
- // Python impl's magical 0 variable instead
- '0': 'dict[0]',
- },
+ expressions_cache: { },
RESERVED_WORDS: 'true,false,NaN,null,undefined,debugger,console,window,in,instanceof,new,function,return,this,typeof,eval,void,Math,RegExp,Array,Object,Date'.split(','),
ACTIONS_PRECEDENCE: 'foreach,if,call,set,esc,raw,js,debug,log'.split(','),
WORD_REPLACEMENT: {
QWeb2.expressions_cache[e] = r;
return r;
},
+ format_str: function (e) {
+ if (e == '0') {
+ return 'dict[0]';
+ }
+ return this.format_expression(e);
+ },
string_interpolation : function(s) {
var _this = this;
if (!s) {
// extract literal string between previous and current match
append_literal(s.slice(start, re.lastIndex - m[0].length));
// extract matched expression
- r.push('(' + this.format_expression(m[2] || m[1]) + ')');
+ r.push('(' + this.format_str(m[2] || m[1]) + ')');
// update position of new matching
start = re.lastIndex;
}
+ "));");
},
compile_action_raw : function(value) {
- this.top("r.push(" + (this.format_expression(value)) + ");");
+ this.top("r.push(" + (this.format_str(value)) + ");");
},
compile_action_js : function(value) {
this.top("(function(" + value + ") {");