Show
Ignore:
Timestamp:
12/26/07 13:28:26 (5 years ago)
Author:
cho45
Message:

lang/javascript/blosxom.rhino/ejs.js,
lang/javascript/blosxom.rhino/template.html:

高速化へ

Location:
lang/javascript/blosxom.rhino
Files:
2 modified

Legend:

Unmodified
Added
Removed
  • lang/javascript/blosxom.rhino/ejs.js

    r3131 r3597  
    11#!rhino 
    22 
    3 EJS = function (template) { this.initialize(template) }; 
     3EJS = function (template) { return (this instanceof EJS) ? this.initialize(template) : new EJS(template) }; 
    44EJS.prototype = { 
    55        initialize : function (template) { 
     
    2121 
    2222                var m, c; 
    23                 while (m = s.match(/<%([^\s]*)/)) { 
     23                while (m = s.match(/<%(=*)/)) { 
    2424                        var flag = m[1]; 
    2525                        ret.push('ret.push(', uneval(s.slice(0, m.index)), ');'); 
     
    3333                                        ret.push('ret.push(EJS.escape(', c,'));'); 
    3434                                        break; 
    35                                 case "=R": 
     35                                case "===": 
    3636                                        ret.push('ret.push(', c,');'); 
    3737                                        break; 
     
    4747        } 
    4848}; 
     49EJS.escapeMap ={ "&" : "&amp;", "<" : "&lt;" , ">" : "&gt;"}; 
    4950EJS.escape = function (str) { 
    50         var map = { "&" : "&amp;", "<" : "&lt;" , ">" : "&gt;"}; 
    5151        return str.replace(/[&<>]/g, function (m) { 
    52                 return map[m]; 
     52                return EJS.escapeMap[m]; 
    5353        }); 
    5454}; 
     55 
     56//var t = EJS("aaaa<%=foo%>bbbbb<%=bar%>ccc"); 
     57// 
     58//print(t.processor); 
     59//print(t.run({foo:"test", bar:"foobar"})); 
    5560 
    5661/* 
  • lang/javascript/blosxom.rhino/template.html

    r3048 r3597  
    146146                                        </h3> 
    147147                                        <div class="entry-content"> 
    148                                                 <%=R entry.body %> 
     148                                                <%=== entry.body %> 
    149149                                        </div> 
    150150                                        <dl class="information">