Module:Tag: Difference between revisions
From TwogPedia
No edit summary |
No edit summary |
||
Line 12: | Line 12: | ||
args.name = mw.uri.decode(args.name) | args.name = mw.uri.decode(args.name) | ||
local tables = ' | local tables = 'News' | ||
local fields = '_pageName, tags' | local fields = '_pageName, tags' | ||
local cargoArgs = { | local cargoArgs = { |
Revision as of 22:58, 9 May 2023
Documentation for this module may be created at Module:Tag/doc
local getArgs = require('Module:Arguments').getArgs
local cargo = mw.ext.cargo
local Tag = {}
function Tag.main(frame)
local args = getArgs(frame)
local tableContainer = mw.html.create('div')
if args.name == nil then return tableContainer:wikitext('No tag found') end
args.name = mw.uri.decode(args.name)
local tables = 'News'
local fields = '_pageName, tags'
local cargoArgs = {
where = 'tags HOLDS LIKE "%' .. args.name .. '%"'
}
local results = cargo.query(tables, fields, cargoArgs)
local mapWins = 0
local mapLosses = 0
local wins = 0
local losses = 0
if #results > 0 then
for i = 1, #results do
local result = results[i]
local news = mw.html.create('div'):wikitext('[[' .. result._pageName .. ']]')
tableContainer:node(news)
-- determine if the team in question won
end
else
return tableContainer:wikitext('No news found with the tag "' .. args.name .. '"')
end
return tableContainer
end
return Tag
No categories