Module:Infobox/skill

local p = {} local root local f

local function addRow(rowArgs) if rowArgs.fieldValue ~= '' then root :tag("tr") :tag("td") :tag("div") :wikitext(rowArgs.fieldName) :done :tag("td") :wikitext(rowArgs.fieldValue) :done :done end end

local function addTitleRow(titleArgs) local renderedTitle = ""

if titleArgs._type ~= "" then renderTitle = f:expandTemplate{ title = "Skill type icon", args = {titleArgs._type} }   end

if titleArgs.name ~= '' then renderedTitle = renderedTitle .. titleArgs.title else renderedTitle = renderedTitle .. ""   end root :tag("tr") :tag("th") :addClass("infoboxname") :attr("colspan", 2) :wikitext(renderedTitle) end

local function addImage(image) local renderedImage if image and image ~= '' then renderedImage = "" else renderedImage = "" end

root :tag("tr") :tag("td") :attr("colspan", 2) :css("text-align", "center") :wikitext(renderedImage) end

local function addDetails root :tag("tr") :tag("th") :attr("colspan", 2) :addClass("infoboxdetails") :wikitext("Details") end

local function valueOrEmpty(value) if value == nil then return "" else return value end end

function p.infobox(frame) f = frame local image = valueOrEmpty(frame.args['image']) local title = valueOrEmpty(frame.args['name']) local _type = valueOrEmpty(frame.args['type'])

root = mw.html.create('table') root:addClass("infoboxtable")

addTitleRow({       title = title,        _type = _type    }) addImage(image) addDetails

addRow({       fieldName = "Name",        fieldValue = valueOrEmpty(frame.args['name'])    }) addRow({       fieldName = "Type",        fieldValue = valueOrEmpty(frame.args['type'])    }) addRow({       fieldName = "Target",        fieldValue = valueOrEmpty(frame.args['target'])    }) addRow({       fieldName = "Area",        fieldValue = valueOrEmpty(frame.args['area'])    }) addRow({       fieldName = "Level",        fieldValue = valueOrEmpty(frame.args['level'])    }) addRow({       fieldName = "phase",        fieldValue = valueOrEmpty(frame.args['phase'])    }) addRow({       fieldName = "Range",        fieldValue = valueOrEmpty(frame.args['range'])    }) addRow({       fieldName = "Lock type",        fieldValue = valueOrEmpty(frame.args['locks'])    })

addRow({       fieldName = "Description",         fieldValue = valueOrEmpty(frame.args[1])    })

return tostring(root) end

return p