Standardized naming for bundled extensions

This commit is contained in:
Titus 2012-06-20 21:11:43 -06:00
parent 5d56cce321
commit 0218913efa
2 changed files with 3 additions and 2 deletions

View File

@ -228,7 +228,8 @@ if (typeof module !== 'undefind' && typeof exports !== 'undefined' && typeof req
});
// Load extensions into Showdown namespace
extensions.forEach(function(ext){
Showdown.extensions[ext] = require('./extensions/' + ext);
var name = ext.replace(/[_-]|\\s/g, '').toLowerCase();
Showdown.extensions[name] = require('./extensions/' + ext);
});
}
}

View File

@ -78,7 +78,7 @@ if (path.existsSync('test/extensions')) {
}
// Build converter with extension included
var extension = showdown.extensions[ext];
var extension = showdown.extensions[ext.replace(/[_-]||\s/g, '').toLowerCase()];
if (!extension) {
throw "Could not load extension '" + ext + "'. Did you forget module.exports?";
}