25,136
edits
(proof of concept) |
(split out list) |
||
Line 1: | Line 1: | ||
local tournaments = mw.loadData("Module:Trn/data") | |||
local tournaments = | |||
local trn_formatter = {} | local trn_formatter = {} | ||
Line 14: | Line 7: | ||
disambig = frame.args[2] | disambig = frame.args[2] | ||
game = frame.args[3] | game = frame.args[3] | ||
defaultFormat = "n" | |||
if disambig == nil or disambig == "" then | if disambig == nil or disambig == "" then | ||
link = "[[Tournament:"..name.."|"..name.."]]" | link = "[[Tournament:"..name.."|"..name.."]]" | ||
Line 20: | Line 14: | ||
end | end | ||
if game == nil or game == "" then | if game == nil or game == "" then | ||
fstring = | fstring = defaultFormat | ||
else | else | ||
tourney = tournaments[name] | tourney = tournaments[name] | ||
if tourney == nil then | if tourney == nil then | ||
fstring = | fstring = defaultFormat | ||
else | else | ||
fstring = tourney[game] | fstring = tourney[game] | ||
Line 30: | Line 24: | ||
end | end | ||
if fstring == nil or fstring == "" then | if fstring == nil or fstring == "" then | ||
fstring = | fstring = defaultFormat | ||
end | end | ||
result = string.gsub(fstring,"n",link) | result = string.gsub(fstring,"n",link) |