Module:Flagg/Altvar data

MyWikiBiz, Author Your Legacy — Sunday December 22, 2024
Jump to navigationJump to search

This module contains the data used by Module:Flagg for sports and military links. The (case-insensitive) codes for each sport or military branch are on the left side of the first table in the module code; their aliases are in the second table. The "age" parameter is the age limit for youth sports teams; it is only necessary if the data for the wanted sport uses the parameter (search for "..age").

Table

Using the list_all function of this module, this list gives the same data in HTML table format. Either the main codes (generally based on the names of the corresponding specialized templates, given in the last column) or their aliases can be used to identify a sport or military branch in Template:Flagg. All codes are case-, space- and hyphen-insensitive, so e.g. the air force altvar can be given as airforce, air force, Air Force, air-force, etc.

The altlink is the default link suffix; if the suffix for a sport contains the green and italicized word "age", the age limit must be specified using Template:Para in the Flagg template. The altvar is used in country data templates to specify sports- or military-specific flag variants (using |flag alias-altvar=... in their code) and override the link target (|link alias-altvar=...) and display name (|name alias-altvar=...).

CodeAliasesAltlink (suffix)AltvarTemplate
sbwwomen'ssoftballwomen's national softball teamsoftballsbw
fsfutsalnational futsal teamfutsalfutsal
arfaustralianrulesfootballnational Australian rules football teamAustralian rules footballarf
bkbasketballnational basketball teambasketballbk
svbwwomen'ssittingvolleyvallwomen's sitting national volleyball teamsitting volleyballsvbw
iihjjuniorinlinehockeymen's national junior inline hockey teaminline hockeyiihj
wightmanwightmancupWightman Cup teamtenniswightman
speedwaynational speedway teamspeedwayspeedway
ishicesledgehockeymen's national ice sledge hockey teamsledge hockeyish
iihwwomen'sinlinehockeywomen's national inline hockey teaminline hockeyiihw
bandywwomen'sbandywomen's national bandy teambandybandyW
fswwomen'sfutsalwomen's national futsal teamfutsalfsw
hbjjuniorhandballnational junior handball teamhandballhbj
ru7rugbysevens
rugbyunionsevens
national rugby union team (sevens)rugby sevensru7
bswbeachsoccerwomen
women'sbeachsoccer
women's national beach soccer teamwomen's beach soccerbeachsoccerwomen
bsbeachsoccernational beach soccer teambeach soccerbeachsoccer
navyNavynavalnavy
rhmrollerhockeynational roller hockey teamroller hockeyrhm
rollerderbynational roller derby teamroller derbyRollerDerby
hbwywomen'syouthhandballwomen's youth national handball teamhandballhbwy
bbbaseballnational baseball teambaseballbb
bkwwomen'sbasketballwomen's national basketball teambasketballbkw
afamericanfootballnational American football teamAmerican footballaf
gbgoalballmen's national goalball teamgoalballgb
hbhandballnational handball teamhandballhb
fhwwomen'sfieldhockeywomen's national field hockey teamfield hockeyfhw
ihwwomen'sicehockeywomen's national ice hockey teamice hockeyihw
cr19youthcricket
under19cricket
national under-19 cricket teamcricketcr19
nbnetballnational netball teamnetballnb
iflmlacrosse
men'slacrosse
men's national lacrosse teamlacrosseiflm
bkuyouthbasketballmen's national under-age basketball teambasketballbku
sbsoftballmen's national softball teamsoftballsb
bhwwomen'sbeachhandballwomen's national beach handball teambeach handballbhw
fhmmen'sfieldhockey
fieldhockey
fh
men's national field hockey teamfield hockeyfhm
crcricketnational cricket teamcricketcr
ih18under18icehockeymen's national under-18 ice hockey teamice hockeyih18
fedfedcupFed Cup teamtennisfed
fbwuwomen'syouthfootballwomen's national under-age football teamfootballfbwu
iilindoorlacrossenational indoor lacrosse teamlacrosseiil
rurugbyunionnational rugby union teamrugby unionru
ihw18women'sunder18icehockeywomen's national under-18 ice hockey teamice hockeyihw18
armyArmyarmyarmy
crwwomen'scricketnational women's cricket teamcricketcrw
rhwwomen'srollerhockeywomen's national roller hockey teamroller hockeyrhw
wbkwwomen'swheelchairbasketballwomen's national wheelchair basketball teamwheelchair basketballwbkw
ruwwomen'srugbyunionwomen's national rugby union teamrugby unionruw
korfkorfballnational korfball teamkorfballkorf
wpwaterpolomen's national water polo teamwater polowp
ru7wwomen'srugbyunionsevens
women'srugbysevens
women's national rugby union team (sevens)rugby sevensru7w
svbsittingvolleyvallmen's national sitting volleyball teamsitting volleyballsvb
arfwwomen'saustralianrulesfootballwomen's national Australian rules football teamAustralian rules footballarfw
airforceAir Forceair forceair force
bbstatebaseballstatestate baseball teambaseballbb-state
wbkwheelchairbasketballmen's national wheelchair basketball teamwheelchair basketballwbk
vbwwomen'svolleyballwomen's national volleyball teamvolleyballvbw
fbwmwomen'smilitaryfootballwomen's military national football teamfootballfbwm
hopmanhopmancupat the Hopman Cuptennishopman
vbvolleyballmen's national volleyball teamvolleyballvb
speedwayltlongtracknational long track teamlong trackspeedwayLT
ruuyouthrugbyunionnational under-age rugby union teamrugby unionruu
bkwuwomen'syouthbasketballwomen's national under-age basketball teambasketballbkwu
whrwheelchairrugbynational wheelchair rugby teamwheelchair rugbywhr
hbwwomen'shandballwomen's national handball teamhandballhbw
p&ppitchandputtmen's national pitch and putt teampitch and puttp&p
wpwwomen'swaterpolowomen's national water polo teamwater polowpw
hbwjwomen'sjuniorhandballwomen's junior national handball teamhandballhbwj
iihinlinehockeymen's national inline hockey teaminline hockeyiih
fboolympicfootballOlympic football teamfootballfbo
bhbeachhandballnational beach handball teambeach handballbh
fbuyouthfootballnational under-age football teamfootballfbu
ihjjunioricehockeymen's national junior ice hockey teamice hockeyihj
afujunioramericanfootballnational junior American football teamAmerican footballafu
bandynational bandy teambandybandy
flufl19men's national under-19 floorball teamfloorballflu
davisdaviscupDavis Cup teamtennisdavis
bdbadmintonnational badminton teambadmintonbd
fbla'footballA' national football teamfootballfbl
flwuflw19
flwu19
women's national under-19 floorball teamfloorballflw19
hbyyouthhandballnational youth handball teamhandballhby
bbwwomen'sbaseballwomen's national baseball teambaseballbbw
kdkabaddinational kabaddi teamKabaddikd
rlrugbyleaguenational rugby league teamrugby leaguerl
gbwwomen'sgoalballwomen's national goalball teamgoalballgbw
fbwwomen'sfootballwomen's national football teamfootballfbw
flwwomen'sfloorballwomen's national floorball teamfloorballflw
fbmmilitaryfootballmilitary national football teamfootballfbm
iflwwomen'slacrossewomen's national lacrosse teamlacrosseiflw
ihicehockeymen's national ice hockey teamice hockeyih
fbafootballassociationfootball associationfootballfba
afwwomen'samericanfootballwomen's national American football teamAmerican footballafw
ruarugbyunionaA national rugby union teamrugby union-aruA
fbfootballnational football teamfootballfb
iflwuiflwu19women's national under-19 lacrosse teamlacrosseiflwu19
flfloorballmen's national floorball teamfloorballfl

Template:Sandbox other


local p = {}

function p.alttable(age)

local alt_map = {
["af"]={altlink="national American football team";altvar="American football"};
["afu"]={altlink="national junior American football team";altvar="American football"};
["afw"]={altlink="women's national American football team";altvar="American football"};
["arf"]={altlink="national Australian rules football team";altvar="Australian rules football";mw="men's"};
["arfw"]={altlink="women's national Australian rules football team";altvar="Australian rules football";mw="women's"};
["bandy"]={altlink="national bandy team";altvar="bandy"};
["bandyw"]={altlink="women's national bandy team";altvar="bandy";template="bandyW"};
["bb"]={altlink="national baseball team";altvar="baseball"};
["bbstate"]={altlink="state baseball team";altvar="baseball";template="bb-state"};
["bbw"]={altlink="women's national baseball team";altvar="baseball"};
["bd"]={altlink="national badminton team";altvar="badminton"};
["bs"]={altlink="national beach soccer team";altvar="beach soccer";template="beachsoccer"};
["bsw"]={altlink="women's national beach soccer team";altvar="women's beach soccer";template="beachsoccerwomen"};
["bh"]={altlink="national beach handball team";altvar="beach handball"};
["bhw"]={altlink="women's national beach handball team";altvar="beach handball";mw="women's"};
["bk"]={altlink="national basketball team";altvar="basketball"};
["bku"]={altlink="men's national under-"..age.." basketball team";altvar="basketball";age="under-"..age};
["bkw"]={altlink="women's national basketball team";altvar="basketball";mw="women's"};
["bkwu"]={altlink="women's national under-"..age.." basketball team";altvar="basketball";mw="women's";age="under-"..age};
["cr"]={altlink="national cricket team";altvar="cricket"};
["cr19"]={altlink="national under-19 cricket team";altvar="cricket";age="Under-19"};
["crw"]={altlink="national women's cricket team";altvar="cricket";mw="women's"};
["davis"]={altlink="Davis Cup team";altvar="tennis";mw="Davis"};
["fb"]={altlink="national football team";altvar="football"};
["fba"]={altlink="football association";altvar="football"};
["fbl"]={altlink="A' national football team";altvar="football";mw="A'"};
["fbm"]={altlink="military national football team";altvar="football"};
["fbo"]={altlink="Olympic football team";altvar="football";mw="Olympic"};
["fbu"]={altlink="national under-"..age.." football team";altvar="football";age="under-"..age};
["fbw"]={altlink="women's national football team";altvar="football";mw="women's"};
["fbwm"]={altlink="women's military national football team";altvar="football";mw="women's"};
["fbwu"]={altlink="women's national under-"..age.." football team";altvar="football";mw="women's";age="under-"..age};
["fed"]={altlink="Fed Cup team";altvar="tennis";mw="Fed"};
["fhm"]={altlink="men's national field hockey team";altvar="field hockey";mw="men's"};
["fhw"]={altlink="women's national field hockey team";altvar="field hockey";mw="women's"};
["fl"]={altlink="men's national floorball team";altvar="floorball";mw="men's"};
["flu"]={altlink="men's national under-19 floorball team";altvar="floorball";mw="men's";age="under-19"};
["flw"]={altlink="women's national floorball team";altvar="floorball";mw="women's"};
["flwu"]={altlink="women's national under-19 floorball team";altvar="floorball";mw="women's";template="flw19"};
["fsw"]={altlink="women's national futsal team";altvar="futsal";mw="women's"};
["fs"]={altlink="national futsal team";altvar="futsal";template="futsal"};
["gb"]={altlink="men's national goalball team";altvar="goalball";mw="men's"};
["gbw"]={altlink="women's national goalball team";altvar="goalball";mw="women's"};
["hb"]={altlink="national handball team";altvar="handball"};
["hbj"]={altlink="national junior handball team";altvar="handball"};
["hbw"]={altlink="women's national handball team";altvar="handball";mw="women's"};
["hbwj"]={altlink="women's junior national handball team";altvar="handball"};
["hbwy"]={altlink="women's youth national handball team";altvar="handball";mw="women's"};
["hby"]={altlink="national youth handball team";altvar="handball"};
["hopman"]={altlink="at the Hopman Cup";altvar="tennis";mw="Hopman"};
["iflm"]={altlink="men's national lacrosse team";altvar="lacrosse";mw="men's"};
["iflw"]={altlink="women's national lacrosse team";altvar="lacrosse";mw="women's"};
["iflwu"]={altlink="women's national under-19 lacrosse team";altvar="lacrosse";mw="women's";template="iflwu19"};
["ih"]={altlink="men's national ice hockey team";altvar="ice hockey";mw="men's"};
["ih18"]={altlink="men's national under-18 ice hockey team";altvar="ice hockey";mw="men's";age="under-18"};
["ihj"]={altlink="men's national junior ice hockey team";altvar="ice hockey";mw="men's";age="junior"};
["ihw"]={altlink="women's national ice hockey team";altvar="ice hockey";mw="women's"};
["ihw18"]={altlink="women's national under-18 ice hockey team";altvar="ice hockey";mw="women's";age="U-18"};
["iih"]={altlink="men's national inline hockey team";altvar="inline hockey"};
["iihj"]={altlink="men's national junior inline hockey team";altvar="inline hockey";mw="junior"};
["iihw"]={altlink="women's national inline hockey team";altvar="inline hockey";mw="women's"};
["iil"]={altlink="national indoor lacrosse team";altvar="lacrosse";mw="men's"};
["ish"]={altlink="men's national ice sledge hockey team";altvar="sledge hockey"};
["kd"]={altlink="national kabaddi team";altvar="Kabaddi"};
["korf"]={altlink="national korfball team";altvar="korfball"};
["nb"]={altlink="national netball team";altvar="netball"};
["p&p"]={altlink="men's national pitch and putt team";altvar="pitch and putt"};
["rhm"]={altlink="national roller hockey team";altvar="roller hockey";mw="men's"};
["rhw"]={altlink="women's national roller hockey team";altvar="roller hockey";mw="women's"};
["rl"]={altlink="national rugby league team";altvar="rugby league"};
["rollerderby"]={altlink="national roller derby team";altvar="roller derby";template="RollerDerby"};
["ru"]={altlink="national rugby union team";altvar="rugby union"};
["ru7"]={altlink="national rugby union team (sevens)";altvar="rugby sevens"};
["ru7w"]={altlink="women's national rugby union team (sevens)";altvar="rugby sevens";mw="women's"};
["rua"]={altlink="A national rugby union team";altvar="rugby union-a";template="ruA"};
["ruu"]={altlink="national under-"..age.." rugby union team";altvar="rugby union";age="under-"..age};
["ruw"]={altlink="women's national rugby union team";altvar="rugby union";mw="women's"};
["sb"]={altlink="men's national softball team";altvar="softball";mw="men's"};
["sbw"]={altlink="women's national softball team";altvar="softball";mw="women's"};
["speedway"]={altlink="national speedway team";altvar="speedway"};
["speedwaylt"]={altlink="national long track team";altvar="long track";template="speedwayLT"};
["svb"]={altlink="men's national sitting volleyball team";altvar="sitting volleyball";mw="men's"};
["svbw"]={altlink="women's sitting national volleyball team";altvar="sitting volleyball";mw="women's"};
["vb"]={altlink="men's national volleyball team";altvar="volleyball";mw="men's"};
["vbw"]={altlink="women's national volleyball team";altvar="volleyball";mw="women's"};
["wbk"]={altlink="men's national wheelchair basketball team";altvar="wheelchair basketball"};
["wbkw"]={altlink="women's national wheelchair basketball team";altvar="wheelchair basketball";mw="women's"};
["whr"]={altlink="national wheelchair rugby team";altvar="wheelchair rugby"};
["wightman"]={altlink="Wightman Cup team";altvar="tennis";mw="Wightman"};
["wp"]={altlink="men's national water polo team";altvar="water polo"};
["wpw"]={altlink="women's national water polo team";altvar="water polo";mw="women's"};
["airforce"]={altlink="Air Force";altvar="air force";template="air force"};
["army"]={altlink="Army";altvar="army"};
["navy"]={altlink="Navy";altvar="naval"}
}

local alt_aliases = {
["a'football"]="fbl";
["americanfootball"]="af";
["australianrulesfootball"]="arf";
["badminton"]="bd";
["baseball"]="bb";
["baseballstate"]="bbstate";
["beachhandball"]="bh";
["beachsoccer"]="bs";
["beachsoccerwomen"]="bsw";
["basketball"]="bk";
["cricket"]="cr";
["daviscup"]="davis";
["fedcup"]="fed";
["football"]="fb";
["footballassociation"]="fba";
["fh"]="fhm";
["fieldhockey"]="fhm";
["fl19"]="flu";
["floorball"]="fl";
["flw19"]="flwu";
["flwu19"]="flwu";
["futsal"]="fs";
["goalball"]="gb";
["handball"]="hb";
["hopmancup"]="hopman";
["icehockey"]="ih";
["icesledgehockey"]="ish";
["iflwu19"]="iflwu";
["indoorlacrosse"]="iil";
["inlinehockey"]="iih";
["junioramericanfootball"]="afu";
["juniorhandball"]="hbj";
["junioricehockey"]="ihj";
["juniorinlinehockey"]="iihj";
["kabaddi"]="kd";
["korfball"]="korf";
["lacrosse"]="iflm";
["men'sfieldhockey"]="fhm";
["men'slacrosse"]="iflm";
["militaryfootball"]="fbm";
["netball"]="nb";
["olympicfootball"]="fbo";
["pitchandputt"]="p&p";
["rollerhockey"]="rhm";
["rugbyleague"]="rl";
["rugbysevens"]="ru7";
["rugbyunion"]="ru";
["rugbyuniona"]="rua";
["rugbyunionsevens"]="ru7";
["softball"]="sb";
["longtrack"]="speedwaylt";
["sittingvolleyvall"]="svb";
["under18icehockey"]="ih18";
["under19cricket"]="cr19";
["volleyball"]="vb";
["waterpolo"]="wp";
["wheelchairbasketball"]="wbk";
["wheelchairrugby"]="whr";
["wightmancup"]="wightman";
["women'samericanfootball"]="afw";
["women'saustralianrulesfootball"]="arfw";
["women'sbandy"]="bandyw";
["women'sbaseball"]="bbw";
["women'sbasketball"]="bkw";
["women'sbeachhandball"]="bhw";
["women'sbeachsoccer"]="bsw";
["women'scricket"]="crw";
["women'sfieldhockey"]="fhw";
["women'sfloorball"]="flw";
["women'sfootball"]="fbw";
["women'sfutsal"]="fsw";
["women'sgoalball"]="gbw";
["women'shandball"]="hbw";
["women'sicehockey"]="ihw";
["women'sinlinehockey"]="iihw";
["women'srollerhockey"]="rhw";
["women'sunder18icehockey"]="ihw18";
["women'sjuniorhandball"]="hbwj";
["women'slacrosse"]="iflw";
["women'smilitaryfootball"]="fbwm";
["women'srugbysevens"]="ru7w";
["women'srugbyunion"]="ruw";
["women'srugbyunionsevens"]="ru7w";
["women'ssittingvolleyvall"]="svbw";
["women'ssoftball"]="sbw";
["women'svolleyball"]="vbw";
["women'swaterpolo"]="wpw";
["women'swheelchairbasketball"]="wbkw";
["women'syouthbasketball"]="bkwu";
["women'syouthfootball"]="fbwu";
["women'syouthhandball"]="hbwy";
["youthbasketball"]="bku";
["youthcricket"]="cr19";
["youthfootball"]="fbu";
["youthhandball"]="hby";
["youthrugbyunion"]="ruu"
}

return alt_map, alt_aliases

end

function p.list_all(frame)

--Load data
local alt_map, alt_aliases = p.alttable("''<span style=\"color:green;\">age</span>''")

--Add aliases to map table
for k,v in pairs(alt_map) do
  alt_map[k].aliases = {}
end
local wrong_aliases = {}
table.sort(alt_aliases)
for k,v in pairs(alt_aliases) do
  if alt_map[v]
    then table.insert(alt_map[v].aliases,k)
    else table.insert(wrong_aliases,k)
  end
end

--Create html table & header row
local list = mw.html.create("table")
list:addClass("wikitable sortable collapsible")
local head = list:tag("tr")
head:tag("th"):wikitext("Code")
head:tag("th"):wikitext("Aliases")
head:tag("th"):wikitext("Altlink (suffix)")
head:tag("th"):wikitext("Altvar")
head:tag("th"):wikitext("Template")

--Append rows to create table body
table.sort(alt_map)
for k,v in pairs(alt_map) do
  local row = list:tag("tr")
  local temp = alt_map[k].template or k
  row:tag("td"):wikitext("<code>"..k.."</code>")
  row:tag("td"):wikitext("<code>"..table.concat(alt_map[k].aliases,"</code><br/><code>").."</code>")
  row:tag("td"):wikitext(alt_map[k].altlink)
  row:tag("td"):wikitext(alt_map[k].altvar)
  row:tag("td"):wikitext("[[Template:"..temp.."|"..temp.."]]")
end
if #wrong_aliases > 0 then
  local wrong_list = "These aliases point to non-existing data: <code>"..table.concat(wrong_aliases,"</code> <code>").."</code>"
  list:tag("tr"):tag("td"):attr("colspan","4"):css("color","red"):wikitext(wrong_list)
end

return list

end

return p