Skip to content

Commit

Permalink
gan-sorting: handle redirects to {{GA nominee}}
Browse files Browse the repository at this point in the history
  • Loading branch information
siddharthvp committed Mar 12, 2023
1 parent d0fb414 commit 2f7fc31
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions reports/gan-sorting.js
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,8 @@ const {populateWikidataShortdescs, normaliseShortdesc} = require('./commons');
new: 0
};

const GANTemplateNameRegex = /^GA ?(c(andidate)?|n(om(inee)?)?)$/i;

for await (let data of bot.massQueryGen({
"action": "query",
"prop": "revisions",
Expand All @@ -86,13 +88,13 @@ const {populateWikidataShortdescs, normaliseShortdesc} = require('./commons');
let wkt = new bot.wikitext(text);
let template = wkt.parseTemplates({
count: 1,
namePredicate: name => name === 'GA nominee'
namePredicate: name => GANTemplateNameRegex.test(name)
})[0];

if (!template) {
template = wkt.parseTemplates({
recursive: true
}).find(t => t.name === 'GA nominee');
}).find(t => GANTemplateNameRegex.test(t.name));
}
return template;
};
Expand Down

0 comments on commit 2f7fc31

Please sign in to comment.