...
|
...
|
@@ -69,11 +69,15 @@ var __parsefile = function(fileKey,filePath,dataModel,callback){ |
|
|
}
|
|
|
|
|
|
var __parseLayout=function(form,str){
|
|
|
var me=this,cache=this.cache;
|
|
|
console.log(form+":"+str);
|
|
|
var layouts=str.match(/\{\{>[^}]*\}\}/g);
|
|
|
return str.replace(/\{\{>[^}]*\}\}/g,function($0){
|
|
|
var name=path.resolve(path.dirname(form),$0.match(/\{\{>\s*([^}]*)\s*\}\}/m)[1]+".html");
|
|
|
return fs.readFileSync(name,'utf8');
|
|
|
var name=path.resolve(path.dirname(form),$0.match(/\{\{>\s*([^}]*)\s*\}\}/m)[1].replace(/\s/g,'')+".html");
|
|
|
var html=fs.readFileSync(name,'utf8');
|
|
|
if(/\{\{>[^}]*\}\}/g.test(html)){
|
|
|
html=__parseLayout(name,html);
|
|
|
}
|
|
|
return html;
|
|
|
});
|
|
|
|
|
|
}
|
...
|
...
|
|