mirror of
https://github.com/expressjs/express.git
synced 2026-02-22 03:51:36 +00:00
ocd
This commit is contained in:
@@ -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)
|
||||
}
|
||||
})
|
||||
|
||||
Reference in New Issue
Block a user