Switch parsers to a model

This commit is contained in:
Samy Pesse
2016-04-30 22:06:16 +02:00
parent 36b49c66c6
commit c1d53ec11f
47 changed files with 168 additions and 2576 deletions
+14 -1
View File
@@ -24,9 +24,22 @@ function parseFile(fs, file, type) {
return fs.readAsString(filepath)
.then(function(content) {
if (type === 'readme') {
return parser.parseReadme(content);
} else if (type === 'glossary') {
return parser.parseGlossary(content);
} else if (type === 'summary') {
return parser.parseSummary(content);
} else if (type === 'langs') {
return parser.parseLanguages(content);
} else {
throw new Error('Parsing invalid type "' + type + '"');
}
})
.then(function(result) {
return [
file,
parser[type](content)
result
];
});
}