Módulo:DeityInfobox: mudanças entre as edições
De Cronicas Eternas Wiki
Criou página com 'local p = {} function p.infobox(frame) local args = frame:getParent().args local sections = { ["INFORMAÇÃO BÁSICA"] = { {"Título", args["title"]}, {"Nível de Poder", args["power_level"]}, {"Alinhamento", args["alignment"]}, {"Plano", args["plane"]}, {"Adjetivo", args["adjective"]}, {"Símbolo", args["symbol"]}, {"Aspectos", args["aspects"]}, {"Panteão",...' |
Sem resumo de edição |
||
Linha 5: | Linha 5: | ||
local sections = { | local sections = { | ||
{ | |||
title = "INFORMAÇÃO BÁSICA", | |||
fields = { | |||
{"Título", args["title"]}, | |||
{"Nível de Poder", args["power_level"]}, | |||
{"Alinhamento", args["alignment"]}, | |||
{"Plano", args["plane"]}, | |||
{"Adjetivo", args["adjective"]}, | |||
{"Símbolo", args["symbol"]}, | |||
{"Aspectos", args["aspects"]}, | |||
{"Panteão", args["pantheon"]}, | |||
{"Súdito de", args["subject_of"]}, | |||
{"Servos", args["servants"]}, | |||
{"Gênero", args["gender"]}, | |||
{"Morte", args["death"]}, | |||
}, | |||
}, | }, | ||
{ | |||
title = "INFLUÊNCIA", | |||
fields = { | |||
{"Portfólio", args["portfolio"]}, | |||
{"Domínios", args["domains"]}, | |||
}, | |||
}, | }, | ||
{ | |||
title = "ADORAÇÃO", | |||
fields = { | |||
{"Adoradores", args["worshipers"]}, | |||
}, | |||
}, | }, | ||
{ | |||
title = "PRÉ-APOTEOSE", | |||
fields = { | |||
{"Espécie Mortal", args["mortal_species"]}, | |||
{"Sexo Mortal", args["mortal_gender"]}, | |||
{"Lar Mortal", args["mortal_home"]}, | |||
{"Apoteose", args["apotheosis"]}, | |||
}, | |||
}, | }, | ||
} | } | ||
-- Início da infobox | -- Início da infobox | ||
local infobox = '<div style="width:22em; background:#f9f9f9; border:1px solid #aaa; float:right; padding:5px; font-size:90%;">' | local infobox = '<div style="width:22em; background:#f9f9f9; border:1px solid #aaa; float:right; padding:5px; font-size:90%;">' | ||
-- Adiciona a imagem | -- Adiciona a imagem no topo, se fornecida | ||
if args["image"] and args["image"] ~= "" then | if args["image"] and args["image"] ~= "" then | ||
infobox = infobox .. string.format( | infobox = infobox .. string.format( | ||
Linha 52: | Linha 64: | ||
-- Adiciona as seções e campos | -- Adiciona as seções e campos | ||
for section | for _, section in ipairs(sections) do | ||
infobox = infobox .. string.format('<div style="text-align:center; background:#ddd; font-size:110%%; padding:4px; margin-top:5px;">%s</div>', section) | infobox = infobox .. string.format('<div style="text-align:center; background:#ddd; font-size:110%%; padding:4px; margin-top:5px;">%s</div>', section.title) | ||
for _, field in ipairs(fields) do | for _, field in ipairs(section.fields) do | ||
local label, value = field[1], field[2] | local label, value = field[1], field[2] | ||
if value and value ~= "" then | if value and value ~= "" then |
Edição das 23h54min de 23 de novembro de 2024
A documentação para este módulo pode ser criada em Módulo:DeityInfobox/doc
local p = {}
function p.infobox(frame)
local args = frame:getParent().args
local sections = {
{
title = "INFORMAÇÃO BÁSICA",
fields = {
{"Título", args["title"]},
{"Nível de Poder", args["power_level"]},
{"Alinhamento", args["alignment"]},
{"Plano", args["plane"]},
{"Adjetivo", args["adjective"]},
{"Símbolo", args["symbol"]},
{"Aspectos", args["aspects"]},
{"Panteão", args["pantheon"]},
{"Súdito de", args["subject_of"]},
{"Servos", args["servants"]},
{"Gênero", args["gender"]},
{"Morte", args["death"]},
},
},
{
title = "INFLUÊNCIA",
fields = {
{"Portfólio", args["portfolio"]},
{"Domínios", args["domains"]},
},
},
{
title = "ADORAÇÃO",
fields = {
{"Adoradores", args["worshipers"]},
},
},
{
title = "PRÉ-APOTEOSE",
fields = {
{"Espécie Mortal", args["mortal_species"]},
{"Sexo Mortal", args["mortal_gender"]},
{"Lar Mortal", args["mortal_home"]},
{"Apoteose", args["apotheosis"]},
},
},
}
-- Início da infobox
local infobox = '<div style="width:22em; background:#f9f9f9; border:1px solid #aaa; float:right; padding:5px; font-size:90%;">'
-- Adiciona a imagem no topo, se fornecida
if args["image"] and args["image"] ~= "" then
infobox = infobox .. string.format(
'<div style="text-align:center; margin-bottom:10px;">%s</div>',
frame:preprocess(string.format('[[File:%s|center|frameless|200px]]', args["image"]))
)
end
-- Adiciona o nome da divindade
infobox = infobox .. string.format(
'<div style="text-align:center; background:#ccc; font-size:120%%; padding:4px;">%s</div>',
args["name"] or "NOME DA DIVINDADE"
)
-- Adiciona as seções e campos
for _, section in ipairs(sections) do
infobox = infobox .. string.format('<div style="text-align:center; background:#ddd; font-size:110%%; padding:4px; margin-top:5px;">%s</div>', section.title)
for _, field in ipairs(section.fields) do
local label, value = field[1], field[2]
if value and value ~= "" then
infobox = infobox .. string.format('<div style="padding:2px 5px;"><strong>%s:</strong> %s</div>', label, value)
end
end
end
infobox = infobox .. '</div>'
return infobox
end
return p