Documentação do módulo[ver] [editar] [histórico] [purgar]

Descrição

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

Uso

Outra documentação:

local building = require "Módulo:Infobox/Funções/Edifício"
local general = require "Módulo:Infobox/Funções"
local l = require "Módulo:Infobox/Funções/Localidade"
local convert = require "Módulo:Conversão"

-- Comprimento
local function comprimento()
    local value = function(localdata)
        local numval = localdata['comprimento']
    if not numval and not localdata['comprimento_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['comprimento_n'], localdata['comprimento'], 'km' }}
        if not localdata['posição'] then
           return quilometro
        else
       return quilometro .. '<br /><small>[[Lista dos rios mais extensos do mundo|Posição]]: ' .. localdata['posição'] .. '</small>'
        end
    end
 
    return {type = 'row', label = 'Comprimento', value = value, wikidata = {property = 'P2043', targetunit = 'km', rounding = '2'}}

end

-- Largura
local function largura()
    local value = function(localdata)
        value = localdata['largura']
     
        local quilometro = convert.displayvalue( value, 'km', {showunit = true, rounding = 2, showlink = false})
      return quilometro
    end
    return {type = 'row', label = 'Largura', value = value, wikidata = {property = 'P2040', targetunit = 'km', rounding = '2'}}

end

-- Profundidade
local function profundidade()
    local value = function(localdata)
        value = localdata['profundidade']
        local metro = convert.displayvalue( value, 'm', {showunit = true, rounding = 0, showlink = false})
    end
    return {type = 'row', label = 'Profundidade', value = value, wikidata = {property = 'P4511', targetunit = 'm', rounding = '0'}}

end

-- Caudal médio
local function vazaoMedio()
    local value = function(localdata)
        local numval = localdata['débito']
    if not numval and not localdata['débito_n'] then -- se os dados são incomuns, a função de chamada é deixada para se defender
        return value
    end
        local metro_c =  mw.getCurrentFrame():expandTemplate{title = 'Formatnumif', args = { localdata['débito_n'], localdata['débito'], 'm³/s' }}
    if localdata['débito_n'] or localdata['débito'] then
       return metro_c
    else
       return nil
    end
    end
 
    return {type = 'row', label = '[[Vazão|Caudal]] médio', value = value, wikidata = {property = 'P2225', targetunit = 'm3/s', rounding = '0'}}
 
end

--Caudal máximo
local function vazaoMax()
    local value = function(localdata)
        local metro_c = mw.getCurrentFrame():expandTemplate{title = 'Formatnumif', args = { localdata['débito_max_n'], localdata['débito_max'], 'm³/s' }}
    if localdata['débito_max_n'] or localdata['débito_max'] then
       return metro_c
    else
       return nil
    end
    end
 
    return {type = 'row', label = '[[Vazão|Caudal]] máximo', value = value}
 
end

--Caudal mínimo
local function vazaoMin()
    local value = function(localdata)
        local metro_c = mw.getCurrentFrame():expandTemplate{title = 'Formatnumif', args = { localdata['débito_min_n'], localdata['débito_min'], 'm³/s' }}
        if localdata['débito_min_n'] or localdata['débito_min'] then
       return metro_c
    else
       return nil
    end
    end
  
    return {type = 'row', label = 'Débito mínimo', value = value}
end

local function altitudeNascente()
    local value = function(localdata)
        local metro = mw.getCurrentFrame():expandTemplate{title = 'Formatnumif', args = { localdata['alt_nascente_n'], localdata['alt_nascente'], 'm' }}
    if localdata['alt_nascente_n'] or localdata['alt_nascente'] then
       return metro
    else
       return nil
    end
    end
  
    return {type = 'row', label = '[[Altitude]] da nascente', value = value}
end

local function altitudeFoz()
    local value = function(localdata)
        local metro = mw.getCurrentFrame():expandTemplate{title = 'Formatnumif', args = { localdata['alt_foz_n'], localdata['alt_foz'], 'm' }}
    if localdata['alt_foz_n'] or localdata['alt_foz'] then
       return metro
    else
       return nil
    end
    end
 
    return {type = 'row', label = '[[Altitude]] da foz', value = value}
end


local function bacia()
    local value = function(localdata)
        local numval = localdata['área_bacia']
    if not numval and not localdata['área_bacia_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['área_bacia_n'], localdata['área_bacia'], 'km²' }}
    if localdata['área_bacia_n'] or localdata['área_bacia'] then
       return quilometro
    else
       return nil
    end

    end
    return {type = 'row', label = '[[Bacia hidrográfica|Área da bacia]]', value = value, wikidata = {property = 'P2053', targetunit = 'sqkm', rounding = '0'}}
end

return {
    maincolor = '#C0E0F0',
    secondcolor = '#dbecf7',
--  thirdcolor = '#f7f8ff', preto
    parts = {
    
        general.title( 'mapa', nil, 'outro_nome'),
--       {type = 'text', value = 'outro_nome', style = {['background-color'] = '#dbecf7'}},
        l.mainimage(),
        general.bathymetricmap(),  -- imagem extra
        {type = 'table', rows = {
            {type = 'row', label = 'Nome local', plurallabel = 'Nomes locais', value = {'nome_nativo', 'nome_nativo_ling'}, wikidata = {property = 'P1705', showlang = true, conjtype = 'new line'}},
--            {type = 'row', label = 'Nome oficial', plurallabel = 'Nomes oficiais', value = 'nome oficial', property = 'P1448'}, -- erro desconhecido
        }},
    
        {type = 'table', title = 'Localização', rows = {
            {type = 'row', label = 'Continente', plurallabel = 'Continentes', value = 'continente', property = 'P30'},
            {type = 'row', label = 'País', plurallabel = 'Países',  value = { 'país', 'países', 'país1'}, property = 'P17'},
            {type = 'row', label = 'Localização', value = 'localização', property = 'P131'},
            building.island(),
            building.mountainrange(),
            {type = 'row', label = 'Parte de', value = 'parte de', property = 'P361'},
            building.protectedarea(),
            {type = 'row', label = 'Altitude', value = 'altitude', wikidata = {property = 'P2044', targetunit = 'metro', conjtype = ' ou ', rounding = '0'} },
            {type = 'row', label = 'Clima', plurallabel = 'Climas', value = 'clima', property = 'P2564'},
            building.coordenadas(),
        }},
        {type = 'table', title = 'Dimensões', rows = {
        comprimento(),
        largura(),
        profundidade(),
            {
                type = "row",
                label = "Ilhas",
                value = "nome das ilhas",
                wikidata = {
                    property = 'P2670',
                    targetvalue = 'Q23442',
                    qualifiers = 'P1114',
                    showonlyqualifier = {'P1114'}
                    }
            },
        }},
        {type = 'table', title = 'Hidrografia', rows = {
            {type = 'row', label = 'Tipo', value = 'tipo', property = 'P31'},
            building.watershed(),
            bacia(),
--          {type = 'row', label = 'País(es)', value = 'país'},
--          {type = 'row', label = 'País', value = 'país1'},
--          {type = 'row', label = 'Países', value = 'países'},
            {type = 'row', label = 'País(es) da<br />bacia hidrográfica', plurallabel = 'Países da<br />bacia hidrográfica', value = {'país_bacia', 'países_bacia', 'país da bacia hidrográfica', 'país soberano sobre a bacia hidrográfica'}, property = 'P205'},
            {type = 'row', label = 'Distrito', value = 'distrito'},
            {type = 'row', label = 'Maior cidade', value = 'cidade'},
            {type = 'row', label = 'Nascente', value = 'nascente', property = 'P885'},
            altitudeNascente(),
            {type = 'row', label = '[[Delta]]', value = 'delta'},
            {type = 'row', label = 'Afluente<br />principal', plurallabel = 'Afluentes<br />principais',  value = { 'afluente', 'afluentes'}, property = 'P974'},
            {type = 'row', label = 'Afluentes<br />esquerda', value = 'afluentes_esquerda'},
            {type = 'row', label = 'Afluentes<br />direita', value = 'afluentes_direita'},
            {type = 'row', label = 'Inclui', value = 'inclui', property = 'P527'},
            {type = 'row', label = 'Lago no curso', plurallabel = 'Lagos no curso',  value = 'lago', property = 'P469'},
            vazaoMedio(),
            vazaoMax(),
            vazaoMin(),
            {type = 'row', label = 'Foz', value = 'foz', property = 'P403'},
            altitudeFoz (),
        }},
    
        {type = 'table', title = 'História', rows = {
            {type = 'row', label = 'Origem do nome', value = 'origem do nome', property = 'P138'},
            {type = 'row', label = 'Evento chave', plurallabel = 'Eventos chaves', value = 'evento chave', property = 'P793'},
            building.owner(),
            {type = 'row', label = 'Equipamento', plurallabel = 'Equipamentos', value = 'equipamento', wikidata = {property = 'P912', defaultlinkquery = 'P4661'}},
            {type = 'row', label = 'Problema ambiental', plurallabel = 'Problemas ambientais', value = 'problema ambiental', property = 'P3643'},
            {type = 'row', label = 'Estatuto patrimonial', value = 'estatuto patrimonial', property = 'P1435'},
            {type = 'row', label = 'Distinção', plurallabel = 'Distinções', value = 'distinção', property = 'P166'},
        }},
        building.geoloc({pointtype = 'lago', maptype = 'relief', marker = 'wetland', markercolor = '#778BA5', wikidata = {{property = 'P625', qualifier = 'P518', qualifiervalue = 'Q7376362'},  {property = 'P625', qualifier = 'P518', qualifiervalue = 'Q1233637'} }}),
        }
}