Saltar para o conteúdo

Módulo:Infobox/Montanha

Permanently protected module
Origem: Wikipédia, a enciclopédia livre.
Documentação do módulo[ver] [editar] [histórico] [purgar]

Descrição

Este módulo implementa a predefinição {{Info/Montanha}}

Outra documentação:

local location = require "Módulo:Infobox/Funções/Geolocalização"
local general = require "Módulo:Infobox/Funções"
local wd = require "Módulo:Infobox/Wikidata"
local building = require "Módulo:Infobox/Funções/Edifício" -- mover para / Geolocalização
local localdata = require "Módulo:Infobox/Localdata"
local convert = require "Módulo:Conversão"

local formats = {
    --({ícone do ponteiro, cor do ponteiro, nível de zoom)
    Q29025902 = {'triangle-stroked', '#8B0000', '10'}, -- formação vulcânica
    Q1061151 = {'triangle-stroked', '#996633', '6'}, -- maciço
    Q46831 = {'triangle-stroked', '#996633', '6'}, -- cordilheiras
    Q150784 = {'circle-stroked', '#996633', '10'}, -- garganta
    default = {'triangle-stroked', '#996633', '10'}
}

local function wdformat() --devolve uma tabela
local wtypes = wd.stringTable{
        entity = localdata.item,
        property = 'P31',
        displayformat = 'raw',
        excludespecial = true
    }
    local default = formats.default
    wtypes = wd.addVals(wtypes or {}, {property = 'P279'}, 1) -- usamos também as subclasses
    for i, item in pairs(wtypes or {}) do
        if formats[item] then
            return formats[item]
        end
    end
    return default
end
local function setcarta()
    if localdata['carta'] then
        carta = localdata['carta']
        for i, j in pairs(formats) do
            if j[2] == carta then
                return j
            end
        end
    end
    return wdformat()
end

local displayformat = setcarta()

 local function regiao()
     local rows = {}
     for i = 1, 4 do
         table.insert (rows, {
             type = 'row',
             label = function ( localdata )
                 return localdata['região_adm' .. tostring(i .. '_rót')] or ''
             end,
             value = 'região_adm' .. tostring(i),
         })
     end
     return rows
 end

-- Altitude
local function altitude()
    local value = function(localdata)
        local numval = tonumber (localdata['altitude'])
    if not numval and not localdata['altitude_n'] then -- se os dados são incomuns, a função de chamada é deixada para se defender
        return value
    end
        local quilometro = mw.getCurrentFrame():expandTemplate{title = 'Formatnumif', args = { localdata['altitude_n'], localdata['altitude'], 'm' }}
        local pe = mw.getCurrentFrame():expandTemplate{title = 'Formatnumif', args = { localdata['altitude_pés_n'], localdata['altitude_pés'], 'pés' }}
    if pe then
        quilometro = quilometro .. ' (' .. pe .. ')'
    end
        if not localdata['posição'] then
           return quilometro
        else
       return quilometro .. '<br /><small>[[Lista das montanhas mais altas|Posição]]: ' .. localdata['posição'] .. '</small>'
        end 
    end
  
    return {type = 'row', label = '[[Altitude]]', value = value, wikidata = {property = 'P2044', targetunit = 'metro', conjtype = ' ou ', rounding = '0', numval ='1'} }

end

-- Proeminência
local function proeminencia()
    local value = function(localdata)
        local numval = tonumber (localdata['proeminência'])
    if not numval and not localdata['proeminência_n'] then -- se os dados são incomuns, a função de chamada é deixada para se defender
        return value
    end
        local quilometro = mw.getCurrentFrame():expandTemplate{title = 'Formatnumif', args = { localdata['proeminência_n'], localdata['proeminência'], 'm' }}
    if localdata['proeminência_txt'] then
        quilometro = localdata['proeminência_txt'] .. '' .. quilometro
    end
    if localdata['posição_proeminência'] then
       quilometro = quilometro .. '<br /><small>[[Lista das montanhas mais altas|Posição]]: ' .. localdata['posição'] .. '</small>'
    end
    if localdata['cume_pai'] then
        quilometro = quilometro .. '<br /><small>Cume-pai: ' .. localdata['cume_pai'] .. '</small>' 
    end
    return quilometro
    end
  
    return {type = 'row', label = '[[Proeminência topográfica|Proeminência]]', value = value, wikidata = {property = 'P2660', targetunit = 'm', rounding = '0'}}

end

-- Isolamento
local function isolamento()
    local value = function(localdata)
        value = localdata['isolamento']
      
        local quilometro = convert.displayvalue( value, 'km', {showunit = true, rounding = 2, showlink = false})
      return quilometro
    end
    return {type = 'row', label = '[[Isolamento topográfico|Isolamento]]', value = value, wikidata = {property = 'P2659', targetunit = 'km', rounding = '1'}}

end

return
    {
    maincolor = '996633',
    thirdcolor = 'white',
    parts = {
       
        general.title('mapa', {color = 'white'}),
        general.mainimage('!Artigos de geografia sem imagens', 'Padrao.svg'),
            general.bathymetricmap(),  -- imagem extra
        {type = 'table', title = 'Geografia', rows = {
            {type = 'row', label = 'Estrela', value = 'estrela', property = 'P376'},
            general.country(),
 --           regiao,
            {type = 'row', label = 'Localização', value = 'localização', property = 'P131'},
            {type = 'row', label = 'Localidades', value = 'localidades'},
            building.island(),
            building.watershed(),
            building.protectedarea(),
            location.coordenadas(),
            {type = 'row', label = '[[Ponto culminante]]', value = 'ponto culminante', property = 'P610'},
            altitude,
            proeminencia,
            isolamento,
            {type = 'row', label = 'Cume parente', value = 'parente', property = 'P3137'},
            {type = 'row', label = 'Comprimento', value = 'comprimento', wikidata = {property = 'P2043', targetunit = 'km', rounding = '0'}},
            {type = 'row', label = 'Largura', value = 'largura', wikidata = {property = 'P2049', targetunit = 'km', rounding = '1'}},
            {type = 'row', label = 'Diâmetro', value = 'diâmetro', wikidata = {property = 'P2386', targetunit = 'km', rounding = '1'} },
            {type = 'row', label = 'Superfície', value = 'superfície', wikidata = {property = 'P2046', targetunit = 'sqkm', rounding = '0'} },
            {type = 'row', label = 'Volume', value = 'volume', wikidata = {property = 'P2234', targetunit = 'km3', rounding = '0'} },
        }
        },
        {type = 'table', title = 'Estrela', rows = {
            {
                type = 'row',
                value = function ( localdata )
                    local val = localdata['estrela']
                    if val and (mw.ustring.lower(val) ~= 'terra') then
                        return val
                    end
                end
            }
        }},
        {type = 'table', title = 'Geologia', rows = {
            {type = 'row', label = '[[Continente]]', plurallabel = 'Continentes', value = 'continente', property = 'P30'},
            {type = 'row', label = 'Unidade geomorfologica', value = 'unidade geomorfologica', property = 'P4688'},
            building.mountainrange(),
            {type = 'row', label = 'Listas', value = 'listas' },
            {type = 'row', label = 'Tipo', value = 'tipo', wikidata = {property = 'P31', excludevalues = {'Q8502', 'Q1595289', 'Q34987520'}}},
            {type = 'row', label = 'Inclui', value = 'inclui', wikidata = {property = 'P527', numval = '7'}},
            {type = 'row', label = '[[Rocha]]s', value = 'rochas', property = 'P186'},
            {type = 'row', label = 'Idade', value = 'idade', property = 'P2348'},
            {type = 'row', label = 'anterior&nbsp;[[Erupção vulcânica|erupção]]', value = {'erupção', 'última_erupção', 'Última erupção data'}, wikidata = {property = 'P793', targetvalue = 'Q29575458', showonlyqualifier = {'P585', 'P580', 'P582'}, conjtype = ' - '}},
            {type = 'row', label = 'Observatório', value = 'observatoire', property = 'P3815'},
            {type = 'row', label = 'Código [[Programa Global de Vulcanismo|GVP]]', value = {'GVP', 'identificador'}, wikidata = {property = "P1886", urlpattern="http://www.volcano.si.edu/volcano.cfm?vn=$1"}},
-- 404           {type = 'row', label = 'Código [[:en:Volcano Global Risk Identification and Analysis Project|VOGRIPA]]', value = 'VOGRIPA', wikidata = {property = "P4708", urlpattern="http://www.bgs.ac.uk/vogripa/searchVOGRIPA.cfc?method=detail&id=$1"}},
        }},
        {type = 'table', title = 'História e cultura', rows = {
            {type = 'row', label = 'Descoberto', value = 'descoberto', property = 'P575'},
            {type = 'row', label = 'Descobridor', plurallabel = 'Descobridores', value = 'descobridor', property = 'P61'},
            {type = 'row', label = 'Nome local', value = 'nome local', wikidata = {property = 'P1705', showlang = true}},
            {type = 'row', label = 'Nomeado de acordo', value = 'nomeado de acordo', wikidata = {showonlyqualifier = 'P138', property = 'P1705'}},
            {type = 'row', label = 'Nomeado por', value = 'nomeado por', wikidata = {showonlyqualifier = 'P3938', property = 'P1705'}},
            {type = 'row', label = 'Apelido', plurallabel ='Apelidos', value = 'apelido', wikidata = {property = 'P1449', lang = 'fr'}},
            {type = 'row', label = 'Reverenciado por', value = 'reverenciado por', property = 'P1049'},
            {type = 'row', label = '[[Primeira ascensão]]', value = {'primeira ascensão data', 'conquista'}, wikidata = {showonlyqualifier = {'P710', 'P585'}, property = 'P793', targetvalue = 'Q1194369'}},
            {type = 'row', label = 'Rota mais fáçil', value = {'caminho', 'melhor_rota'}, wikidata = {property = 'P2795', qualifier = 'P518', qualifiervalue = 'Q34976110', showqualifiers = 'P1427'}},
            {type = 'row', label = 'Perigo', plurallabel = 'Perigos', value = 'perigo', wikidata = {property = 'P3335', numval = '3'}},
            {type = 'row', label = 'Recorde de subida', value = 'recorde', wikidata = {showonlyqualifier = {'P3279', 'P2047', 'P585'}, property = 'P793', targetvalue = 'Q38072305'}},
            {type = 'row', label = '[[Panorama|Vista sobre]]', value = 'vista sobre', wikidata = {property = 'P3173', showqualifiers = 'P654', numval = '4'}},
            building.visitors(),
            {type = 'row', label = 'Estatuto patrimonial', value = 'estatuto patrimonial', wikidata = {property = 'P1435', showdate = 'true', numval = '4'}},
        }},
        location.geoloc({marker=displayformat[1], default_zoom=displayformat[3], markercolor=displayformat[2], maptype = 'relief'})
    }
}