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 17:22, 16 July 2019. 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 = 150

-- STEP 3: Replace the example template text with the template text that you wish to increment.
local templatetext = [==========[
|header363 = {{#if:{{{president|}}}{{{executiu_cap|}}}{{{secretari|}}}{{{nom_lider1|}}}{{{nom_lider2|}}}{{{nom_lider3|}}}{{{nom_lider4|}}}{{{consell_administracio|}}}{{{persona_clau|}}}{{{membres_destacats|}}}{{{organ_premsa|}}}{{{empleats|}}}{{{voluntaris|}}}{{{nom_seu1|}}} {{{localitzacio_seu1|}}} {{{municipi_seu1|}}} {{{estat_seu1|}}}{{{nom_seu2|}}} {{{localitzacio_seu2|}}} {{{municipi_seu2|}}} {{{estat_seu2|}}}{{{societat_matriu|}}}{{{nom_estats1|}}}{{{nom_estats2|}}}{{{nom_estats3|}}}{{{nom_estats4|}}}{{{propietari|}}}{{{aliats|}}}{{{rivals|}}}{{{divisions|}}}{{{sucursals|}}}{{{subsidiaries|}}}{{{afiliacions|}}} {{{bloc_partit_politic|}}} {{{bloc_govern_especial|}}}{{{nom_govern1|}}}{{{nom_govern2|}}}{{{nom_govern3|}}} {{{nom_govern4|}}}{{{nom_govern5|}}}{{{partit_juvenil|}}} {{{etiqueta_branca1|}}}{{{nom_branca1|}}}{{{etiqueta_branca2|}}}{{{nom_branca2|}}}{{{etiqueta_branca3|}}}{{{nom_branca3|}}} {{{entrenador|}}}{{{capita|}}} {{{cap_colla|}}}{{{nom_tecnic1|}}}{{{nom_tecnic2|}}}{{{nom_tecnic3|}}}{{{nom_tecnic4|}}}
              |{{if empty| {{{etiqueta_organitzacio|}}}
                         |{{GetLabelFix|T0066|lang={{{lang|}}}}}<!-- Organització i govern -->}} }}
<!-- Espai per la(es) seu(s) -->
<!-- Capçalera eliminada
|header330 = {{#if: {{{nom_seu1|}}}{{{localitzacio_seu1|}}} {{{municipi_seu1|}}} {{{estat_seu1|}}}{{{coordenades|}}}
                   {{{nom_seu2|}}} {{{localitzacio_seu2|}}} {{{municipi_seu2|}}} {{{estat_seu2|}}} |Ubicació seu}}
-->
| label365 = {{if empty|{{{etiqueta_seu1|}}} |{{GetLabelFix|Q7540126|lang={{{lang|}}}}} }}&nbsp;<!--
                       -->{{#if: {{{edificiitem|}}}{{{imatge_mapa_seu1|}}}|[[fitxer:Vista-down.png<!-- Go-down Gion.svg-->|20px|link=#edif]] }}
|  data365 = {{#if: {{{nom_seu1|}}}{{{localitzacio_seu1|}}} {{{municipi_seu1|}}} {{{estat_seu1|}}} 
]==========]

-- 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