This module is rated as beta, and is ready for widespread use. It is still new and should be used with some caution to ensure the results are as expected. |
This module depends on the following other modules: |
Usage
editThis module is used by {{College football conference}}, and is not currently configured to be used directly outside of module space.
Updating the data tables
editAlias
editTo add an alias for an existing school, edit Module:College football conference/alias. The format is
["alias"] = "full name",
where the full name is in Module:College football conference/data.
Data
editTo add a new school, edit Module:College football conference/data. The year keys should be one of the following formats,
["year1-year2"] = "some conference",
if the school was in the conference from year1 to year2 or
["year"] = "some other conference",
if the school was in the conference in year or
["year-"] = "the current conference",
if the school was in the conference from year to present or
["-year"] = "the first conference",
if the school was in the conference from the beginning of time until year.
If you need help making your changes, please ask at Template talk:College football conference.
-- this module implements [[Template:College football conference]]
local p = {}
function p._main(year, school)
if school then
local data = require('Module:College football conference/data')
local alias = require('Module:College football conference/alias')
year = tonumber(year) or 0
local t = data[alias[school] or school]
if not t then
return "N/A"
end
for k,v in pairs(t) do
k = mw.ustring.gsub(k, '^%s*(%d+)%s*$', '%1-%1')
if k:match('^%s*%d*[^%d]%d*%s*$') then
local y1 = mw.ustring.gsub(k, '^%s*(%d*)[^%d](%d*)%s*$', '%1')
local y2 = mw.ustring.gsub(k, '^%s*(%d*)[^%d](%d*)%s*$', '%2')
y1 = tonumber(y1) or year
y2 = tonumber(y2) or year
if year >= y1 and year <= y2 then
return v
end
end
end
return "—"
end
return "N/A"
end
function p.main(frame)
local args = frame:getParent().args
return p._main(args['year'], args['college'])
end
return p