Merge pull request #26 from j-selby/master

Filter out articles in titles when sorting
This commit is contained in:
Flame Sage 2017-06-15 00:15:11 -04:00 committed by GitHub
commit 5c04f40997
1 changed files with 10 additions and 1 deletions

View File

@ -124,7 +124,16 @@ function processGame(game) {
model.testcase_date = recent.date;
}
let section_id = `${model.title[0]}`.toLowerCase();
const toTrim = ["the", "a", "an"];
let trimmedTitle = model.title.toLowerCase();
toTrim.forEach(trim => {
if (trimmedTitle.startsWith(trim)) {
trimmedTitle = trimmedTitle.substr(trim.length + 1);
}
});
let section_id = `${trimmedTitle[0]}`;
if (!section_id.match(/[a-z]+/)) {
section_id = "#";
}