Module:Figurines: Difference between revisions
From Zelda Wiki, the Zelda encyclopedia
no edit summary
PhantomCaleb (talk | contribs) No edit summary |
PhantomCaleb (talk | contribs) No edit summary |
||
Line 144: | Line 144: | ||
function p.Report(frame) | function p.Report(frame) | ||
local report = "" | |||
report = report..h.report("TWW") | |||
report = report..h.report("TMC") | |||
if report == "" then | |||
report = "{{Good}} No issues detected—All subjects which have figurines in [[Figurines in The Wind Waker|TWW]] or [[Figurines in The Minish Cap|TMC]] have this template on their respective articles." | |||
end | |||
return frame:preprocess(report) | |||
end | |||
function h.report(game) | |||
local utilsMarkup = require("Module:UtilsMarkup") | |||
local report = "" | |||
local articlesWithFigurines = TransclusionArguments.query({ | |||
template = "Template:Figurines", | |||
parameter = "1", | |||
argument = game, | |||
}) | |||
articlesWithFigurines = utilsTable.map(articlesWithFigurines, "_pageName") | |||
local subjectsWithFigurines = utilsCargo.query("Figurines2", "subjects", { | |||
where = string.format("game = '%s'", game) | |||
}) | |||
subjectsWithFigurines = utilsTable.map(subjectsWithFigurines, "subjects") | |||
subjectsWithFigurines = utilsTable.flatMap(subjectsWithFigurines, utilsString.split) | |||
local articlesMissingFigurines = utilsTable.difference(subjectsWithFigurines, articlesWithFigurines) | |||
if #articlesMissingFigurines > 0 then | |||
local listArticles = utilsTable.map(articlesMissingFigurines, utilsMarkup.link) | |||
listArticles = utilsMarkup.bulletList(listArticles) | |||
report = report..string.format("{{Template|Figurines|%s}} should be added to the following articles as they have [[Figurines in %s|Figurines in %s]]:", game, Franchise.shortName(game), Franchise.display(game)) | |||
report = report..listArticles | |||
end | |||
return report | |||
end | end | ||