includes/clientside/static/template-compiler.js
changeset 229 97ae8e9d5e29
parent 212 30b857a6b811
child 582 a38876c0793c
equal deleted inserted replaced
147:d8156d18ac58 229:97ae8e9d5e29
    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