下面是花瓣的一个模板引擎,是不是先写成html再用什么工具能生成(function(rt){vartemplates=rt.templates,attrs=function(){returnrt.attrs.apply(rt,arguments)},_=function(){returnrt._.apply(rt,arguments)},img=function(){returnrt.img.apply(rt,arguments)},imgURL=function(){returnrt.imgURL.apply(rt,arguments)},imgSize=function(){returnrt.imgSize.apply(rt,arguments)},avatar=function(){returnrt.avatar.apply(rt,arguments)},isVerified=function(){returnrt.isVerified.apply(rt,arguments)},url=function(){returnrt.url.apply(rt,arguments)},mkurl=function(){returnrt.mkurl.apply(rt,arguments)},GACampaignURL=function(){returnrt.GACampaignURL.apply(rt,arguments)},escape=function(){returnrt.escape.apply(rt,arguments)},__t=rt.templates,emerge=function(){returnrt.renderSync.apply(rt,arguments)};__t["base/people_pins"]=function(locals){varbuf=[];with(locals||{}){varinterp,__val__=emerge("base/header");buf.push(null==__val__?"":__val__);var__val__=emerge("base/people_layout",{req:req,user:page.user,ctx:"pins",body_tpl:"base/people_pins_body",page:page});buf.push(null==__val__?"":__val__)}returnbuf.join("")},__t["base/chrome_callout"]=function(locals){varbuf=[];with(locals||{}){varinterp;buf.push("<div"),buf.push(attrs({id:"chrome_callout",style:"display:none;","class":"has-closephide"})),buf.push(">"class":"wrapper"})),buf.push(">"class":"introsheet"})),buf.push(">安装花瓣的chrome采集工具,你可以方便地收集网络上的图片,
视频及网页截图,这是花瓣的精髓所在。target:"_blank",href:"#","class":"close"onclick:"returnfalse;","class":"install-extensionbtnbtn18rbtn"})),buf.push(">安装花瓣Chrome扩展})),buf.push('>
}returnbuf.join("")},__t["base/header_main_menu"]=function(locals){varbuf=[];with(locals||{}){varinterp,categories=settings.categories,groups=[];for(vari=0,l=categories.length;ivarcategory=categories[i]; if(category.display===!1)continue;category.nav_link="/favorite/"+category.id+"/",groups[category.group]=groups[category.group]||[],groups[category.group].push(category)}buf.push("id:"header_main_menu"})),buf.push(">"class":"innerclearfix"})),buf.push(">"class":"left-module"})),buf.push(">href:"/following/","class":"main-linkboldfollowing"href:"/all/",})),buf.push(">我的关注"class":"main-linkboldallwith-line"href:"/design/?md=top",})),buf.push(">最新采集"class":"main-linkdesign"href:"/ent/?md=top",})),buf.push(">花瓣设计"class":"main-linkent"href:"/gift/?md=top",})),buf.push(">花瓣娱乐"class":"new-icon"})),buf.push(">"class":"main-linkgift"href:"/weekly/",})),buf.push(">花瓣礼物"class":"main-linkweekly"target:"_blank",})),buf.push(">周刊href:"http://visionblog.huaban.com/",target:"_blank","class":"main-linkvisionblogwith-line"})),buf.push(">访谈href:"/apps/","class":"main-linkapps"})),buf.push(">移动应用"class":"right-module"})),buf.push(">"class":"row-0"})),buf.push(">"class":"group"})),buf.push(">");for(var$index=0,$$l=groups[0].length;$index<$$l;$index++){varcat=groups[0][$index];buf.push("href:cat.nav_link})),buf.push(">"+escape((interp=cat.name)==null?"":interp)+"")}buf.push(""class":"row-1"})),buf.push(">"class":"group"})),buf.push(">");for(var$index=0,$$l=groups[1].length;$index<$$l;$index++){varcat=groups[1][$index];buf.push("href:cat.nav_link})),buf.push(">"+escape((interp=cat.name)==null?"":interp)+"")}buf.push(""class":"group"})),buf.push(">");for(var$index=0,$$l=groups[2].length;$index<$$l;$index++){varcat=groups[2][$index];buf.push("href:cat.nav_link})),buf.push(">"+escape((interp=cat.name)==null?"":interp)+"")}buf.push(""class":"row-2"})),buf.push(">"class":"group"})),buf.push(">");for(var$index=0,$$l=groups[3].length;$index<$$l;$index++){varcat=groups[3][$index];buf.push("href:cat.nav_link})),buf.push(">"+escape((interp=cat.name)==null?"":interp)+"")}buf.push(""class":"group"");})),buf.push(">href:"/all/videos/"})),buf.push(">视频");for(var$index=0,$$l=groups[4].length;$index<$$l;$index++){varcat=groups[4][$index];buf.push("href:cat.nav_link})),buf.push(">"+escape((interp=cat.name)==null?"":interp)+"")}buf.push("if(req.promotions&&req.promotions.dropdown_icontxt_promotions&&req.promotions.dropdown_icontxt_promotions.length){buf.push(""class":"grouppromotion"")})),buf.push(">");for(vari=0,$$l=req.promotions.dropdown_icontxt_promotions.length;i<$$l;i++){varpromo=req.promotions.dropdown_icontxt_promotions[i];i<=6&&(buf.push("href:""+promo.promotion_url+"",target:promo.open_in_new_tab?"_blank":"_self","))"class":"brown-link"})),buf.push(">"+escape((interp=promo.title)==null?"":interp)+"}buf.push("}buf.push(""class":"bottom-bar"})),buf.push(">onclick:"app.switchHeaderTo('side');returnfalse;",href:"#","class":"to-sidebtn-with-iconbtn"})),buf.push(">"class":"pin-icon"})),buf.push(">"class":"text"})),buf.push(">固定到左侧"class":"up-arrow"})),buf.push('>')}returnbuf.join("")},__t["base/people_likes_boards"]=function(locals){varbuf=[];with(locals||{}){varinterp,__val__=emerge("base/header");buf.push(null==__val__?"":__val__);var__val__=emerge("base/people_layout",{req:req,user:page.user,ctx:"likes",body_tpl:"base/people_likes_boards_body",page:page});buf.push(null==__val__?"":__val__)}returnbuf.join("")}........})(app);
相关分类