-- This module forms a rivals.com URL for local p =
-- Known schools with dedicated URLslocal webname =
-- Known schools without dedicated urls or simple search stringslocal searchname =
local function ucfirst(ta) local t1 = mw.ustring.gsub(ta, '^(%w)(.*)$', '%1') or local t2 = mw.ustring.gsub(ta, '^(%w)(.*)$', '%2') or ta return t1:upper .. t2end
function p.url(frame) local t = (frame.args['team'] or ):lower local y = tonumber(frame.args['year'] or ) or local sport = frame.args['sport'] or 'football'
if webname[t] then return 'http://' .. t .. '.rivals.com/commitments/' .. sport .. '/' .. y else local sn = searchname[t] or ucfirst(t) sn = mw.ustring.gsub(sn, '([a-z])state$', '%1%%2520State') return 'https://n.rivals.com/search#?formValues=%257B%2522sport%2522:%2522' .. (sport
return p