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 12:12, 21 December 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 = 100

-- STEP 3: Replace the example template text with the template text that you wish to increment.
local templatetext = [==========[
| header176 = {{#if:{{{lleialtat|}}}{{{arma|}}}{{{rang|}}}{{{unitat|}}}{{{comandaments|}}}
                       {{{batalles|}}}{{{victories|}}}
                   |{{{lbl_header_military|}}} }}<!--Q20872118 = carrera militar  -->
| label178  = {{{lbl_P945_allegiance|}}}
|  data178  = {{{lleialtat|}}}
| label180  = {{{lbl_M_military_period|}}}   
|  data180  = {{{periode_actiu_militar|}}}
| label182  = {{{lbl_P241_military_branch|}}}
|  data182  = {{{arma|}}}
| label184  = {{{lbl_P410_military_rank|}}} 
|  data184  = {{{rang|}}}
| label186  = {{{lbl_M_military unit|}}}  
|  data186  = {{{unitat|}}}
| label188  = {{{lbl_P598_commander_of|}}}
|  data188  = {{{comandaments|}}}
| label190  = {{{lbl_P607_conflict|}}}
|  data190  = {{{batalles|}}}
| label192  = {{{lbl_M_victory|}}} 
|  data192  = {{{victories|}}}
| label194  = {{{lbl_P2873_time_in_space|}}}
|  data194  = {{{temps_espai|}}}
<!-- __________________  anul·lat en origen __________________
| label196  =   {{{lbl_M_eva1|}}} 
|  data196  = {{{eva1|}}} {{#if:{{{eva2|}}} | ({{{eva2|}}}) }}
| label200  = {{GetLabelFix|Q345844|lang={{{lang|}}}}}
|  data200  = {{{tripulacio|}}}
-->

| label202  = {{{lbl_P450_astronaut_mission|}}} 
|  data202  = {{{missio_espacial|}}}
| label204  = {{{lbl_P450-P154_mission_logo|}}}
|  data204  = {{{insignia|{{{insignia_missio|}}}}}}

<!-- 6.5. BLOC RELIGIOSOS -->
| label210      = {{{lbl_P611_religious_order|}}}
| data210       = {{{orde|}}}
| label211      = {{{lbl_P611-P585_date_ordination|}}} <!-- Ordenació sacerdotal  -->
| data211       = {{{ordenacio|}}}
| label212      = {{{lbl_P1598_consecration|}}}  <!-- Consagració [[Bisbe|episcopal]] -->
| data212       = {{{consagracio|}}}
| label213      = {{{lbl_M_created_cardinal|}}}  <!-- Proclamació [[Cardenal|cardenalícia]] -->
| data213       = {{{proclamacio|}}}
| header215     = {{{enaltiment|}}}
| data216       = {{{llista_enaltiments|}}}
| label217      = {{{lbl_M_veneration|}}}  
| data217       = {{{venerat_a|}}}
| label218      = {{{lbl_M_date_beatification|}}}   
| data218       = {{#if:{{{data_beatificacio|}}} | {{{data_beatificacio|}}} {{#if:{{{lloc_beatificacio|}}} |, {{{lloc_beatificacio|}}} }} {{#if:
                        {{{beatificat_per|}}} | {{lc:{{{lbl_P748_appointed|}}}}}  {{{beatificat_per|}}} }} }}
| label220      = {{{lbl_M_date_canonization|}}}  
| data220       = {{#if:{{{data_canonitzacio|}}} | {{{data_canonitzacio|}}} {{#if:{{{lloc_canonitzacio|}}}|, {{{lloc_canonitzacio|}}} }} {{#if:
                        {{{canonitzat_per|}}} |  {{lc:{{{lbl_M_canonitzation_by|}}}}} {{{canonitzat_per|}}} }} }}

| label224      = {{{lbl_P5873_place_devotion|}}} 
| data224       = {{{lloc_pelegrinatge|}}}
| label226      = {{{lbl_P841_feast_day|}}} 
| data226       = {{{festivitat|}}}
| label227      = {{{lbl_P793_significant_event|}}}  
| data227       = {{{fets_destacables|}}}
| label229      = {{{lbl_P4185_iconography|}}}
| data229       = {{{iconografia|}}}
| label230      = {{{lbl_P2925_domain_saint|}}}<!-- {{#invoke:Wikidata|getLabel|P2925|itemgender={{if empty|{{{item|}}} | {{#invoke:wikibase|id}}}}}} -->
| data230       = {{{patronatge|}}}
| label231      = {{{lbl_M_worship_suppression|}}} 
| data231       = {{{supressio_culte|}}} {{#if:{{{suprimit_per|}}}|,&nbsp;{{{suprimit_per|}}} }}
<!-- __________________  anul·lat en origen __________________
| label232      = {{GetLabelFix|T0012|editicon=no|lang={{{lang|}}}}} 
| data232       = {{{continuadors|}}}   -->


<!-- 6.6. BLOC ESPORTISTES -->
| label257 =   {{{lbl_P1532_country_sport|}}}
|  data257 = {{{nacionalitat_esportiva|}}}   
| label258 =  {{{lbl_P641_sport|}}}
|  data258 = {{{esport|}}}
| label259 =   {{{lbl_P2416_sports_discipline|}}}
|  data259 = {{{disciplina|}}}
| label260 =   {{{lbl_P2094_competition_class|}}}
|  data260 = {{{classe|}}}

<!-- __________________  anul·lat en origen __________________
| label262 = {{GetLabelFix|Q1047113|lang={{{lang|}}}}}
|  data262 = {{{especialitat|}}}    -->
| label263 =   {{{lbl_P118_league|}}}
|  data263 = {{{lliga|}}}
| label264 =   {{{lbl_P413_position_team|}}} 
|  data264 = {{{posicio_equip|}}}
| label265 =   {{{lbl_P741_playing_hand|}}}
|  data265 = {{{ma_joc|}}}
| label266 = {{{lbl_M_current_club|}}}
|  data266 = {{{club_actual|}}}
| label268 =   {{{lbl_P1618_sport_number|}}}
|  data268 = {{{dorsal_club|}}}
| label269 = {{{lbl_M_date_debut|}}} 
|  data269 =  {{{lloc_debut|}}}{{#if:{{{data_debut|}}}|&nbsp;({{{data_debut|}}})}}
| label270 = {{{M_date_service_retirement|}}} 
|  data270 =  {{{lloc_retirada|}}}{{#if:{{{data_retirada|}}}|&nbsp;({{{data_retirada|}}})}}
| label273 =   {{{lbl_P2095_co-driver|}}}
|  data273 = {{{copilot|}}}
| label275 =   {{{lbl_P286_coach|}}}
|  data275 = {{{entrenador|}}}
| label277 = { {{{lbl_P647_drafted_by|}}}
|  data277 = {{{draft|}}}
| label279 =   {{{lbl_P5995_kit_supplier|}}}
|  data279 = {{{patrocinador_material|}}} 
| label280 =   {{{lbl_P859_sponsor|}}}
|  data280 = {{#if: {{{art|}}}{{{genere|}}}{{{moviment|}}} |<!--res, ja ha sortit com "mecenes" a l'apartat d'art  -->|{{{patrocinador|}}} }}
| data282     =  {{{extensio_parametres_esport|}}}  <!-- bloc característiques esportius específic WD-->
| label283      =  {{#if:{{{etiqueta_carrera_esportiva|}}} | {{{etiqueta_carrera_esportiva|}}} }} <!-- Quan el bloc muntat no té etiqueta -->
| data283     =  {{{extensio_carrera_esportiva|}}}  <!-- bloc historial clubs esportius WD-->
| data284     =  {{Llista desplegable condicional |{{{extensio_participacio_esdeveniments|}}} |{{if empty|{{{desplega_participa|}}}|180}}}}  <!-- bloc participació en competicions o esdeveniments-->
| header287  =  {{#if:{{{obres|}}}{{{primeres_obres|}}} {{{programes|}}}{{{series|}}}{{{films|}}}
{{{papers|}}} {{{obres_notables|}}} {{{principals_projectes|}}}{{{estudiants_doctorals|}}}{{{estudiants_notables|}}}{{{assessorament_academic|}}}{{{autor_abrev_bot|}}}{{{autor_abrev_zoo|}}} {{{arxius|}}}
                 |  {{{lbl_header_work|}}} }}<!--   obra  -->
|  data289  = {{#if:{{{obres|}}}|{{align|start|{{{obres|}}} }}}}
| label290  = {{{lbl_M_early_works|}}} 
|  data290  = {{{primeres_obres|}}}
| label296   = {{{lbl_M_broadcasting_program|}}}
|  data296   = {{{programes|}}}

<!-- 6.7. BLOC ACTORS -->
| label302   = {{{lbl_M_series|}}}<!-- Q7725310 = sèries  -->
|  data302   = {{{series|}}}
| label304   = {{{lbl_M_films|}}}
|  data304   = {{{films|}}}
| label306   = {{{lbl_M_cast|}}}  
|  data306   = {{{papers|}}}

<!-- 6.8. BLOC ARTISTES-->
| data316     =  {{Llista desplegable condicional |{{{obres_notables|}}} |{{if empty|{{{desplega_obres|}}}|180}} 
                          |títol=   {{{lbl_P800_notable_work|}}} 
                          |estil_títol = background:#eeeeee;text-align:start;
                          |títol2= '''  {{{lbl_P800_notable_work|}}}'''}}

<!-- 6.9. BLOC ARQUITECTES -->
| label334  = {{{lbl_M_project|}}}  
|  data334  = {{{principals_projectes|}}} <!-- inclou {{{principals_dissenys|}}} -->

<!-- 6.10. BLOC CIENTÍFICS-->
| label341  =  {{{lbl_P185_doctoral_student|}}} 
|  data341  = {{{estudiants_doctorals|}}}
<!-- __________________  anul·lat en origen __________________
| label342  =  {{#if:{{{estudiants_notables|}}} |{{#if:{{{estudiants_doctorals|}}}|{{GetLabelFix|T0015|editicon=no|lang={{{lang|}}}}}|{{GetLabelFix|T0016|editicon=no|lang={{{lang|}}}}}}}}}
|  data342  = {{{estudiants_notables|}}}        -->
| label343  =  {{{lbl_M_academic_advisoring|}}} 
|  data343  = {{{assessorament_academic|}}}
| label349  =   {{{lbl_P428_botanist_author_abbreviation|}}}
| data349   = {{{autor_abrev_bot|}}}
| label351  =    {{{lbl_P835_zoologist_author_abbreviation|}}}
|  data351  = {{{autor_abrev_zoo|}}}
| label352  =   {{{lbl_P485_archives_at|}}} 
|  data352  = {{{arxius|}}}

| header353 = {{#if:{{{repertori|}}}   | {{{lbl_M_repertoire|}}} }}<!-- repertori  -->
|  data354  = {{#if:{{{repertori|}}}   | {{align|start|{{{repertori|}}} }} }}
| header355 = {{#if:{{{trajectoria|}}} | {{{lbl_M_trajectory|}}} }}
|  data356  = {{#if:{{{trajectoria|}}} |<div style="float: left;">{{{trajectoria|}}}</div>}} <!--********* provar en RTL ********  -->

<!-- 7. SECCIÓ FAMÍLIA/ALTRES -->
|header367 = {{#if:{{{carrecs_judicials|}}}{{{condemnes|}}}{{{situacio_judicial|}}}{{{situacio_penal|}}}{{{titol_personal|}}}
               | {{{lbl_header_others|}}}<!-- Q55107540= others  --> 
               |{{#if:{{{dinastia|}}}{{{conjuge|}}}{{{parella|}}}{{{fills|}}}{{{pares|}}}{{{pare|}}}{{{mare|}}}{{{germans|}}}{{{parents|}}}
                  |{{{lbl_header_family|}}}  }}<!-- Q8436 = family  -->
             }}
|label373     =   {{{lbl_P97_noble_title|}}}
|data373      = {{{titol_personal|}}}
| label381    =  {{{lbl_P53_family|}}}
| data381     = {{{dinastia|}}}
| label382    =   {{{lbl_P26_spouse|}}}
| data382     = {{{conjuge|}}}
| label383    =   {{{lbl_P451_partner|}}}
| data383     = {{{parella|}}} 
| label384    =   {{{lbl_P40_child|}}} 
| data384     = {{{fills|}}}
| label385    = {{#if:{{{pare|}}}
                  |{{#if:{{{mare|}}} |{{{lbl_M_progenitors|}}}<!-- Pares -->
                     |  {{{lbl_P22_father|}}} }}
                  |{{#if:{{{mare|}}} |  {{{lbl_P25_mother|}}}
                     |{{{lbl_M_progenitors|}}}<!-- Pares --><!-- Pares -->
                   }}
                }} 

| data385     = {{if empty | {{{pares|}}}
                           | {{if both|{{{pare|}}}|{{{mare|}}} | {{{pare|}}},&nbsp;{{{mare|}}} }}
                           | {{{pare|}}}
                           | {{{mare|}}}
                }}
| label386    =   {{{lbl_P3373_sibling|}}}
| data386     = {{{germans|}}}
| label387    =   {{{lbl_P1038_relative|}}}
| data387     = {{{parents|}}}
| label388    = {{{lbl_P793_significant_event|}}} 
| data388     = {{{cronologia|}}}
| label389    =   {{{lbl_P1595_charge|}}}
| data389     = {{{carrecs_judicials|}}}
| label390    =   {{{lbl_P1399_convicted_of|}}}
| data390     = {{{condemnes|}}}
| label391    = {{{lbl_M_judicial_status|}}} 
| data391     = {{{situacio_judicial|}}}
<!-- 8. SECCIÓ PREMIS -->
| header393    =  {{#if:{{{monuments|}}}  {{{extensio_guardons|}}} <!-- Si {{{{premis}}}, el header ho posa la llista-->
                    | {{{lbl_P166_award_received|}}} }}

<!-- extensio_guardons conté els antics premis informats manualment a les infotaules actor i director de cinema
      tal com aquestes infotaules treballen, és incompatible amb les llistes desplegables.
     Quan s'acabin d'integrar i els premis siguin tractats igual que a la resta de professions
       o s'agafin directament des de WD, es podrà eliminar el tractament de extensio_guardons -->
| data395     =  {{#if: {{{extensio_guardons|}}} | {{{extensio_guardons|}}}  
                   |{{Llista desplegable condicional |{{{premis|}}} |{{if empty|{{{desplega_premis|}}}|180}} 
                          |títol= {{{lbl_P166_award_received|}}} 
                          |estil_títol = background:{{colors infotaules|biografia}};text-align:center;
                          |títol2= ''' {{{lbl_P166_award_received|}}}''' 
                       }}   
                 }}
| label397     = {{{lbl_M_memorials|}}}
| data397      = {{{monuments|}}}

<!-- 9. SECCIÓ OBRA NOTABLE (ARTISTES i ARQUITECTES) -->
| header399 = {{#if:{{{M_image_work|{{{image_work|}}}}}} | {{{lbl_P800_notable_work|}}} }}
                                             <!-- Forçar alineament imatge a "center" -->
| data400   = {{#if:{{{M_image_work|{{{image_work|}}}}}}|<center>[[Fitxer:{{{imatgeobra}}}|200px]]<br/>{{mida|0.85em|{{{M_foot_image_work|{{{foot_image_work|}}}}}} }}</center> }}

<!-- 10. SECCIÓ PEU (Signatura, dades de la xarxa i notes. Sempre surt al peu) -->
| data403     = {{#if:{{{signatura|}}}
                  |<center>''' {{{lbl_P109_signature|}}} '''<div style="padding-top:0.3em;"><!--
                   -->[[Fitxer:{{{signatura|}}}|220x250px<!--
                           -->|alt={{{alt_signatura|}}}]]</div></center>}}
<!-- Línia de separació entre paràmetres biogràfics i escut peu dels monarques -->
| data404     = {{#if:{{{escutpeu|}}} | <hr/> }}
| data405     = {{#if:{{{escutpeu|}}}|<center><div style="padding-top:0.3em;"><!--
                   -->[[Fitxer:{{{escutpeu|}}}|100px|alt= {{{lbl_P94_coat_arms_image|}}}&nbsp;{{{nom|{{títol sense cua}}}}}]]</div></center>}}
| data406     = {{#if:{{{escutpeu|}}}|<center>{{{lema_escut|}}}</center> }}

<!-- Línia de separació entre paràmetres biogràfics i enllaços externs -->
| data407     = {{#if:{{{xarxes|}}} {{{lloc_web|}}} 
| <hr/> }}
<!-- Registrament de veu des de WD.   -->
| data408     = {{#if:{{{registre_veu|}}}
                  |<div style="padding-left:30px;">{{Escoltar
                   |nom_del_fitxer={{{registre_veu|}}}
                   | títol= Veu de {{{nom|{{títol sense cua}}}}}
                   | descripció=
                   |pla=sí|tipus=veu }}</div>
                }}
| label410    = {{{lbl_P856_official_website|}}} 
| data410     = {{{lloc_web|}}}
| data417     = {{{xarxes|}}}
| data447     = {{#if:{{{dades_medaller|}}}
                  |{{Plantilla:Infotaula persona/medaller|header_medaller={{if empty|{{{header_medaller|}}} |Medaller}} |dades_medaller = {{{dades_medaller|}}} }}
                }}]==========]

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