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 18:18, 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 = 15

-- STEP 3: Replace the example template text with the template text that you wish to increment.
local templatetext = [==========[
|header140  =  {{#if: {{{recorregut|}}} {{{desnivell|}}} {{{altitud_minima|}}} {{{altitud_maxima|}}} {{{passa|}}} 
                     {{{cims|}}}{{{terreny|}}}{{{curs_aigua|}}}{{{cabal|}}} {{{desnivell|}}} {{{orientacio|}}}    
                     {{{cronologia|}}} {{{periode|}}}  {{{element_vertebrador|}}} {{{patrimoni|}}} {{{planta|}}} 
                     {{{nomenclator|}}} {{{creua|}}} {{{altitud_min|}}} {{{altitud_max|}}}{{{subdivisions|}}}{{{oasis|}}}
                     {{{curs_aigua|}}} {{{conca_hidrografica|}}} {{{parcel·la|}}} {{{parcela|}}} {{{recursos|}}}
                     {{{edat|}}} {{{tipus_erupcio|}}} {{{erupcio|}}} {{{patrimoni|}}} {{{estatfisic|}}} {{{Estat|}}} 
                     {{{ciutat_mes_propera|}}}{{{premis|}}}{{{plantes|}}}{{{animals|}}}{{{coleccions|}}}{{{amenaces|}}}
                     {{{longitud|}}}{{{llargada|}}}{{{amplada|}}}{{{alçada|}}} {{{altitud|}}}{{{material|}}}{{{prominencia|}}}
               |Característiques}}

|label142   = Cims destacats
|data142    = {{{cims|}}} 

|label154   = [[Prominència]]
|data154    = {{{prominencia|}}}

|label156   = [[Altitud]]  <!-- sobre nivell del mar. NO CONFONDRE AMB ALÇADA del objecte-->
|data156    = {{{altitud|}}}

|label164   = Longitud costa
|data164    = {{posaunitat|{{{costa|}}}|m}}
|label170   =  Profunditat&nbsp;mitjana
|data170    = {{posaunitat|{{{profunditat_mitjana|}}}|m}}
|label175   = Profunditat màxima
|data175    = {{posaunitat|{{{profunditat|}}}|m}}
|label182   = Separació mínima
|data182    = {{posaunitat|{{{separacio|}}}|m}}

|label186   = Rescloses
|data186    = {{{rescloses|}}}
| label188 =  Tipus cascada
| data188  = {{{tipus_cascada|}}}
| label190 =  Alçada màxima
| data190  = {{{alçada_max|}}}
| label192 =  Nombre de salts
| data192  = {{{salts|}}}
| label194  = Salt més llarg
| data194   = {{{salt_llarg|}}}

|label198   = Longitud

|data198    = {{{longitud|}}} 
             
|label202   = Amplada
|data202    = {{{amplada|}}}
            
|label210   = Alçada  <!-- del objecte. NO CONFONDRE AMB ALTITUD sobre nivell del mar -->
|data210    = {{{alçada|}}} 

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



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

|data245    = {{#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}} }}
             }}

|label248   = {{nowrap|{{#if:{{{punt_mes_alt|}}}|Punt més alt|Altitud màxima}}}}
|data248    = {{#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}} }}
             }}
|label250   = Creua <!-- Pot ser una ruta, pista, etc. o un pont. En aquest cas, el P177 pot tenir contingut-->
|data250    = {{{creua|}}}
|label258   = Hi passa
|data258    = {{{passa|}}}
|label260  = Carreteres
|data260   = {{{carretera|}}}
|label273   = Cabal
|data273    = {{{cabal|}}}
|label275   = Material
|data275    = {{{material|}}} 
|label277   = {{nowrap|[[Nomenclàtor oficial de toponímia major de Catalunya|Al Nomenclàtor]]}}
|data277    = {{{nomenclator|}}}

|label283   = Parcel·les
|data283    = {{{parcela|}}} 
|label285   = Superfície
|data285    = {{{superficie|}}}

|label290   = Espècies presents
|data290    = {{{especies|}}}

| label294  = {{{etiqueta_caracteristiques1|}}}
| data294   = {{{nom_caracteristiques1|}}} 
| label295  = {{{etiqueta_caracteristiques2|}}}
| data295   = {{{nom_caracteristiques2|}}}
| label296  = {{{etiqueta_caracteristiques3|}}}
| data296   = {{{nom_caracteristiques3|}}}<!--

       Bloc Protecció
 -->


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



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



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

|label344   = Clima
|data344    =  {{{clima|}}}

|label348   = Insolació
|data348    =  {{{insolacio|}}} 

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

|data360   = {{#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}}
                   }}
                }}
             }} 
|label363  = Mitjana anual de precipitacions
|data363   = {{{precipit_any|}}}
|label367  = [[Balanç hídric]] anual
|data367   = {{{defichidric|}}}

|label369   = Temperatura aigua
|data369    = {{{tempaigua|}}}<!--
          -->{{if both|{{{tempaigua|}}} | {{{data_captacio|}}}<!-- 
            -->|&nbsp;({{{data_captacio|}}}) }} 
|label375   = [[pH]]
|data375    =  {{#if:{{{pH|}}} | {{{pH|}}}<!-- 
             -->{{#if:{{{tempaigua|}}} |<!--no repetir data -->| {{#if:{{{data_captacio|}}} |&nbsp;({{{data_captacio|}}}) }}
              }} }}

|label380   = Capacitat
|data380    = {{{capacitat|}}}

|label384   = Salinitat
|data384    =  {{{salinitat|}}}

|label386   = Congelació
|data386    =  {{{congelacio|}}}
| label387  = {{{etiqueta_mesures1|}}}
| data387   = {{{nom_mesures1|}}} 
| label388  = {{{etiqueta_mesures2|}}}
| data388   = {{{nom_mesures2|}}}
| label389  = {{{etiqueta_mesures3|}}}
| data389   = {{{nom_mesures3|}}}


<!-- ******  ARQUEOLOGIA  / HISTÒRIA **************************************************************************** -->

|header390 = {{#if:{{{any descoberta|}}}{{{documentat|{{{documentada|}}}}}}{{{excavacions|}}} 
                   {{{primers_exploradors|}}}{{{arqueolegs|}}}{{{periodes_historics|}}}
                   {{{troballes|}}}{{{categoria_proteccio|}}} 
              | Història}}

|label392  = Tipologia
|data392   = {{{tipus_jaciment|}}}
|label393   = Edat
|data393    = {{{edat|}}}

|labe395  = Cronologia

|data395   = {{{cronologia|}}} 
|label397   = Cultura/pobladors
|data397    = {{{pobladors|}}}

|label404  = Any descoberta
|data404   = {{{any_descoberta|}}}
|label406   = Documentat
|data406    = {{{documentat|}}}
|label408  = Excavacions
|data408   = {{{excavacions|}}}

|label412  = Primers navegants
|data412   = {{{primers_navegants|}}}
|label414  = Primers exploradors
|data414   = {{{primers_exploradors|}}}
|label417  = Arqueòlegs
|data417   = {{{arqueolegs|}}}
|label420  = Paleontòlegs
|data420   = {{{paleontolegs|}}}
|label422  = Períodes històrics
|data422   = {{{periodes_historics|}}}
|label435  = Troballes
|data435   = {{{troballes|}}}
|label437  = Restauracions
|data437   = {{{restauracions|}}}
|label440  = Categoria de protecció 
|data440   = {{{categoria_proteccio|}}}
|label443   =  Patrimoni 
|data443    = {{{patrimoni|}}}
|label445   =  Catàleg
|data445    = {{{cataleg|}}}
|label447   = Estat
|data447    = {{{estatfisic|}}}
|label460   = Terreny
|data460    = {{{terreny|}}}
|label462   = Planta
|data462    = {{{planta|}}}
|label468   = Subdivisions
|data468    = {{{subdivisions|}}}
|label470   = Tipus d'erupció
|data470    = {{{tipus_erupcio|}}}
|label472   = Última erupció
|data472    = {{{erupcio|}}}
|label480   = Col·leccions
|data480    = {{{coleccions|}}}
|label486   = Amenaces
|data486    = {{{amenaces|}}}

|label488   = Recursos
|data488    = {{{recursos|}}}


<!-- Excursionisme i escalada -->

|header500  = {{#if:{{{primera_ascensio|{{{primera ascensió|}}}}}} {{{etapes|}}}{{{variant|}}}
                    {{{enllaç_sender|}}}{{{ruta_normal|{{{ruta normal|}}}}}} 
                |Muntanyisme}}
|label505 = Primera ascensió
|data505  = {{{primera_ascensio|}}}

|label512 = Ruta normal
|data512  ={{{ruta_normal|}}}
|label518 = Etapes
|data518  = {{{etapes|}}}
|label524 = Variant
|data524  = {{{variant|}}}
|label535 = Enllaç altres senders
|data535  = {{{enllaç_sender|}}}

<!-- pistes d'esqui -->
| header550 = {{#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í}}
| label560  =  Domini
| data560  =  {{{domini|}}} 
| label562  =  Capacitat
| data562  =  |{{{capacitat_alpi|}}}
| label564  =  Remuntadors
| data564  =  {{{remuntadors|}}} 
| label566  =  Catifes&nbsp;rodants
| data566  =  {{{catifes|}}} 
| label570  =  Telefèric
| data570  =  {{{teleferic|}}}
| label582  =  Telecabina
| data582  =  {{{telecabina|}}} 
| label584  =  Telecadira
| data584  =  {{{telecadira|}}} 
| label586  =  Telesquís
| data586  =  {{{telesquis|}}} 
| label588  =  Canons 
| data588   =  {{{canons|}}} 
| label590  =  Superfície
| data590   =  {{{superficie_artificial|}}}


| label596  =  Altres
| data596  =  {{{altres|}}} 
| label604  =  Pistes
| data604  =  {{{pistes_alpi|}}} 
| label606  =  <span style="border: 1px solid grey; font-size: 90%; background:black;">&nbsp;&nbsp;&nbsp;&nbsp;</span> '''Negres'''
| data606  =  {{{negres_alpi|}}}
| label608  =  <span style="border: 1px solid grey; font-size: 90%; background:red;">&nbsp;&nbsp;&nbsp;&nbsp;</span> '''Vermelles'''
| data608  =  {{{vermelles_alpi|}}} 
| label620  =  <span style="border: 1px solid grey; font-size: 90%; background:Blue;">&nbsp;&nbsp;&nbsp;&nbsp;</span> '''Blaves'''
| data620  =  {{{blaves_alpi|}}} 
| label622  =  <span style="border: 1px solid grey; font-size: 90%; background:green;">&nbsp;&nbsp;&nbsp;&nbsp;</span> '''Verdes'''
| data622  =  {{{verdes_alpi|}}} 
| label624  =  Km pistes
| data624  =  {{{km_alpi|}}} 
| header638 = {{#if:{{{capacitat_fons|}}} {{{pistes_fons|}}} {{{negres_fons|}}}
              {{{vermelles_fons|}}}{{{blaves_fons|}}} {{{verdes_fons|}}} {{{km_fons|}}}    
              | Esquí de fons}}
| label640  =  Capacitat
| data640   =  {{{capacitat_fons|}}} 
| label642  =  Pistes
| data642   =  {{{pistes_fons|}}} 
| label644  =  <span style="border: 1px solid grey; font-size: 90%; background:black;">&nbsp;&nbsp;&nbsp;&nbsp;</span> '''Negres'''
| data644   =  {{{negres_fons|}}} 
| label646  =  <span style="border: 1px solid grey; font-size: 90%; background:red;">&nbsp;&nbsp;&nbsp;&nbsp;</span> '''Vermelles'''
| data646   =  {{{vermelles_fons|}}} 
| label648  =  <span style="border: 1px solid grey; font-size: 90%; background:Blue;">&nbsp;&nbsp;&nbsp;&nbsp;</span> '''Blaves'''
| data648   =  {{{blaves_fons|}}} 
| label660  =  <span style="border: 1px solid grey; font-size: 90%; background:green;">&nbsp;&nbsp;&nbsp;&nbsp;</span> '''Verdes'''
| data660   =  {{{verdes_fons|}}} 
| label662  =  Km pistes
| data662   =  {{{km_fons|}}} 


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



| header690 = {{#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}}
| label693  = Construcció
| data693   =  {{{construccio|}}}
| label702  = Data d'inauguració
| data702   = {{{inauguracio|}}}
| label703  = Data de tancament
| data703   = {{{tancament|}}}
| label706  = Obertura
| data706   = {{{obertura|}}}
| label708  = Nombre de visitants
| data708   = {{#if:{{{visites|}}} 
                | {{{visites|}}}  {{#if:{{{visites_any|}}} |&nbsp;({{{visites_any|}}})}}
              }} 
| label712  = Pressupost
| data712   = {{#if:{{{pressupost|}}} 
                | {{{pressupost|}}}  {{#if:{{{pressupost_any|}}} |<sup> ({{{pressupost_any|}}})</sup> }}
              }} 
| label716  = Fundador
| data716   = {{{fundador|}}}
| label717  = Gestor
| data717   = {{{gestor|}}}
| label718  = Propietari
| data718   = {{{propietari|}}}
| label719  = Dissenyador
| data719   = {{{dissenyador|}}}
| label730  = Transport
| data730   = {{{transport|}}}

| label732  = Serveis
| data732   = {{{serveis|}}}

| label744  = {{{etiqueta_activitat1|}}}
| data744   = {{{nom_activitat1|}}} 
| label745  = {{{etiqueta_activitat2|}}}
| data745   = {{{nom_activitat2|}}}
| label746  = {{{etiqueta_activitat3|}}}
| data746   = {{{nom_activitat3|}}}
 

|label760   = Premis
|data760    = {{{premis|}}}


|label765  = Notes
|data765   = {{{notes|}}}

|data770   = <hr>
|data772   = {{#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|71={{#invoke:Wikidata | claim | property=P856 |list=false
                                                       | item={{{item|}}}  }}
                                 |72=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