(Created page with "local cargo = mw.ext.cargo local Sponsored = {} function Sponsored.get(frame) local container = mw.html.create('div') :addClass('sponsored-tournaments') local currentTitle = mw.title.getCurrentTitle().text -- Look up Cargo table teams with current page as sponsor local tables = 'Teams' local fields = '_pageName' local cargoArgs = { where = 'sponsors HOLDS "' ..currentTitle .. '"' } local results = cargo.query(tables, fields, cargoArgs) local ul = mw.htm...") |
No edit summary |
||
Line 5: | Line 5: | ||
function Sponsored.get(frame) | function Sponsored.get(frame) | ||
local container = mw.html.create('div') | local container = mw.html.create('div') | ||
:addClass('sponsored | :addClass('sponsored') | ||
local currentTitle = mw.title.getCurrentTitle().text | local currentTitle = mw.title.getCurrentTitle().text | ||
-- Look up Cargo table teams with current page as sponsor | -- Look up Cargo table teams with current page as sponsor |
Revision as of 21:40, 12 September 2022
Documentation for this module may be created at Module:Sponsored teams/doc
local cargo = mw.ext.cargo
local Sponsored = {}
function Sponsored.get(frame)
local container = mw.html.create('div')
:addClass('sponsored')
local currentTitle = mw.title.getCurrentTitle().text
-- Look up Cargo table teams with current page as sponsor
local tables = 'Teams'
local fields = '_pageName'
local cargoArgs = {
where = 'sponsors HOLDS "' ..currentTitle .. '"'
}
local results = cargo.query(tables, fields, cargoArgs)
local ul = mw.html.create('ul')
for r = 1, #results do
local result = results[r]
local li = mw.html.create('li')
:wikitext('[[' .. result._pageName .. ']]')
ul:node(li)
end
return container:node(ul)
end
return Sponsored