includes/clientside/static/template-compiler.js
changeset 212 30b857a6b811
parent 1 fe660c52c48f
child 582 a38876c0793c
equal deleted inserted replaced
211:753dabeca1ee 212:30b857a6b811
    52   code = code.replace(/\'/g,  "\\'");
    52   code = code.replace(/\'/g,  "\\'");
    53   code = code.replace(/\"/g,  '\\"');
    53   code = code.replace(/\"/g,  '\\"');
    54   code = code.replace(new RegExp(unescape('%0A'), 'g'), '\\n');
    54   code = code.replace(new RegExp(unescape('%0A'), 'g'), '\\n');
    55   code = "'" + code + "'";
    55   code = "'" + code + "'";
    56   code = code.replace(/\{([A-z0-9_-]+)\}/ig, "' + this.tpl_strings['$1'] + '");
    56   code = code.replace(/\{([A-z0-9_-]+)\}/ig, "' + this.tpl_strings['$1'] + '");
       
    57   code = code.replace(/\{lang:([a-z0-9_]+)\}/g, "' + $lang.get('$1') + '");
    57   code = code.replace(/\<!-- BEGIN ([A-z0-9_-]+) --\>([\s\S]*?)\<!-- BEGINELSE \1 --\>([\s\S]*?)\<!-- END \1 --\>/ig, "' + ( ( this.tpl_bool['$1'] == true ) ? '$2' : '$3' ) + '");
    58   code = code.replace(/\<!-- BEGIN ([A-z0-9_-]+) --\>([\s\S]*?)\<!-- BEGINELSE \1 --\>([\s\S]*?)\<!-- END \1 --\>/ig, "' + ( ( this.tpl_bool['$1'] == true ) ? '$2' : '$3' ) + '");
    58   code = code.replace(/\<!-- BEGIN ([A-z0-9_-]+) --\>([\s\S]*?)\<!-- END \1 --\>/ig, "' + ( ( this.tpl_bool['$1'] == true ) ? '$2' : '' ) + '");
    59   code = code.replace(/\<!-- BEGIN ([A-z0-9_-]+) --\>([\s\S]*?)\<!-- END \1 --\>/ig, "' + ( ( this.tpl_bool['$1'] == true ) ? '$2' : '' ) + '");
    59   return code;
    60   return code;
    60 }
    61 }
    61 
    62