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:01, 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 = 300

-- STEP 3: Replace the example template text with the template text that you wish to increment.
local templatetext = [==========[
|header250 = {{#if:{{{capital_social|}}}{{{dotacio|}}}{{{pressupost|}}}{{{ingressos|}}}{{{ingressos_explotacio|}}}
                   {{{despeses|}}}{{{beneficis|}}}{{{actius|}}} {{{nom_xifres1|}}}{{{nom_xifres2|}}}{{{nom_xifres3|}}}
                   {{{nom_xifres4|}}}{{{nom_xifres5|}}} {{{bloc_xifres_especial|}}} {{{finançament|}}} 
                |{{GetLabelFix|T0063|lang={{{lang|}}}}}<!-- Xifres destacables -->}}
| label252 = {{GetLabelFix|Q6055890|lang={{{lang|}}}}} 
|  data252 = {{{finançament|}}}{{#if:{{{procedencia_finançament|}}}|&nbsp;({{{procedencia_finançament|}}}) }}
| label253 = {{GetLabelFix|P2137|lang={{{lang|}}}}} 
|  data253 = {{{capital_social|}}} 
| label254 = {{GetLabelFix|Q2620430|lang={{{lang|}}}}} 
|  data254 = {{{dotacio|}}}
| label256 = {{GetLabelFix|P2769|lang={{{lang|}}}}}
|  data256 = {{{pressupost|}}}
| label258 = {{GetLabelFix|P2139|lang={{{lang|}}}}}
|  data258 =  {{{ingressos|}}}
| label260 = {{GetLabelFix|Q831866|lang={{{lang|}}}}} 
|  data260 = {{{ingressos_explotacio|}}} 
| label262 = {{GetLabelFix|Q13516686|lang={{{lang|}}}}} 
|  data262 = {{{despeses|}}}
| label263 = {{GetLabelFix|P2295|lang={{{lang|}}}}} 
|  data263 = {{{beneficis|}}}
| label264 = {{GetLabelFix|P2403|lang={{{lang|}}}}} 
|  data264 = {{{actius|}}}

<!--  Paràmetres comodí bloc "xifres"-->
|  data266 = {{{bloc_xifres_especial|}}}
| label267 = {{{etiqueta_xifres1|}}}
|  data267 = {{{nom_xifres1|}}}
| label268 = {{{etiqueta_xifres2|}}}
|  data268 = {{{nom_xifres2|}}}
| label270 = {{{etiqueta_xifres3|}}}
|  data270 = {{{nom_xifres3|}}}
| label271 = {{{etiqueta_xifres4|}}}
|  data271 = {{{nom_xifres4|}}}
| label272 = {{{etiqueta_xifres5|}}}
|  data272 = {{{nom_xifres5|}}}

<!--
*********************************************
* Volums activitat
********************************************-->
<!--
*********************************************
* ALTRES
********************************************-->
| label274 = {{GetLabelFix|P793|lang={{{lang|}}}}} 
|  data274 = {{{esdeveniments|}}}  
|header275 = {{#if:{{{premis|}}}   {{{acces|}}}{{{telefon|}}}{{{monuments|}}} 
                   {{{transport|}}} {{{colors|}}} {{{bloc_final_especial|}}} {{{nom_final1|}}} {{{nom_final2|}}}
                   {{{nom_final3|}}}{{{nom_final4|}}} {{{nom_final5|}}} 
                |{{GetLabelFix|T0064|lang={{{lang|}}}}}<!-- Altres dades -->}}
| label277 = {{GetLabelFix|Q4989906|lang={{{lang|}}}}} 
|  data277 = {{{monuments|}}}  
| label279 = {{GetLabelFix|P1411|lang={{{lang|}}}}} 
|  data279 =  {{llista desplegable condicional|{{{nominacions|}}}|{{if empty|{{{desplega_premis|}}}|120}} }}
|  data281 = {{#if: {{{premis|}}} 
               |{{Llista desplegable condicional |{{{premis|}}} | {{if empty|{{{desplega_premis|}}}|180}}
                          |títol= {{GetLabelFix|P166|lang={{{lang|}}} }} 
                          |estil_títol = background:#eeeeee;text-align:start;
                          |títol2= '''{{GetLabelFix|P166|lang={{{lang|}}} }}''' 
              }} }} 

<!--  Paràmetres comodí bloc "final"-->
| label285 = {{{etiqueta_final1|}}}
|  data285 = {{{nom_final1|}}}
| label287 = {{{etiqueta_final2|}}}
|  data287 = {{{nom_final2|}}}
| label289 = {{{etiqueta_final3|}}}
|  data289 = {{{nom_final3|}}}
| label291 = {{{etiqueta_final4|}}}
|  data291 = {{{nom_final4|}}}
| label293 = {{{etiqueta_final5|}}}
|  data293 = {{{nom_final5|}}}
| label295 = {{GetLabelFix|P6364|lang={{{lang|}}}}}
|  data295 = {{{colors|}}}
| label299    = {{GetLabelFix|Q45025990|lang={{{lang|}}}}} 
| data299     = {{{acces|}}}
| label301    = {{GetLabelFix|P1329|lang={{{lang|}}}}} 
| data301     = {{{telefon|}}}
| label303    = 
|  data303    = {{{transport|}}}
|  data304    = {{{bloc_final_especial|}}}
|  data305    = {{#if:{{{xarxes|}}} {{{lloc_web|}}} {{{notes|}}}
                  |<hr>}}
| label307    = Web
|  data307    = {{{lloc_web|}}}
| data310     =  {{align|left|{{{xarxes|}}} }}
| label319    = Notes
|  data319    = {{{notes|}}}
| belowstyle  = border-top:#aaa 1px solid; background-color:{{{color_notes|}}};
| below = {{{footnotes|}}}
<!--
               ****************  comença incrustada **********************
-->
| data320 = {{#if:{{{bloc_edifici|}}}  
]==========]

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