소스 검색

Extension autoloading fix

Pavel Lang 13 년 전
부모
커밋
a67421ba2a
1개의 변경된 파일2개의 추가작업 그리고 2개의 파일을 삭제
  1. 2 2
      src/showdown.js

+ 2 - 2
src/showdown.js

@@ -122,10 +122,10 @@ if (typeof module !== 'undefind' && typeof exports !== 'undefined' && typeof req
 
 
 	if (fs) {
 	if (fs) {
 		// Search extensions folder
 		// Search extensions folder
-		var extensions = fs.readdirSync('./src/extensions').filter(function(file){
+		var extensions = fs.readdirSync((__dirname || '.')+'/extensions').filter(function(file){
 			return ~file.indexOf('.js');
 			return ~file.indexOf('.js');
 		}).map(function(file){
 		}).map(function(file){
-			return file.replace('.js', '');
+			return file.replace(/\.js$/, '');
 		});
 		});
 		// Load extensions into Showdown namespace
 		// Load extensions into Showdown namespace
 		extensions.forEach(function(ext){
 		extensions.forEach(function(ext){