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 05:09, 6 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 = 20

-- STEP 3: Replace the example template text with the template text that you wish to increment.
local templatetext = [==========[
|header405 = {{#if:{{{any_descoberta|}}}{{{documentat|{{{documentada|}}}}}}{{{excavacions|}}} 
                   {{{primers_exploradors|}}}{{{arqueolegs|}}}{{{periodes_historics|}}}
                   {{{troballes|}}}{{{categoria_proteccio|}}} 
              | Història}}

|label407  = Tipologia
|data407   = {{#switch:{{ucfirst:{{{tipologia_raw|}}}}}
                     |Jaciment|Q1291195|Jaciment arqueològic|Q839954|Jaciment paleontològic|Q9096832
                     |Q21752084={{{tipologia|}}}<!--
                  -->|#default=}}
|label408   = Edat
|data408    = {{{edat|}}}

|label410  = Cronologia
|data410   = {{{cronologia|}}} 
|label412   = Cultura/pobladors
|data412    = {{{pobladors|}}}

|label419  = Any descoberta
|data419   = {{{any_descoberta|}}}
|label421   = Documentat
|data421    = {{{documentat|}}}
|label423  = Excavacions
|data423   = {{{excavacions|}}}

|label427  = Primers navegants
|data427   = {{{primers_navegants|}}}
|label429  = Primers exploradors
|data429   = {{{primers_exploradors|}}}
|label432  = Arqueòlegs
|data432   = {{{arqueolegs|}}}
|label435  = Paleontòlegs
|data435   = {{{paleontolegs|}}}
|label437  = Períodes històrics
|data437   = {{{periodes_historics|}}}
|label450  = Troballes
|data450   = {{{troballes|}}}
|label452  = Restauracions
|data452   = {{{restauracions|}}}
|label455  = Categoria de protecció 
|data455   = {{{categoria_proteccio|}}}
|label458   =  Patrimoni 
|data458    = {{{patrimoni|}}}
|label460   =  Catàleg
|data460    = {{{cataleg|}}}
|label462   = Estat
|data462    = {{{estatfisic|}}}
|label475   = Terreny
|data475    = {{{terreny|}}}
|label477   = Planta
|data477    = {{{planta|}}}
|label483   = Subdivisions
|data483    = {{{subdivisions|}}}
|label485   = Tipus d'erupció
|data485    = {{{tipus_erupcio|}}}
|label487   = Última erupció
|data487    = {{{erupcio|}}}
|label495   = Col·leccions
|data495    = {{{coleccions|}}}
|label501   = Amenaces
|data501    = {{{amenaces|}}}

|label503   = Recursos
|data503    = {{{recursos|}}}


<!-- Excursionisme i escalada -->

|header515  = {{#if:{{{primera_ascensio|{{{primera ascensió|}}}}}} {{{etapes|}}}{{{variant|}}}
                    {{{enllaç_sender|}}}{{{ruta_normal|{{{ruta normal|}}}}}} 
                |Muntanyisme}}
|label520 = Primera ascensió
|data520  = {{{primera_ascensio|}}}

|label527 = Ruta normal
|data527  ={{{ruta_normal|}}}
|label533 = Etapes
|data533  = {{{etapes|}}}
|label539 = Variant
|data539  = {{{variant|}}}
|label550 = Enllaç altres senders
|data550  = {{{enllaç_sender|}}}

<!-- pistes d'esqui -->
| header565 = {{#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í}}
| label575  =  Domini
| data575  =  {{{domini|}}} 
| label577  =  Capacitat
| data577  =  |{{{capacitat_alpi|}}}
| label579  =  Remuntadors
| data579  =  {{{remuntadors|}}} 
| label581  =  Catifes&nbsp;rodants
| data581  =  {{{catifes|}}} 
| label585  =  Telefèric
| data585  =  {{{teleferic|}}}
| label597  =  Telecabina
| data597  =  {{{telecabina|}}} 
| label599  =  Telecadira
| data599  =  {{{telecadira|}}} 
| label601  =  Telesquís
| data601  =  {{{telesquis|}}} 
| label603  =  Canons 
| data603   =  {{{canons|}}} 
| label605  =  Superfície
| data605   =  {{{superficie_artificial|}}}


| label611  =  Altres
| data611  =  {{{altres|}}} 
| label619  =  Pistes
| data619  =  {{{pistes_alpi|}}} 
| label621  =  <span style="border: 1px solid grey; font-size: 90%; background:black;">&nbsp;&nbsp;&nbsp;&nbsp;</span> '''Negres'''
| data621  =  {{{negres_alpi|}}}
| label623  =  <span style="border: 1px solid grey; font-size: 90%; background:red;">&nbsp;&nbsp;&nbsp;&nbsp;</span> '''Vermelles'''
| data623  =  {{{vermelles_alpi|}}} 
| label635  =  <span style="border: 1px solid grey; font-size: 90%; background:Blue;">&nbsp;&nbsp;&nbsp;&nbsp;</span> '''Blaves'''
| data635  =  {{{blaves_alpi|}}} 
| label637  =  <span style="border: 1px solid grey; font-size: 90%; background:green;">&nbsp;&nbsp;&nbsp;&nbsp;</span> '''Verdes'''
| data637  =  {{{verdes_alpi|}}} 
| label639  =  Km pistes
| data639  =  {{{km_alpi|}}} 
| header653 = {{#if:{{{capacitat_fons|}}} {{{pistes_fons|}}} {{{negres_fons|}}}
              {{{vermelles_fons|}}}{{{blaves_fons|}}} {{{verdes_fons|}}} {{{km_fons|}}}    
              | Esquí de fons}}
| label655  =  Capacitat
| data655   =  {{{capacitat_fons|}}} 
| label657  =  Pistes
| data657   =  {{{pistes_fons|}}} 
| label659  =  <span style="border: 1px solid grey; font-size: 90%; background:black;">&nbsp;&nbsp;&nbsp;&nbsp;</span> '''Negres'''
| data659   =  {{{negres_fons|}}} 
| label661  =  <span style="border: 1px solid grey; font-size: 90%; background:red;">&nbsp;&nbsp;&nbsp;&nbsp;</span> '''Vermelles'''
| data661   =  {{{vermelles_fons|}}} 
| label663  =  <span style="border: 1px solid grey; font-size: 90%; background:Blue;">&nbsp;&nbsp;&nbsp;&nbsp;</span> '''Blaves'''
| data663   =  {{{blaves_fons|}}} 
| label675  =  <span style="border: 1px solid grey; font-size: 90%; background:green;">&nbsp;&nbsp;&nbsp;&nbsp;</span> '''Verdes'''
| data675   =  {{{verdes_fons|}}} 
| label677  =  Km pistes
| data677   =  {{{km_fons|}}} 


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



| header705 = {{#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}}
| label708  = Construcció
| data708   =  {{{construccio|}}}
| label717  = Data d'inauguració
| data717   = {{{inauguracio|}}}
| label718  = Data de tancament
| data718   = {{{tancament|}}}
| label721  = Obertura
| data721   = {{{obertura|}}}
| label723  = Nombre de visitants
| data723   = {{#if:{{{visites|}}} 
                | {{{visites|}}}  {{#if:{{{visites_any|}}} |&nbsp;({{{visites_any|}}})}}
              }} 
| label727  = Pressupost
| data727   = {{#if:{{{pressupost|}}} 
                | {{{pressupost|}}}  {{#if:{{{pressupost_any|}}} |<sup> ({{{pressupost_any|}}})</sup> }}
              }} 
| label731  = Fundador
| data731   = {{{fundador|}}}
| label732  = Gestor
| data732   = {{{gestor|}}}
| label733  = Propietari
| data733   = {{{propietari|}}}
| label734  = Dissenyador
| data734   = {{{dissenyador|}}}
| label745  = Transport
| data745   = {{{transport|}}}

| label747  = Serveis
| data747   = {{{serveis|}}}

| label759  = {{{etiqueta_activitat1|}}}
| data759   = {{{nom_activitat1|}}} 
| label760  = {{{etiqueta_activitat2|}}}
| data760   = {{{nom_activitat2|}}}
| label761  = {{{etiqueta_activitat3|}}}
| data761   = {{{nom_activitat3|}}}

|label775   = Premis
|data775    = {{{premis|}}}

|label780  = Notes
|data780   = {{{notes|}}}

|data787   = {{#if:{{#invoke:Wikidata | claim | property=P856 | value={{{lloc_web|}}}{{{web|}}} }}
               | <hr>{{#if:{{{lloc_web|}}} {{{web|}}} 
                       |{{if empty|{{{lloc_web|}}}|{{{web|}}}  }}
                       |{{#if:{{#property:P856 |from={{{item|}}} }}
                          | {{URL|86={{#invoke:Wikidata | claim | property=P856 |list=false
                                                       | item={{{item|}}}  }}
                                 |87=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