Module:BattleTeam: Difference between revisions
From Cassette Beasts
No edit summary |
No edit summary |
||
| Line 6: | Line 6: | ||
for _, move in ipairs(move_list) do | for _, move in ipairs(move_list) do | ||
local type_specified = mw.text.split(frame.args[1], ";", true) | |||
local row = mw.html.create('tr') | local row = mw.html.create('tr') | ||
:attr('align', 'left') | :attr('align', 'left') | ||
local cell = row:tag('td') | local cell = row:tag('td') | ||
:cssText('display: inline-block; line-height: 1.1em; background-repeat: no-repeat; background-position: calc(0% - 0.21em) center; background-size: 1.66em; padding-left: 1.75em; background-color: transparent;') | :cssText('display: inline-block; line-height: 1.1em; background-repeat: no-repeat; background-position: calc(0% - 0.21em) center; background-size: 1.66em; padding-left: 1.75em; background-color: transparent;') | ||
:wikitext(frame:callParserFunction('#invoke', 'Database', 'get_link', 'move', move)) | |||
: | if #type_specified <= 1 then | ||
cell:addClass(frame:callParserFunction('#invoke', 'Database', 'get_type', move, 'elemental_type') .. "_type") | |||
:wikitext(frame:callParserFunction('#invoke', 'Database', 'get_link', 'move', move)) | |||
else | |||
cell:addClass(type_specified[1] .. "_type") | |||
:wikitext(type_specified[2]) | |||
end | |||
cell:allDone() | |||
table.insert(result, tostring(cell)) | table.insert(result, tostring(cell)) | ||
end | end | ||
Revision as of 21:42, 13 September 2026
Documentation for this module may be created at Module:BattleTeam/doc
local p = {}
function p.get_moves(frame)
local move_list = mw.text.split(frame.args[1], ",", true)
local result = {}
for _, move in ipairs(move_list) do
local type_specified = mw.text.split(frame.args[1], ";", true)
local row = mw.html.create('tr')
:attr('align', 'left')
local cell = row:tag('td')
:cssText('display: inline-block; line-height: 1.1em; background-repeat: no-repeat; background-position: calc(0% - 0.21em) center; background-size: 1.66em; padding-left: 1.75em; background-color: transparent;')
if #type_specified <= 1 then
cell:addClass(frame:callParserFunction('#invoke', 'Database', 'get_type', move, 'elemental_type') .. "_type")
:wikitext(frame:callParserFunction('#invoke', 'Database', 'get_link', 'move', move))
else
cell:addClass(type_specified[1] .. "_type")
:wikitext(type_specified[2])
end
cell:allDone()
table.insert(result, tostring(cell))
end
return table.concat(result)
end
return p
