//> YAJET -- Yet Another JavaScript Emplate Tengine
//> Author: Mihai Bazon <mihai.bazon@gmail.com>
//> Distributed under the BSD license.  Visit www.yajet.net for details.
//> (c) Mihai Bazon 2010
//>
//> This file is not the full template engine; it's just the jQuery integration.
(function(c){var b;function d(e){if(!b){if(e instanceof YAJET){b=e}else{e=c.extend({with_scope:true},e);b=new YAJET(e);c("script[type=text/x-yajet]").yajet_compile()}}}c.yajet={init:d};function a(f){var e;if(f.firstChild&&f.firstChild.nodeType==8){e=f.firstChild.nodeValue.replace(/\[CDATA\[|\]\]?$/g,"")}else{e=c(f).val()||c(f).html()}return e}c.fn.yajet=function(e,f){d();return this.each(function(){var h=c(this),g=h.attr("yajet-template"),i;if(g){i=b.process(g,e,f)}else{g=h.data("yajet-template");if(!g){g=a(this);g=b.compile(g);h.data("yajet-template",g)}i=g(e)}if(h.attr("yajet-escape-output")){i=b.filter("html",i)}h.html(i)})};c.fn.yajet_compile=function(){d();var e="",f=b.reader_char();this.each(function(){var g=c(this),j=a(this),i=g.attr("name"),h;if(i){if(/\*$/.test(i)){i=i.substr(0,i.length-1);j=f+"(WITH(this)"+j+f+")"}h=g.attr("args")||"";j=f+"(EXPORT "+i+"("+h+")"+j+f+")"}e+=j});b.compile(e);return this}})(jQuery);
