mirror of
https://github.com/zebrajr/express.git
synced 2025-12-06 12:19:51 +01:00
ocd
This commit is contained in:
parent
dcb147608a
commit
1d485840fd
|
|
@ -14,13 +14,13 @@ var app = module.exports = express();
|
|||
app.engine('md', function(path, options, fn){
|
||||
fs.readFile(path, 'utf8', function(err, str){
|
||||
if (err) return fn(err);
|
||||
try{
|
||||
try {
|
||||
var html = md(str);
|
||||
html = html.replace(/\{([^}]+)\}/g, function(_, name){
|
||||
return options[name];
|
||||
return options[name] || '';
|
||||
})
|
||||
fn(null, html);
|
||||
} catch(e){
|
||||
} catch(e) {
|
||||
fn(e)
|
||||
}
|
||||
})
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user