La documentación para este módulo puede ser creada en Módulo:Facciones/doc
--[[
@name: Módulo de Facciones
@author: Unai01
@desc: Muestra qué facciones patrocinan el artículo usando la etiqueta <tabber>
]]--
local facciones = {}
local userError = require("Dev:User error")
local datosFacciones = mw.loadData('Módulo:Facciones/datos')
function facciones.main(frame)
local data = '<div class="hidden"><tabber>'
for k,v in pairs(frame:getParent().args) do
local faccion = datosFacciones[v:lower()]
if faccion~=nil then
data = data .. (
facciones.genTab(
v .. '',
faccion.imagen,
faccion.link ,
faccion["descripción"]
)
or '') else userError("[[Módulo:Facciones/Datos|Data]] not found")
end
end
return frame:preprocess(data .. '</tabber></div>')
end
function facciones.genTab(title, image, link, desc)
local table = mw.html.create( 'table' )
table:tag('td')
:css('width', '5%')
:css('text-align', 'center')
:wikitext('[[Archivo:' .. image .. '|100px|link=' .. (link or '') .. ']]')
table:tag('td')
:css('text-align', 'center')
:wikitext(desc)
return title .. '=' .. tostring( table ) .. '\n|-|'
end
function facciones.test(frame)
return datosFacciones[frame.args[1]:lower()].link
end
return facciones