fis-parser-imweb-tplv2
Advanced tools
Comparing version 0.0.4 to 0.0.5
18
index.js
@@ -45,2 +45,20 @@ 'use strict'; | ||
}) | ||
.replace(/<%=\s*include\(['"]([^'"]+)['"]\)(\([^\)]*\))\s*%>/g, function (all, filename, args) { | ||
var fullname = path.resolve(file.dirname, filename), | ||
data = ''; | ||
// 添加links | ||
file.links = file.links || []; | ||
fullname = fullname.replace(/\\/g,'/'); | ||
if(fullname.indexOf(root) === 0){ | ||
file.addLink(fullname.substring(root.length)); | ||
} | ||
if(fs.existsSync(fullname)) { | ||
data = fs.readFileSync(fullname, {'encoding': 'utf8'}); | ||
return "', " + compileTmpl(data) + args + ", '"; | ||
} else { | ||
console.log('tpl:' + fullname + ' not found!'); | ||
return 'tpl:' + fullname + ' not found!'; | ||
} | ||
}) | ||
.replace(/<%==(.*?)%>/g, "', opt.encodeHtml($1), '") | ||
@@ -47,0 +65,0 @@ .replace(/<%=(.*?)%>/g, "', $1, '") |
@@ -75,3 +75,3 @@ { | ||
"scripts": {}, | ||
"version": "0.0.4" | ||
"version": "0.0.5" | ||
} |
5484
72