Comparing version 0.1.4 to 0.1.5
@@ -7,3 +7,3 @@ /**! | ||
* @author gnosaij | http://jias.github.io | http://www.joy-studio.com | ||
* @version 0.1.3 | ||
* @version 0.1.5 | ||
* @update 2014-05-14 | ||
@@ -16,3 +16,3 @@ * @link http://www.joy-studio.com/javascript/my-eoraptorjs-template-engine-in-javascript.html | ||
name: 'eoraptor.js', | ||
version: '0.1.3', | ||
version: '0.1.5', | ||
compile: compile, | ||
@@ -19,0 +19,0 @@ setDelimiter: setDelimiter, |
@@ -1,2 +0,2 @@ | ||
/*! eoraptorjs v0.1.3 2014-05-14 gnosaij http://jias.github.io/eoraptor.js/ */ | ||
!function(a){function b(a,b){var e,f;if(a=a||r,b=b||{},e=b.id||a,f=q[e])return f;var g=b.oTag||u,h=b.cTag||v,i=c(d(a,g,h));return f=function(b){var c;try{c=new Function("data",D+i)(b)}catch(d){console.error('"'+d.message+'" from data and tpl below:'),console.log(b),console.log(a)}return c},f.render=f,f.source="function (data) {\n"+i+"\n}",q[e]=f}function c(a){var b,c,d,e=[],f=["var d_=data, r_=[];\n"];for(b=0,c=a.length;c>b;b++)switch(d=a[b],d.type){case void 0:e.push(d.str);break;case-1:e.length&&f.push(i(e.join(""))),e=[];break;case 1:f.push(j(e.join(""),d.sign)),e=[]}return e.length&&f.push(i(e.join(""))),f.push('return r_.join("");'),f.join("")}function d(a,b,c){var d,i,j,k,l,m=b.charAt(0),n=c.charAt(0),o=[],p={lastOTag:null,lastOSB:null},q=0,r=a.length;for(q=0;r>q;q++)d=a.charAt(q),d===m&&(i=e(a,b,q))?(p.lastOTag=i,o.push(i),q+=i.jump):p.lastOTag&&d===n&&(j=f(a,c,q))?(j.sign=p.lastOTag.sign,o.push(j),p.lastOTag.type=-1,p.lastOTag=null,q+=j.jump):d===w&&(k=g(a,q))?(p.lastOSB=k,o.push(k),q+=k.jump):p.lastOSB&&d===p.lastOSB.quote&&(l=h(a,q,p.lastOSB.quote))?(o.push(l),p.lastOSB=null,q+=l.jump):"\\"===d?(o.push({index:q,str:"\\"+a.charAt(q+1)}),q++):o.push({index:q,str:d});return o}function e(a,b,c){var d=b.length,e=a.substr(c,d),f=a.charAt(c+d);return b===e&&f&&A.indexOf(f)>-1?{str:e+f,index:c,sign:B[a.charAt(c+d)],jump:d}:void 0}function f(a,b,c){var d=b.length,e=a.substr(c,d);return b===e?{str:e,index:c,type:1,jump:d-1}:void 0}function g(a,b){var c=a.charAt(b+1);return c===z||c===y?{str:w+c,index:b,quote:c,jump:1}:void 0}function h(a,b,c){return a.charAt(b+1)===x?{str:c+x,index:b,quote:c,jump:1}:void 0}function i(a){return'r_.push("'+a.replace(/"/g,'\\"')+'");\n'}function j(a,b){a=C(a);var c="";switch(b){case 1:a=k(a),c="r_.push(e_(v_("+a+", d_)));\n";break;case 2:a=k(a),c="r_.push(v_("+a+", d_));\n";break;case 3:c="}\n";break;case 4:c=a.replace(E,function(a,b,c,d){return b=k(b),d=d||"k_","var "+d+", l_="+b+".length, "+c+";\nfor("+d+"=0; "+d+"<l_; "+d+"++){\n"+c+" = "+b+"["+d+"];\n"});break;case 5:c=a.replace(E,function(a,b,c,d){return b=k(b),d=d||"k_","var "+d+", "+c+";\nfor("+d+" in "+b+"){\nif(!"+b+".hasOwnProperty("+d+")) return;\n"+c+" = "+b+"["+d+"];\n"});break;case 6:c="if("+k(a)+"){";break;case 7:c="if(!"+k(a)+"){";break;case 8:c=a.length?"}else if("+k(a)+"){":"}else{";break;case 9:c=a.replace(/^(\w+)\s(.+)$/,function(a,b,c){return b=b.indexOf("-")>-1?'["'+b+'"]':s+b,"r_.push(eoraptor"+b+".render("+c+"));\n"})}return c}function k(a){var b;return b="&"===a.charAt(0)?a.substr(1):t+("["!==a.charAt(0)?s:r)+a}function l(a,b){a=a||"{{",b=b||"}}"}function m(a){return G[a]}function n(a){return null==a?r:r+String(a).replace(F,m)}function o(){for(var a,c=document.getElementsByTagName("script"),d=0,e=c.length;e>d;d++)a=c[d],!a.getAttribute("compiled")&&a.id&&a.innerHTML&&"text/x-eoraptor"===a.type&&(b(a.id,C(a.innerHTML)),a.setAttribute("compiled","1"))}function p(a,b){return typeof a===H?a.apply(b,[b]):a||r}var q={name:"eoraptor.js",version:"0.1.3",compile:b,setDelimiter:l,escape:n,extract:o,debug:!1,_:{e:n,v:p}},r="",s=".",t="d_",u="{{",v="}}",w="[",x="]",y="'",z='"',A="=-/^#?:!>",B={"=":1,"-":2,"/":3,"^":4,"#":5,"?":6,"!":7,":":8,">":9},C=("object"==typeof process&&"object"==typeof process.versions,r.trim?function(a){return a.trim()}:function(a){return a.replace(/^\s+/,r).replace(/\s+$/,r)}),D="var __=eoraptor._, e_=__.e, v_=__.v;\n",E=/^(.+?)\s(\w+)\s?(\w+)?.*$/,F=/[&<>"']/g,G={"&":"&","<":"<",">":">",'"':""","'":"'"},H="function";"undefined"!=typeof module&&module.exports?module.exports=q:"function"==typeof define&&define.amd?define("eoraptor",[],function(){return q}):a.eoraptor=q}(this); | ||
/*! eoraptorjs v0.1.5 2014-05-14 gnosaij http://jias.github.io/eoraptor.js/ */ | ||
!function(a){function b(a,b){var e,f;if(a=a||r,b=b||{},e=b.id||a,f=q[e])return f;var g=b.oTag||u,h=b.cTag||v,i=c(d(a,g,h));return f=function(b){var c;try{c=new Function("data",D+i)(b)}catch(d){console.error('"'+d.message+'" from data and tpl below:'),console.log(b),console.log(a)}return c},f.render=f,f.source="function (data) {\n"+i+"\n}",q[e]=f}function c(a){var b,c,d,e=[],f=["var d_=data, r_=[];\n"];for(b=0,c=a.length;c>b;b++)switch(d=a[b],d.type){case void 0:e.push(d.str);break;case-1:e.length&&f.push(i(e.join(""))),e=[];break;case 1:f.push(j(e.join(""),d.sign)),e=[]}return e.length&&f.push(i(e.join(""))),f.push('return r_.join("");'),f.join("")}function d(a,b,c){var d,i,j,k,l,m=b.charAt(0),n=c.charAt(0),o=[],p={lastOTag:null,lastOSB:null},q=0,r=a.length;for(q=0;r>q;q++)d=a.charAt(q),d===m&&(i=e(a,b,q))?(p.lastOTag=i,o.push(i),q+=i.jump):p.lastOTag&&d===n&&(j=f(a,c,q))?(j.sign=p.lastOTag.sign,o.push(j),p.lastOTag.type=-1,p.lastOTag=null,q+=j.jump):d===w&&(k=g(a,q))?(p.lastOSB=k,o.push(k),q+=k.jump):p.lastOSB&&d===p.lastOSB.quote&&(l=h(a,q,p.lastOSB.quote))?(o.push(l),p.lastOSB=null,q+=l.jump):"\\"===d?(o.push({index:q,str:"\\"+a.charAt(q+1)}),q++):o.push({index:q,str:d});return o}function e(a,b,c){var d=b.length,e=a.substr(c,d),f=a.charAt(c+d);return b===e&&f&&A.indexOf(f)>-1?{str:e+f,index:c,sign:B[a.charAt(c+d)],jump:d}:void 0}function f(a,b,c){var d=b.length,e=a.substr(c,d);return b===e?{str:e,index:c,type:1,jump:d-1}:void 0}function g(a,b){var c=a.charAt(b+1);return c===z||c===y?{str:w+c,index:b,quote:c,jump:1}:void 0}function h(a,b,c){return a.charAt(b+1)===x?{str:c+x,index:b,quote:c,jump:1}:void 0}function i(a){return'r_.push("'+a.replace(/"/g,'\\"')+'");\n'}function j(a,b){a=C(a);var c="";switch(b){case 1:a=k(a),c="r_.push(e_(v_("+a+", d_)));\n";break;case 2:a=k(a),c="r_.push(v_("+a+", d_));\n";break;case 3:c="}\n";break;case 4:c=a.replace(E,function(a,b,c,d){return b=k(b),d=d||"k_","var "+d+", l_="+b+".length, "+c+";\nfor("+d+"=0; "+d+"<l_; "+d+"++){\n"+c+" = "+b+"["+d+"];\n"});break;case 5:c=a.replace(E,function(a,b,c,d){return b=k(b),d=d||"k_","var "+d+", "+c+";\nfor("+d+" in "+b+"){\nif(!"+b+".hasOwnProperty("+d+")) return;\n"+c+" = "+b+"["+d+"];\n"});break;case 6:c="if("+k(a)+"){";break;case 7:c="if(!"+k(a)+"){";break;case 8:c=a.length?"}else if("+k(a)+"){":"}else{";break;case 9:c=a.replace(/^(\w+)\s(.+)$/,function(a,b,c){return b=b.indexOf("-")>-1?'["'+b+'"]':s+b,"r_.push(eoraptor"+b+".render("+c+"));\n"})}return c}function k(a){var b;return b="&"===a.charAt(0)?a.substr(1):t+("["!==a.charAt(0)?s:r)+a}function l(a,b){a=a||"{{",b=b||"}}"}function m(a){return G[a]}function n(a){return null==a?r:r+String(a).replace(F,m)}function o(){for(var a,c=document.getElementsByTagName("script"),d=0,e=c.length;e>d;d++)a=c[d],!a.getAttribute("compiled")&&a.id&&a.innerHTML&&"text/x-eoraptor"===a.type&&(b(a.id,C(a.innerHTML)),a.setAttribute("compiled","1"))}function p(a,b){return typeof a===H?a.apply(b,[b]):a||r}var q={name:"eoraptor.js",version:"0.1.5",compile:b,setDelimiter:l,escape:n,extract:o,debug:!1,_:{e:n,v:p}},r="",s=".",t="d_",u="{{",v="}}",w="[",x="]",y="'",z='"',A="=-/^#?:!>",B={"=":1,"-":2,"/":3,"^":4,"#":5,"?":6,"!":7,":":8,">":9},C=("object"==typeof process&&"object"==typeof process.versions,r.trim?function(a){return a.trim()}:function(a){return a.replace(/^\s+/,r).replace(/\s+$/,r)}),D="var __=eoraptor._, e_=__.e, v_=__.v;\n",E=/^(.+?)\s(\w+)\s?(\w+)?.*$/,F=/[&<>"']/g,G={"&":"&","<":"<",">":">",'"':""","'":"'"},H="function";"undefined"!=typeof module&&module.exports?module.exports=q:"function"==typeof define&&define.amd?define("eoraptor",[],function(){return q}):a.eoraptor=q}(this); |
{ | ||
"family": "gnosaij", | ||
"name": "eoraptorjs", | ||
"version": "0.1.4", | ||
"version": "0.1.5", | ||
"description": "A mini expression javascript template engine without any dependence. Compatible with client-side and server-side.", | ||
@@ -6,0 +6,0 @@ "homepage": "http://jias.github.io/eoraptor.js/", |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package