Jump to content

Module:IncrementParams

From Wikipedia, the free encyclopedia
This is an old revision of this page, as edited by Amadalvarez (talk | contribs) at 11:51, 3 August 2018. The present address (URL) is a permanent link to this revision, which may differ significantly from the current revision.

-- STEP 1: Click on the "edit" tab at the top of the page to edit this module.

-- STEP 2: if you want to increment by a number other than 1, put that number below, after the equals sign. 
local increment = 40

-- STEP 3: Replace the example template text with the template text that you wish to increment.
local templatetext = [==========[
|label158   = Longitud
|data158    = {{{longitud|}}} 
             
|label162   = Amplada
|data162    = {{{amplada|}}}
            
|label170   = Alçada  <!-- del objecte. NO CONFONDRE AMB ALTITUD sobre nivell del mar -->
|data170    = {{{alçada|}}} 

|label173   = Diàmetre <!--P518 permet indicar a que es refereix el diàmetre: capçada, zona central, etc.  -->
|data173    = {{{diametre|}}}
|label176   = Perímetre  <!--P518 permet indicar a que es refereix el perímetre: peu arbre, tronc, etc.  -->
|data176    = {{{perimetre|}}}



|label185   = {{nowrap|{{#if:{{{punt_mes_baix|}}} |Punt més baix|Altitud mínima}}}}

|data185    = {{#if:{{{punt_mes_baix|}}}
               | {{{punt_mes_baix|}}} {{#if:{{{altitud_minima|}}}
                                        |&nbsp;({{posaunitat|{{{altitud_minima|}}} |[[Metres sobre el nivell del mar|msnm]]}}) }}
               | {{#if:{{{altitud|}}}|<!--res -->|{{posaunitat|{{{altitud_minima|}}}|m}} }}
             }}

|label198   = {{nowrap|{{#if:{{{punt_mes_alt|}}}|Punt més alt|Altitud màxima}}}}
|data198    = {{#if:{{{punt_mes_alt|}}}
               | {{{punt_mes_alt|}}} {{#if:{{{altitud_maxima|{{{altitud_max|}}}}}} 
                                       |&nbsp;({{posaunitat|{{{altitud_maxima|{{{altitud_max|}}}}}} |[[Nivell mitjà del mar|msnm]]}}) }}
               | {{#if:{{{altitud|}}}|<!--res -->|{{posaunitat|{{{altitud_maxima|{{{altitud_max|}}}}}}|m}} }}
             }}
|label210   = Creua <!-- Pot ser una ruta, pista, etc. o un pont. En aquest cas, el P177 pot tenir contingut-->
|data210    = {{{creua|}}}
|label218   = Hi passa
|data218    = {{{passa|}}}
|label220  = Carreteres
|data220   = {{{carretera|}}}
|label233   = Cabal
|data233    = {{{cabal|}}}
|label235   = Material
|data235    = {{{material|}}} 
|label237   = {{nowrap|[[Nomenclàtor oficial de toponímia major de Catalunya|Al Nomenclàtor]]}}
|data237    = {{{nomenclator|}}}

|label243   = Parcel·les
|data243    = {{{parcela|}}} 
|label245   = Superfície
|data245    = {{{superficie|}}}

|label256   = Edat
|data256    = {{{edat|}}}
|label258   = Tipus d'erupció
|data258    = {{{tipus_erupcio|}}}
|label270   = Última erupció
|data270    = {{{erupcio|}}}

<!--
 
       Bloc Protecció
 -->


|data280   = {{{bloc_proteccions_1|}}}<!-- Manuals + els que hi ha a P1435 -->
|data285   = {{{bloc_proteccions_2|}}}<!-- Les IPAs (P1600) sense cap altra protecció en P1435 -->
|data287   = {{{bloc_proteccions_3|}}}<!-- proteccions generades amb Property que no figuren dins P1435 (espais naturals UICN + Reserva de la Biosfera -->  



<!-- ******  MESURES   **************************************************************************** -->



|header300  = {{#if:{{{temperatura_mitjana|}}}{{{amplitud_termica|}}}{{{temperatura_maxima|}}}{{{temperatura_minima|}}}
                    {{{tempmitja|}}}{{{amplitudterm|}}}{{{precipany|}}}{{{defichidric|}}} {{{tempaigua|}}}{{{pH|}}}
                    {{{insolacio|}}} {{{precipit_any|}}} {{{clima|}}}
                | Mesures i indicadors}}

|label304   = Clima
|data304    =  {{{clima|}}}

|label308   = Insolació
|data308    =  {{{insolacio|}}} 

|label317   = [[Temperatura mitjana]] anual
|data317    = {{{temperatura_mitjana|}}}
|label320   = {{#if: {{{amplitud_termica|}}}
               |[[Amplitud tèrmica]] anual
               |{{#if:{{{temperatura_maxima|}}}
                  |{{#if:{{{temperatura_minima|}}}
                     |[[Amplitud tèrmica]] anual
                     |Temperatura màxima
                   }} 
                  |Temperatura mínima
                }}
             }} 

|data320   = {{#if:{{{amplitudterm|{{{amplitud_termica|}}}}}}
               |{{posaunitat|{{{amplitudterm|{{{amplitud_termica|}}}}}}|ºC}}
               |{{#if:{{{temperatura_maxima|}}}
                  |{{#if:{{{temperatura_minima|}}}
                     |{{{temperatura_minima|}}}&nbsp;⇔&nbsp;{{{temperatura_maxima|}}}&nbsp;ºC 
                     |{{posaunitat|{{{temperatura_maxima|}}}|ºC}}
                   }} 
                  |{{#if:{{{temperatura_minima|}}}
                     |{{posaunitat|{{{temperatura_minima|}}}|ºC}}
                   }}
                }}
             }} 
|label323  = Mitjana anual de precipitacions
|data323   = {{{precipit_any|}}}
|label327  = [[Balanç hídric]] anual
|data327   = {{{defichidric|}}}

|label329   = Temperatura aigua
|data329    = {{{tempaigua|}}}<!--
          -->{{if both|{{{tempaigua|}}} | {{{data_captacio|}}}<!-- 
            -->|&nbsp;({{{data_captacio|}}}) }} 
|label335   = [[pH]]
|data335    =  {{#if:{{{pH|}}} | {{{pH|}}}<!-- 
             -->{{#if:{{{tempaigua|}}} |<!--no repetir data -->| {{#if:{{{data_captacio|}}} |&nbsp;({{{data_captacio|}}}) }}
              }} }}


<!-- ******  ARQUEOLOGIA   **************************************************************************** -->


|header350 = {{#if:{{{any descoberta|}}}{{{documentat|{{{documentada|}}}}}}{{{excavacions|}}} 
                   {{{primers_exploradors|}}}{{{arqueolegs|}}}{{{periodes_historics|}}}
                   {{{troballes|}}}{{{categoria_proteccio|}}} 
              | Intervencions }}

|label352  = Tipologia
|data352   = {{{tipus_jaciment|}}}

|labe355  = Cronologia
|data355   = {{{cronologia|}}} 
|label357   = Cultura/pobladors
|data357    = {{{pobladors|}}}

|label364  = Any descoberta
|data364   = {{{any_descoberta|}}}
|label366   = Documentat
|data366    = {{{documentat|}}}
|label368  = Excavacions
|data368   = {{{excavacions|}}}

|label374  = Primers exploradors
|data374   = {{{primers_exploradors|}}}
|label377  = Arqueòlegs
|data377   = {{{arqueolegs|}}}
|label380  = Paleontòlegs
|data380   = {{{paleontolegs|}}}
|label382  = Períodes històrics
|data382   = {{{periodes_historics|}}}
|label395  = Troballes
|data395   = {{{troballes|}}}
|label397  = Restauracions
|data397   = {{{restauracions|}}}
|label400  = Categoria de protecció 
|data400   = {{{categoria_proteccio|}}}
|label403   =  Patrimoni 
|data403    = {{{patrimoni|}}}
|label405   =  Catàleg
|data405    = {{{cataleg|}}}
|label407   = Estat
|data407    = {{{estatfisic|}}}
|label420   = Terreny
|data420    = {{{terreny|}}}
|label422   = Planta
|data422    = {{{planta|}}}
|label428   = Subdivisions
|data428    = {{{subdivisions|}}}


|label435   = Espècies presents
|data435    = {{{especies|}}}
|label440   = Col·leccions
|data440    = {{{coleccions|}}}
|label446   = Amenaces
|data446    = {{{amenaces|}}}

|label448   = Recursos
|data448    = {{{recursos|}}}


<!-- Excursionisme i escalada -->

|header460  = {{#if:{{{primera_ascensio|{{{primera ascensió|}}}}}} {{{etapes|}}}{{{variant|}}}
                    {{{enllaç_sender|}}}{{{ruta_normal|{{{ruta normal|}}}}}} 
                |Muntanyisme}}
|label465 = Primera ascensió
|data465  = {{{primera_ascensio|}}}

|label472 = Ruta normal
|data472  ={{{ruta_normal|}}}
|label478 = Etapes
|data478  = {{{etapes|}}}
|label484 = Variant
|data484  = {{{variant|}}}
|label495 = Enllaç altres senders
|data495  = {{{enllaç_sender|}}}

<!-- pistes d'esqui -->
| header510 = {{#if:{{{domini|}}} {{{capacitat_alpí|}}} {{{capacitat_alpi|}}}
                    {{{remuntadors|}}} {{{catifes|}}} {{{telefèric|}}} {{{teleferic|}}}
                    {{{telecabina|}}} {{{telecadira|}}} {{{telesquís|}}} {{{telesquis|}}}
                    {{{altres|}}}{{{pistes_alpí|}}} {{{pistes_alpi|}}} 
                    {{{negres_alpí|}}} {{{negres_alpi|}}} {{{km_alpí|}}} {{{km_alpi|}}}
                    {{{vermelles_alpí|}}} {{{vermelles_alpi|}}} {{{blaves_alpí|}}} 
                    {{{blaves_alpi|}}} {{{verdes_alpí|}}} {{{verdes_alpi|}}}
                | Esquí alpí}}
| label520  =  Domini
| data520  =  {{{domini|}}} 
| label522  =  Capacitat
| data522  =  |{{{capacitat_alpi|}}}
| label524  =  Remuntadors
| data524  =  {{{remuntadors|}}} 
| label526  =  Catifes&nbsp;rodants
| data526  =  {{{catifes|}}} 
| label530  =  Telefèric
| data530  =  {{{teleferic|}}}
| label542  =  Telecabina
| data542  =  {{{telecabina|}}} 
| label544  =  Telecadira
| data544  =  {{{telecadira|}}} 
| label546  =  Telesquís
| data546  =  {{{telesquis|}}} 
| label548  =  Altres
| data548  =  {{{altres|}}} 
| label564  =  Pistes
| data564  =  {{{pistes_alpi|}}} 
| label566  =  <span style="border: 1px solid grey; font-size: 90%; background:black;">&nbsp;&nbsp;&nbsp;&nbsp;</span> '''Negres'''
| data566  =  {{{negres_alpi|}}}
| label568  =  <span style="border: 1px solid grey; font-size: 90%; background:red;">&nbsp;&nbsp;&nbsp;&nbsp;</span> '''Vermelles'''
| data568  =  {{{vermelles_alpi|}}} 
| label580  =  <span style="border: 1px solid grey; font-size: 90%; background:Blue;">&nbsp;&nbsp;&nbsp;&nbsp;</span> '''Blaves'''
| data580  =  {{{blaves_alpi|}}} 
| label582  =  <span style="border: 1px solid grey; font-size: 90%; background:green;">&nbsp;&nbsp;&nbsp;&nbsp;</span> '''Verdes'''
| data582  =  {{{verdes_alpi|}}} 
| label584  =  Km pistes
| data584  =  {{{km_alpi|}}} 
| header598 = {{#if:{{{capacitat_fons|}}} {{{pistes_fons|}}} {{{negres_fons|}}}
              {{{vermelles_fons|}}}{{{blaves_fons|}}} {{{verdes_fons|}}} {{{km_fons|}}}    
              | Esquí de fons}}
| label600  =  Capacitat
| data600   =  {{{capacitat_fons|}}} 
| label602  =  Pistes
| data602   =  {{{pistes_fons|}}} 
| label604  =  <span style="border: 1px solid grey; font-size: 90%; background:black;">&nbsp;&nbsp;&nbsp;&nbsp;</span> '''Negres'''
| data604   =  {{{negres_fons|}}} 
| label606  =  <span style="border: 1px solid grey; font-size: 90%; background:red;">&nbsp;&nbsp;&nbsp;&nbsp;</span> '''Vermelles'''
| data606   =  {{{vermelles_fons|}}} 
| label608  =  <span style="border: 1px solid grey; font-size: 90%; background:Blue;">&nbsp;&nbsp;&nbsp;&nbsp;</span> '''Blaves'''
| data608   =  {{{blaves_fons|}}} 
| label620  =  <span style="border: 1px solid grey; font-size: 90%; background:green;">&nbsp;&nbsp;&nbsp;&nbsp;</span> '''Verdes'''
| data620   =  {{{verdes_fons|}}} 
| label622  =  Km pistes
| data622   =  {{{km_fons|}}} 
| header624 = {{#if:{{{canons|}}} {{{superficie_artificial|}}} | Innivació}}
| label626  =  Canons 
| data626   =  {{{canons|}}} 
| label630  =  Superfície
| data630   =  {{{superficie_artificial|}}}


<!-- ******  ACTIVITAT **************************************************************************** -->



| header661 = {{#if:{{{inauguracio|}}} {{{tancament|}}} {{{visites|}}} {{{pressupost|}}}

                    {{{fundador|}}} {{{gestor|}}} {{{dissenyador|}}} {{{propietari|}}}    
                    {{{transport|}}} {{#property:P137|from={{{item|}}}}}{{#property:P571|from={{{item|}}}}}{{#property:P1174|from={{{item|}}}}} 
                    {{#property:P2769|from={{{item|}}}}}{{#property:P112|from={{{item|}}}}}{{#property:P127|from={{{item|}}}}}
                    {{#property:P287|from={{{item|}}}}} 
              | Activitat}}
| label662  = Data d'inauguració
| data662   = {{{inauguracio|}}}
| label663  = Data de tancament
| data663   = {{{tancament|}}}
| label664  = Nombre de visitants
| data664   = {{#if:{{{visites|}}} 
                | {{{visites|}}}  {{#if:{{{visites_any|}}} |&nbsp;({{{visites_any|}}})}}
              }} 
| label665  = Pressupost
| data665   = {{#if:{{{pressupost|}}} 
                | {{{pressupost|}}}  {{#if:{{{pressupost_any|}}} |<sup> ({{{pressupost_any|}}})</sup> }}
              }} 
| label676  = Fundador
| data676   = {{{fundador|}}}
| label677  = Gestor
| data677   = {{{gestor|}}}
| label678  = Propietari
| data678   = {{{propietari|}}}
| label679  = Dissenyador
| data679   = {{{dissenyador|}}}
| label690  = Com arribar (transport)
| data690   = {{{transport|}}}

|label700   = Premis
|data700    = {{{premis|}}}


|label715  = Notes
|data715   = {{{notes|}}}

|data716   = <hr>
| data720  = {{#if:{{#invoke:Wikidata | claim | property=P856 | list=false  
                                      |item={{{item|}}} | value={{{lloc_web|}}}{{{web|}}} }}
               | <hr>{{#if:{{{lloc_web|}}} {{{web|}}} 
                       |{{if empty|{{{lloc_web|}}}|{{{web|}}}  }}
                       |{{#if:{{#property:P856 |from={{{item|}}} }}
                          | {{URL|31={{#invoke:Wikidata | claim | property=P856 |list=false
                                                       | item={{{item|}}}  }}
                                 |32=Lloc web oficial}} 
                        }}
                     }}
             }}
]==========]

-- STEP 4: Save this module.

-- STEP 5: You can now output the incremented text with the following code:
--                {{subst:#invoke:IncrementParams|main}}
-- Or you can simply copy and paste the text from this module's documentation.

-- STEP 6: Check the output! In rare cases this module might produce false positives.
-- For example, it will change the text "[[Some link|foo3=bar]]" to "[[Some link|foo4=bar]]".
-- You can use the "show changes" function in the edit window of the template you are editing
-- to find any false positives.

-- STEP 7: When you are finished, undo your changes to this page, so that the next person
-- won't be confused by seeing any non-default values. Thanks for using this module!

local p = {}
 
local function replace(prefix, num, suffix)
    return '|' .. prefix .. tostring(tonumber(num) + increment) .. suffix .. '='
end
 
function p.main(frame)
    -- Increment the template text.
    templatetext = mw.ustring.gsub(templatetext, '|(%s*%a?[%a_%-]-%s*)([1-9]%d*)(%s*[%a_%-]-%a?%s*)=', replace)
    -- Add pre tags and escape html etc. if the pre option is set.
    if frame and frame.args and frame.args.pre and frame.args.pre ~= '' then
        templatetext = mw.text.nowiki(templatetext)
        templatetext = '<pre style="white-space:-moz-pre-wrap; white-space:-pre-wrap; '
            .. 'white-space:-o-pre-wrap; white-space:pre-wrap; word-wrap:break-word;">' 
            .. templatetext .. '</pre>'
    end
    return templatetext
end
 
return p