Módulo:Infobox/Monumento
![]() | Este módulo está classificado como pré-alfa. Ele está incompleto, e pode ou não estar em desenvolvimento activo. Ele deve ser utilizado desde páginas do domínio artigos. Os módulos ficam em pre-alfa até o editor original (ou alguém que toma conta se ele for abandonado por algum tempo) está satisfeito com a estrutura básica. |
Descrição
Este Módulo tem funções auxiliares para criar infocaixas. Ver {{Monumento}}
Uso
Outra documentação:
A documentação acima é transcluída de Módulo:Infobox/Monumento/doc. (editar | histórico) Editores podem experimentar nas páginas de teste (criar | espelhar) e de exemplos para testes (criar) deste módulo. Subpáginas deste módulo. |
local geoloc = require 'Módulo:Infobox/Funções/Geolocalização'
local building = require "Module:Infobox/Funções/Edifício"
local voice = require 'Módulo:Infobox/Funções/Pessoa'
local general = require "Módulo:Infobox/Funções"
local linguistic = require 'Módulo:Linguística'
local localdata = require "Módulo:Infobox/Localdata"
local wd = require "Módulo:Infobox/Wikidata"
local formats = {
--{ícone do mapa, ícone do cabeçalho, cor do título, cor da legenda, texto colorido)
Q751876 = {nil, 'castelo', '#00507f', '#ffffff', '#ffffff', 'defaut'}, --castle
Q23413 = {nil, 'castelo', '#00507f', '#ffffff', '#ffffff', 'defaut'}, --castle
Q3947 = {'edifício', nil, '#E1E1E1', '#E1E1E1', '#000000', 'defaut'}, -- house
Q267596 = {'igreja', nil, '#E1E1E1', '#E1E1E1', '#000000', 'defaut'}, -- greek temple
Q16970 = {'igreja', nil, '#E1E1E1', '#E1E1E1', '#000000', 'defaut'}, -- igreja
Q34627 = {'sinagoga', nil, '#E1E1E1', '#E1E1E1', '#000000', 'defaut'}, -- sinagoga
Q32815 = {'mosque', nil, '#E1E1E1', '#E1E1E1', '#000000', 'defaut'}, --mosque
Q48356 = {'mosque', nil, '#E1E1E1', '#E1E1E1', '#000000', 'defaut'}, -- minaret
Q83405 = {'industrial', nil, '#E1E1E1', '#E1E1E1', '#000000', 'defaut'}, -- factory
Q4989906 = {'monumento', nil, '#E1E1E1', '#E1E1E1', '#000000', 'defaut'}, -- monument
Q170980 = {'monumento', nil, '#E1E1E1', '#E1E1E1', '#000000', 'defaut'}, -- obelisque
Q813966 = {'banheiros', nil, '#E1E1E1', '#E1E1E1', '#000000', 'defaut'}, -- banheiros públicos
default = {'monumento', nil, '#E1E1E1', '#E1E1E1', '#000000', 'defaut'}
}
local function wdformat() --retorna uma tabela contendo a cor principal da infobox e o ícone do título
local wtypes = wd.stringTable{ -- obtenha o Qid das profissões
entity = localdata.item,
property = 'P31',
displayformat = 'raw',
excludespecial = true
}
local default = formats.default
wtypes = wd.addVals(wtypes or {}, {property = 'P279'}, 1) -- usamos também a subclasse
for i, item in pairs(wtypes or {}) do
if formats[item] then
return formats[item]
end
end
return default
end
local function setcharte()
if localdata['charte'] then
charte = localdata['charte']
for i, j in pairs(formats) do
if j[2] == charte then
return j
end
end
end
return wdformat()
end
local displayformat = setcharte()
local function dimensions( localdata )
local dimensions = {
-- parâmetro, abreviação para exibir no cabeçalho, nome Wikidata, nome completo para exibir no cabeçalho, parar
{{'diâmetro_cm', 'dimensões'}, 'P2386', nil, 'Diâmetro', true},
{'altura', 'A', 'P2048', 'Altura', false},
{'largura', 'L', 'P2049', 'Largura', false},
{'profundidade', 'l', 'P2610' , 'profundidade', false},
}
local data, dims = {}, {}
local label = 'Dimensões'
local unit = localdata['unidade'] or 'm'
local wikidataval = function(d)
return wd.formatStatements{
entity = localdata.item,
showunit = '-',
targetunit = unit,
addcat = true,
property = d
}
end
local propertyused = nil
for i, j in pairs(dimensions) do
local val = localdata[j[1]]
if localdata.item and j[3] and not val then
val = wikidataval(j[3])
if val then
propertyused = j[3]
end
end
if val then
table.insert(data, val)
table.insert(dims, i)
if j[5] then
break
end
end
end
if #data == 0 then
return nil
end
if #data == 1 then
label = dimensions[dims[1]][4]
else
for i, j in pairs(dims) do dims[i] = dimensions[j][2] end
label = label .. linguistic.inparentheses(linguistic.conj(dims, ' × '))
end
local val = linguistic.conj(data, ' × ') .. ' ' .. unit
if propertyused then
val = wd.formatAndCat{entity = localdata.item, property = propertyused, value = val}
end
return {
type = 'row',
label = label,
value = function() return val end
}
end
-- Descrição audível dif de P990
local function descricao()
local function selectsound()
-- prioridade em português
if wd.getClaims{entity = item, property = 'P989' } then
return {property = 'P989' }
end
return {property = 'P989'}
end
return {
type = 'images',
style = {['padding-top'] = '25px'},--{['border-width'] = '10px', ['border-style'] = 'solid'},
label = 'Registo vocal',
captionparameter = 'legenda voz',
value = 'voz',
wikidata = selectsound (),
numval = 1,
}
end
return
{
maincolor = displayformat[3],
secondcolor = displayformat[4],
thirdcolor = displayformat[5],
parts =
{
general.title(displayformat[2], nil, 'nome local', nil),
general.logo(),
general.mainimage('!Artigos de sociedade sem imagens'),
{type = 'table', title = 'Apresentação', rows = {
{type = 'row', label = 'Nomes precedentes', value = 'nomes precedentes'},
{type = 'row', label = 'Sobrenome(s)', value = 'sobrenome'},
{type = 'row', label = 'Nome completo', value = 'nome completo'},
{type = 'row', label = 'Culto', value = 'culto'},
{type = 'row', label = 'Tipo', value = 'tipo', blockers = {'destino inicial', 'destino final'}, wikidata = {property = 'P31', excludevalues = {'Q41176', 'Q811979' }}},
{type = 'row', label = 'Destino inicial', value = 'destino inicial'},
{type = 'row', label = 'Destino atual', value = 'destino atual'},
{type = 'row', label = 'Anexos', value = 'anexos'},
{type = 'row', label = 'Diocese', value = 'diocese', property = 'P708'},
{type = 'row', label = 'Dedicado', plurallabel = 'Dedicados', value = 'dedicado', property = 'P825'},
{type = 'row', label = 'Comemora', value = 'comemora', property = 'P547'},
building.archistyle(),
building.creator(),
building.material(),
building.construction(),
building.opening(),
building.reconstruction(),
building.renovation(),
building.demolition(),
{type = 'row', label = 'Patrocinador', value = 'patrocinador', property = 'P88'},
dimensions,
{type = 'row', label = 'Ocupante', value = 'ocupante', wikidata = {property = 'P466', showdate = true}},
building.owner(),
building.operator(),
building.protection(),
building.visitors(),
}},
{type = 'table', title = 'Website', rows = {
{type = 'mixed', value = 'website', wikidata = {property = 'P856', displayformat = 'wraplinks', conjtype = '<br />', isinlang = 'pt', rank = 'valid', excludespecial = true, returnnumberofvalues = true, }}
}},
building.unesco(),
{type = 'table', title = 'Localização', rows = {
building.adminlocation(),
building.mountainrange(),
building.onshoreof(),
building.watershed(),
building.protectedarea(),
}},
{type = 'table', title = 'Acesso e transporte', rows = {
building.transport()
}},
{type = 'table', rows = {
voice.voice(),
descricao,
geoloc.coordenadas{maintenancecat = ""},
}},
geoloc.geoloc('displayformat[1]', '-'), -- '-' indica não procurar automaticamente um mapa se nenhum for fornecido em | geolocalização =
}
}