Jump to navigation
Jump to search
Capture function now creates a table and shows all user inputs from the call
m (better) |
(Capture function now creates a table and shows all user inputs from the call) Tags: Mobile edit Mobile web edit |
||
Line 9: | Line 9: | ||
} | } | ||
local function _capture( args ) | local function _capture( args, frame ) | ||
local guide = "Pokémon Ranger" | local guide = "Pokémon Ranger" | ||
local root = mw.html.create( 'table' ) | |||
:addClass( 'wikitable mid-table' ) | |||
:css( 'text-align', 'center' ) | |||
local row = root:tag( 'tr' ) | |||
row:tag( 'th' ):wikitext( "Pokémon" ) | |||
row:tag( 'th' ):wikitext( "Field Move" ) | |||
row:tag( 'th' ):wikitext( "Poké Assist" ) | |||
row:tag( 'th' ):wikitext( "Loops" ) | |||
local monData = {} | |||
local rows = "" | |||
local row = {} | |||
for i,v in ipairs(args) do | |||
monData = data[guide][v] | |||
row = root:tag( 'tr' ) | |||
row:tag( 'td' ):wikitext( "[[File:" .. shortname[ guide ] .. ' ' .. monData.name .. ".png|" .. monData.name .. "]]" .. " " .. frame:expandTemplate{ title = 'bp', args = { monData.name } } ) | |||
if monData.move == "None" then | |||
move = "None" | |||
elseif monData.rating == "1" then | |||
move = monData.move | |||
else | |||
move = monData.move .. " " .. monData.rating | |||
end | |||
row:tag( 'td' ):wikitext( "[[File:" .. shortname[ guide ] .. ' ' .. move .. ' ' .. "Icon" .. ".png|" .. move .. "]]") | |||
row:tag( 'td' ):wikitext( monData.assist ) | |||
row:tag( 'td' ):wikitext( monData.loops ) | |||
end | |||
return tostring( root ) | |||
end | end | ||
Line 78: | Line 92: | ||
local args = getArgs( frame, { wrappers = 'Template:Pokemon Ranger/Capture row' } ) | local args = getArgs( frame, { wrappers = 'Template:Pokemon Ranger/Capture row' } ) | ||
return _capture( args ) | return _capture( args, frame ) | ||
end | end | ||
return p | return p |