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

-- STEP 3: Replace the example template text with the template text that you wish to increment.
local templatetext = [==========[
| label172 = {{GetLabelFix|P137|lang={{{lang|}}} }}
|  data172 = {{{gestor|}}}
| label173 = {{GetLabelFix|Q3558349|lang={{{lang|}}} }} 
|  data173 = {{{president|}}}
| label174 = {{#ifeq:{{{president|}}}|{{{executiu_cap|}}}|<!-- ja s'ha mostrat -->|{{GetLabelFix|Q484876|lang={{{lang|}}}}} }}
|  data174 = {{#ifeq:{{{president|}}}|{{{executiu_cap|}}}|<!-- ja s'ha mostrat -->|{{{executiu_cap|}}} }}
| label176 = {{GetLabelFix|P1075|lang={{{lang|}}} }}  
|  data176 = {{{rector|}}}
| label177 = {{GetLabelFix|Q723682|lang={{{lang|}}}}}
|  data177 = {{{dega|}}}
| label178 = {{GetLabelFix|P3975|lang={{{lang|}}}}}
|  data178 = {{{secretari|}}}
| label179 = {{GetLabelFix|P1037|lang={{{lang|}}}}}
|  data179 = {{{director|}}}
| label180 = {{if empty|  {{{etiqueta_lider1|}}}|{{GetLabelFix|Q1251441|lang={{{lang|}}}}}}}
|  data180 = {{{nom_lider1|}}}
| label181 =  {{{etiqueta_lider2|}}}
|  data181 =  {{{nom_lider2|}}}
| label182 =  {{{etiqueta_lider3|}}}
|  data182 =  {{{nom_lider3|}}}
| label183 =  {{{etiqueta_lider4|}}}
|  data183 =  {{{nom_lider4|}}}
| label185 = {{GetLabelFix|Q188628|lang={{{lang|}}} }} 
|  data185 = {{{consell_administracio|}}}
| label187 = {{GetLabelFix|P3342|lang={{{lang|}}} }} 
|  data187 = {{{persona_clau|}}}
| label189 = {{if empty |{{{etiqueta_destacats|}}} |{{GetLabelFix|T0058|lang={{{lang|}}} }}}}
|  data189 = {{{membres_destacats|}}}
| label190 = {{GetLabelFix|P2813|lang={{{lang|}}} }}
|  data190 = {{{organ_premsa|}}}
| label191 = {{GetLabelFix|P5769|lang={{{lang|}}} }}
|  data191 = {{{editor_cap|}}}
| label192 =  {{GetLabelFix|P286|lang={{{lang|}}} }} 
|  data192 = {{{entrenador|}}}
| label193 =  {{GetLabelFix|P634|lang={{{lang|}}} }}
|  data193 = {{{capita|}}}
| label194 =  {{GetLabelFix|T0059|lang={{{lang|}}} }} 
|  data194 = {{{cap_colla|}}}{{#if:{{{any_inici_cap_colla|}}} |&nbsp;({{{any_inici_cap_colla|}}}) }}
| label195 = {{{etiqueta_tecnic1|}}}
|  data195 = {{{nom_tecnic1|}}}{{#if:{{{any_inici_tecnic1|}}} |&nbsp;({{{any_inici_tecnic1|}}}) }}
| label196 = {{{etiqueta_tecnic2|}}}  
|  data196 = {{{nom_tecnic2|}}}{{#if:{{{any_inici_tecnic2|}}} |&nbsp;({{{any_inici_tecnic2|}}}) }}
| label197 = {{{etiqueta_tecnic3|}}}  
|  data197 = {{{nom_tecnic3|}}}{{#if:{{{any_inici_tecnic3|}}} |&nbsp;({{{any_inici_tecnic3|}}}) }}
| label198 = {{{etiqueta_tecnic4|}}}  
|  data198 = {{{nom_tecnic4|}}}{{#if:{{{any_inici_tecnic4|}}} |&nbsp;({{{any_inici_tecnic4|}}}) }} 
| label202 = {{GetLabelFix|T0060|lang={{{lang|}}} }}
|  data202 = {{{partit_juvenil|}}}
| label203 = {{{etiqueta_branca1|}}}
|  data203 = {{{nom_branca1|}}}
| label204 = {{{etiqueta_branca2|}}}
|  data204 = {{{nom_branca2|}}}
| label205 = {{{etiqueta_branca3|}}}
|  data205 = {{{nom_branca3|}}}  
| label207 = {{GetLabelFix|P1128|lang={{{lang|}}} }} 
|  data207 = {{{empleats|}}} {{#if:{{{num_empleats_any|}}} |<small>{{nonegreta|&nbsp;({{{num_empleats_any|}}})}}</small> }}

<!-- Espai per al model organitzatiu: dependència, filials, sucursals, etc -->
| label216 = {{if empty|{{{etiqueta_matriu|}}}|{{GetLabelFix|P749|lang={{{lang|}}} }}}}
|  data216 =  {{{societat_matriu|}}} 
| label218 = {{GetLabelFix|P127|lang={{{lang|}}} }}
|  data218 = {{#if:{{{nom_estats1|}}}{{{nom_estats2|}}}{{{nom_estats3|}}}{{{nom_estats4|}}}|<!--És org.supraestatal. No posar propietari. -->|{{{propietari|}}} }}
| label220 = {{{etiqueta_estats1|}}} 
|  data220 = {{{nom_estats1|}}}
| label222 = {{{etiqueta_estats2|}}} 
|  data222 = {{{nom_estats2|}}}
| label224 = {{{etiqueta_estats3|}}} 
|  data224 = {{{nom_estats3|}}}
| label226 = {{{etiqueta_estats4|}}} 
|  data226 = {{{nom_estats4|}}}  
| label230 = {{if empty |{{{etiqueta_aliats|}}} |{{GetLabelFix|T0061|lang={{{lang|}}}}} }}
|  data230 =  {{{aliats|}}} 
| label232 = {{if empty |{{{etiqueta_rivals|}}} |{{GetLabelFix|T0061|lang={{{lang|}}}}} }} 
|  data232 = {{{rivals|}}} 
| label234 = {{if empty |{{{etiqueta_divisions|}}} |{{GetLabelFix|Q334453|lang={{{lang|}}}}} }}
| data234  = {{{divisions|}}} 
| label236 = {{GetLabelFix|Q1880737|lang={{{lang|}}}}}
|  data236 = {{{sucursals|}}} 
| label238 = {{GetLabelFix|P355|lang={{{lang|}}}}} 
|  data238 = {{llista desplegable condicional|{{{subsidiaries|}}}|{{if empty|{{{desplega_format|}}}|120}} }}
| label240 = {{GetLabelFix|P527|lang={{{lang|}}}}}
|  data240 = {{llista desplegable condicional|{{{format_per|}}}|{{if empty|{{{desplega_format|}}}|120}} }} 
| label242 = {{GetLabelFix|P361|lang={{{lang|}}}}} 
|  data242 = {{{afiliacions|}}}

<!--  Paràmetres comodí bloc "govern"-->
|  data243 = {{if empty| {{{bloc_partit_politic|}}} | {{{bloc_govern_especial|}}} }}
| label244 = {{{etiqueta_govern1|}}}
|  data244 = {{{nom_govern1|}}}
| label245 = {{{etiqueta_govern2|}}}
|  data245 = {{{nom_govern2|}}}
| label246 = {{{etiqueta_govern3|}}}
|  data246 = {{{nom_govern3|}}}
| label247 = {{{etiqueta_govern4|}}}
|  data247 = {{{nom_govern4|}}}
| label248 = {{{etiqueta_govern5|}}}
|  data248 = {{{nom_govern5|}}}
]==========]

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