Module:Explorers of Sky Pokémon Exclusive Items table: Difference between revisions
Jump to navigation
Jump to search
m (Jubilee moved page Module:Explorers of Sky Pokémon Exclusive Items table to Module:Explorers of Sky Pokémon Specialized Items table without leaving a redirect) |
No edit summary Tag: Reverted |
||
Line 1: | Line 1: | ||
-------------------------------------------------------------------------------- | -------------------------------------------------------------------------------- | ||
-- | -- | ||
-- Module:Explorers of Sky Pokémon | -- Module:Explorers of Sky Pokémon Specialized Items table | ||
-- | -- | ||
-------------------------------------------------------------------------------- | -------------------------------------------------------------------------------- | ||
Line 9: | Line 9: | ||
function p.main(frame) | function p.main(frame) | ||
local data = require("Module:Explorers of Sky | local data = require("Module:Explorers of Sky Specialized Item Data Cell") | ||
local metatable = {__index = function () return "" end} | local metatable = {__index = function () return "" end} | ||
setmetatable(data, metatable) | setmetatable(data, metatable) | ||
Line 19: | Line 19: | ||
header | header | ||
:tag('tr') | :tag('tr') | ||
:tag('th'):attr("colspan", "2"):cssText("width: 50%"):wikitext(frame:expandTemplate{title = "ExplorersOfSky", args = {" | :tag('th'):attr("colspan", "2"):cssText("width: 50%"):wikitext(frame:expandTemplate{title = "ExplorersOfSky", args = {"Specialized Item"}}):done() | ||
:tag('th'):attr("rowspan", "2"):cssText("width: 50%"):wikitext("Rarity"):done() | :tag('th'):attr("rowspan", "2"):cssText("width: 50%"):wikitext("Rarity"):done() | ||
:tag('tr') | :tag('tr') |
Revision as of 03:42, 28 October 2024
Documentation for this module may be created at Module:Explorers of Sky Pokémon Exclusive Items table/doc
--------------------------------------------------------------------------------
--
-- Module:Explorers of Sky Pokémon Specialized Items table
--
--------------------------------------------------------------------------------
local p = {}
local mw = require('mw')
function p.main(frame)
local data = require("Module:Explorers of Sky Specialized Item Data Cell")
local metatable = {__index = function () return "" end}
setmetatable(data, metatable)
local args = frame.args
local output = mw.html.create()
local header = mw.html.create()
-- Header row
header
:tag('tr')
:tag('th'):attr("colspan", "2"):cssText("width: 50%"):wikitext(frame:expandTemplate{title = "ExplorersOfSky", args = {"Specialized Item"}}):done()
:tag('th'):attr("rowspan", "2"):cssText("width: 50%"):wikitext("Rarity"):done()
:tag('tr')
:tag('th'):cssText("width: 25%"):wikitext("English"):done()
:tag('th'):cssText("width: 25%"):wikitext("Japanese"):done()
-- Data rows
local rows = mw.html.create()
local i = 1
while true do
local row = mw.html.create()
local itemArg = args["item_" .. i]
if not itemArg then
break -- exit loop when no more rows are found
end
row
:tag('tr'):done()
:tag('td'):wikitext(frame:expandTemplate{title = "ExplorersOfSky", args = {(itemArg or "")}}):done()
:tag('td'):wikitext(data[itemArg]["ja"]):done()
:tag('td'):wikitext(data[itemArg]["rarity"]):done()
rows
:node(row)
:allDone()
i = i + 1
end
output
:tag('table'):addClass("MDWiki"):cssText("text-align: center; margin: auto; width: 50%;")
:node(header)
:node(rows)
return tostring(output)
end
return p