Eco Compiler v1.1.0-rc-1
http://github.com/sstephenson/eco

Copyright (c) 2011 Sam Stephenson
Released under the MIT License

this.eco=function(a){return function b©{var d,e={id:c,exports:{}};if(d=a){d(e,b,e.exports);return e.exports}throw“Cannot find module '”c“'”}}({eco:function(a,b,c){(function(){var c,d,e,f,g;g=b(“./compiler”),c=g.compile,e=g.precompile,f=b(“./preprocessor”).preprocess,a.exports=d=function(a){var b,e;return d.cache?(e=(b=d.cache))!=null?e:b=c(a):c(a)},d.cache={},d.preprocess=f,d.precompile=e,d.compile=c,d.render=function(a,b){return d(a)(b)},b.extensions&&(b.extensions=function(a,c){var d;d=b(“fs”).readFileSync(c,“utf-8”);return a._compile(“module.exports = ”+e(d),c)})}).call(this)},“./compiler”:function(a,b,c){(function(){var a,d,e,f;a=b(“coffee-script”),f=b(“./preprocessor”).preprocess,d=b(“./util”).indent,c.precompile=e=function(b){var c;c=a.compile(f(b),{noWrap:!0});return“function(__obj) {n if (!__obj) __obj = {};n var __out = [], __capture = function(callback) {n var out = __out, result;n __out = [];n callback.call(this);n result = __out.join('');n __out = out;n return __safe(result);n }, __sanitize = function(value) {n if (value && value.ecoSafe) {n return value;n } else if (typeof value !== 'undefined' && value != null) {n return __escape(value);n } else {n return '';n }n }, __safe, __objSafe = __obj.safe, __escape = __obj.escape;n __safe = __obj.safe = function(value) {n if (value && value.ecoSafe) {n return value;n } else {n if (!(typeof value !== 'undefined' && value != null)) value = '';n var result = new String(value);n result.ecoSafe = true;n return result;n }n };n if (!__escape) {n __escape = __obj.escape = function(value) {n return ('' + value)n .replace(/&/g, '&amp;')n .replace(/</g, '&lt;')n .replace(/>/g, '&gt;')n .replace(/"/g, '&quot;');n };n }n (function() {n”+d(c,4)+“n }).call(__obj);n __obj.safe = __objSafe, __obj.escape = __escape;n return __out.join('');n}”},c.compile=function(a){return(new Function(“return ”+e(a)))()}}).call(this)},“./preprocessor”:function(a,b,c){(function(){var c,d,e,f=function(a,b){return function(){return a.apply(b,arguments)}};d=b(“./scanner”),e=b(“./util”),a.exports=c=function(){function a(a){this.scanner=new d(a),this.output=“”,this.level=0,this.options={},this.captures=[]}a.preprocess=function(b){var c;c=new a(b);return c.preprocess()},a.prototype.preprocess=function(){while(!this.scanner.done)this.scanner.scan(f(function(a){return this[a].apply(this,a.slice(1))},this));return this.output},a.prototype.record=function(a){this.output+=e.repeat(“ ”,this.level);return this.output+=a+“n”},a.prototype.printString=function(a){if(a.length)return this.record(“__out.push ”+e.inspectString(a))},a.prototype.beginCode=function(a){return this.options=a},a.prototype.recordCode=function(a){if(a!==“end”)return this.options.print?this.options.safe?this.record(“__out.push ”+a):this.record(“__out.push __sanitize ”+a):this.record(a)},a.prototype.indent=function(a){this.level++;if(a){this.record(“__capture ”+a),this.captures.unshift(this.level);return this.indent()}},a.prototype.dedent=function(){this.level–,this.level<0&&this.fail(“unexpected dedent”);if(this.captures===this.level){this.captures.shift();return this.dedent()}},a.prototype.fail=function(a){throw“Parse error on line ”this.scanner.lineNo“: ”+a};return a}()}).call(this)},“./scanner”:function(a,b,c){(function(){var c,d,e;d=b(“strscan”).StringScanner,e=b(“./util”).trim,a.exports=c=function(){function a(a){this.source=a.replace(/rn?/g,“n”),this.scanner=new d(this.source),this.mode=“data”,this.buffer=“”,this.lineNo=1,this.done=!1}a.modePatterns={data:/(.*?)(<%%|<%\s*(\#)|<%(()?)|n|$)/,code:/(.*?)((((:|(->|=>))s*))?%>|n|$)/,comment:/(.*?)(%>|n|$)/},a.dedentablePattern=/^(end|when|else|catch|finally)(?:W|$)/,a.scan=function(b){var c,d;d=[],c=new a(b);while(!c.done)c.scan(function(a){return d.push(a)});return d},a.prototype.scan=function(a){if(this.done)return a();if(this.scanner.hasTerminated()){this.done=!0;switch(this.mode){case“data”:return a();case“code”:return a([“fail”,“unexpected end of template”])}}else{this.advance();switch(this.mode){case“data”:return this.scanData(a);case“code”:return this.scanCode(a);case“comment”:return this.scanComment(a)}}},a.prototype.advance=function(){this.scanner.scanUntil(a.modePatterns),this.buffer+=this.scanner.getCapture(0),this.tail=this.scanner.getCapture(1),this.comment=this.scanner.getCapture(2),this.directive=this.scanner.getCapture(4);return this.arrow=this.scanner.getCapture(5)},a.prototype.scanData=function(a){if(this.tail===“<%%”){this.buffer+=“<%”;return this.scan(a)}if(this.tail===“n”){this.buffer+=this.tail,this.lineNo++;return this.scan(a)}if(this.tail){a();if(this.comment)return this.mode=“comment”;this.mode=“code”;return a()}},a.prototype.scanCode=function(a){var b;if(this.tail===“n”)return a([“fail”,“unexpected newline in code block”]);if(this.tail){this.mode=“data”,b=e(this.flush()),this.arrow&&(b+=“ ”+this.arrow),this.isDedentable(b)&&a(),a();if(this.directive)return a()}},a.prototype.scanComment=function(a){if(this.tail===“n”)return a([“fail”,“unexpected newline in code block”]);if(this.tail){this.mode=“data”;return this.buffer=“”}},a.prototype.flush=function(){var a;a=this.buffer,this.buffer=“”;return a},a.prototype.isDedentable=function(b){return b.match(a.dedentablePattern)};return a}()}).call(this)},“./util”:function(a,b,c){(function(){var a,b;c.repeat=a=function(a,b){return Array(b+1).join(a)},c.indent=function(b,c){var d,e,f;f=a(“ ”,c),e=function(){var a,c,e,g;e=b.split(“n”),g=[];for(a=0,c=e.length;a,g.push(f+d);return g}();return e.join(“n”)},c.trim=function(a){return a.replace(/^s+/,“”).replace(/s+$/,“”)},b={“\”:“\\”,“b”:“\b”,“f”:“\f”,“n”:“\n”,“r”:“\r”,“t”:“\t”},c.inspectString=function(a){var c;c=a.replace(//g,function(a){var c;if(a in b)return b;c=a.charCodeAt(0).toString(16),c.length===1&&(c=“0”+c);return“\u00”+c});return“'”+c.replace(/'/g,“\'”)+“'”}}).call(this)},strscan:function(a,b,c){(function(){var a;(typeof c!=“undefined”&&c!==null?c:this).StringScanner=function(){a=function(a){this.source=a.toString(),this.reset();return this},a.prototype.scan=function(a){var b;return(b=a.exec(this.getRemainder()))&&b.index===0?this.setState(b,{head:this.head+b.length,last:this.head}):this.setState([])},a.prototype.scanUntil=function(a){var b;if(b=a.exec(this.getRemainder())){this.setState(b,{head:this.head+b.index+b.length,last:this.head});return this.source.slice(this.last,this.head)}return this.setState([])},a.prototype.scanChar=function(){return this.scan(//)},a.prototype.skip=function(a){if(this.scan(a))return this.match.length},a.prototype.skipUntil=function(a){if(this.scanUntil(a))return this.head-this.last},a.prototype.check=function(a){var b;return(b=a.exec(this.getRemainder()))&&b.index===0?this.setState(b):this.setState([])},a.prototype.checkUntil=function(a){var b;if(b=a.exec(this.getRemainder())){this.setState(b);return this.source.slice(this.head,this.head+b.index+b.length)}return this.setState([])},a.prototype.peek=function(a){return this.source.substr(this.head,typeof a!=“undefined”&&a!==null?a:1)},a.prototype.getSource=function(){return this.source},a.prototype.getRemainder=function(){return this.source.slice(this.head)},a.prototype.getPosition=function(){return this.head},a.prototype.hasTerminated=function(){return this.head===this.source.length},a.prototype.getPreMatch=function(){if(this.match)return this.source.slice(0,this.head-this.match.length)},a.prototype.getMatch=function(){return this.match},a.prototype.getPostMatch=function(){if(this.match)return this.source.slice(this.head)},a.prototype.getCapture=function(a){return this.captures},a.prototype.reset=function(){return this.setState([],{head:0,last:0})},a.prototype.terminate=function(){return this.setState([],{head:this.source.length,last:this.head})},a.prototype.concat=function(a){return this.source+=a},a.prototype.unscan=function(){if(this.match)return this.setState([],{head:this.last,last:0});throw“nothing to unscan”},a.prototype.setState=function(a,b){var c,d;this.head=typeof (c=typeof b==“undefined”||b===null?undefined:b.head)!=“undefined”&&c!==null?c:this.head,this.last=typeof (d=typeof b==“undefined”||b===null?undefined:b.last)!=“undefined”&&d!==null?d:this.last,this.captures=a.slice(1);return this.match=a};return a}()})()},“coffee-script”:function(a,b,c){if(typeof CoffeeScript!=“undefined”&&CoffeeScript!=null)a.exports=CoffeeScript;else throw“Cannot require '”a.id“': CoffeeScript not found”}})(“eco”)