Jump to content

Module:IncrementParams: Difference between revisions

From Wikipedia, the free encyclopedia
Content deleted Content added
No edit summary
Tag: Reverted
Undid revision 1082557955 by (talk)
Line 6: Line 6:
-- STEP 3: Replace the example template text with the template text that you wish to increment.
-- STEP 3: Replace the example template text with the template text that you wish to increment.
local templatetext = [==========[
local templatetext = [==========[
|header3 = Section 1
| image1 = {{#invoke:InfoboxImage|InfoboxImage|image={{{logo|}}}|size={{{logo_size|{{{logo_width|}}}}}}|sizedefault=frameless|upright={{{logo_upright|1.1}}}|alt={{{logo_alt|}}}}}
|label5 = Label A
| caption1 = {{{logo_caption|}}}
|data5 = Data A

|label7 = Label C
| image2 = {{#invoke:InfoboxImage|InfoboxImage|image={{{image|}}}|size={{{image_size|{{{image_width|}}}}}}|sizedefault=frameless|upright={{{image_upright|1.1}}}|border=yes|alt={{{image_alt|{{{alt|}}}}}}}}
|data7 = Data C
| caption2 = {{{caption|{{{image_caption|}}}}}}
|header10 = Section 2

|label12 = Label D
| image3 = {{#if:{{{pushpin_map|{{{map_type|}}}}}}|{{Location map|{{{pushpin_map|{{{map_type|}}}}}}
|data12 = Data D
|alt = {{{pushpin_map_alt|{{{map_alt|}}}}}}
|coordinates = {{{coordinates|}}}
|float = center
|mark = {{{map_dot_mark|Red pog.svg}}}
|marksize= 7
|label = {{{pushpin_label|{{{map_dot_label|}}}}}}
|relief = {{{pushpin_relief|{{{relief|}}}}}}
|border = infobox
|caption = {{{pushpin_map_caption|{{{map_caption|Location within {{#invoke:Location map|data|{{{pushpin_map|{{{map_type}}}}}}|name}}}}}}}}
|width = {{{pushpin_mapsize|{{{map_size|}}}}}}
}} |<!-- else if map_type is blank
-->{{#invoke:InfoboxImage|InfoboxImage|image={{{image_map|}}}|size={{{map_size|}}}|sizedefault=frameless|alt={{{map_alt|}}}}}<!-- end if map_type
-->}}
| caption3 = {{#if:{{{pushpin_map|{{{map_type|}}}}}} |<!-- leave blank -->| {{{map_caption|}}} }}

| image4 = {{#invoke:Infobox mapframe|auto|onByDefault={{#if:{{{pushpin_map|}}}{{{map_type|}}}{{{image_map|}}}|no|yes}}|mapframe-zoom={{{mapframe-zoom|13}}}}}
| caption4 = {{#invoke:Infobox mapframe|autocaption|onByDefault={{#if:{{{pushpin_map|}}}{{{map_type|}}}{{{image_map|}}}|no|yes}}}}

| label1 = Former names
| data1 = {{{former_names|{{{former_name|}}}}}}
| class1 = nickname

| label2 = Alternative names
| data2 = {{{alternate_names|{{{alternate_name|}}}}}}
| class2 = nickname

| label3 = Etymology
| data3 = {{{etymology|}}}

| label4 = Hotel chain
| data4 = {{{hotel_chain|{{{chain|}}}}}}

| header5 = {{#if:{{{highest_prev|}}}{{{highest_next|}}}{{{highest_start|}}}{{{highest_end|}}}{{{highest_region|}}}|Record height}}

| data6 = {{#if:{{{highest_start|}}}{{{highest_end|}}}
|Tallest in {{#if:{{{highest_region|}}}|{{{highest_region}}}|the world}}<!--
--> {{#if:{{both|{{{highest_start|}}}|{{{highest_end|}}}}}
|from {{{highest_start|}}} to {{{highest_end|}}}
|{{#if:{{{highest_start|}}}|since {{{highest_start}}} }}<!--
-->{{#if:{{{highest_end|}}}|until {{{highest_end}}} }}<!--
-->}}{{ref label|{{{highest_reflabel|talleststatus}}}|I|}}
}}

| label7 = Preceded by
| data7 = {{{highest_prev|}}}

| label8 = Surpassed by
| data8 = {{{highest_next|}}}


| header9 = {{#if:{{{status|}}}{{{building_type|}}}{{{architectural_style|}}}{{{style|}}}{{{classification|}}}{{{location|}}}{{{location_town|}}}{{{location_city|}}}{{{location_country|}}}{{{address|}}}{{{coordinates|}}}{{{altitude|}}}{{{start_date|}}}{{{construction_start_date|}}}{{{topped_out_date|}}}{{{est_completion|}}}{{{completion_date|}}}{{{inauguration_date|}}}{{{groundbreaking_date|}}}{{{opening_date|}}}{{{opening|}}}{{{opened|}}}{{{opened_date|}}}{{{renovation_date|}}}{{{closing_date|}}}{{{demolition_date|}}}{{{date_demolished|}}}{{{demolished_date|}}}{{{destruction_date|}}}{{{destroyed|}}}{{{cost|}}}{{{ren_cost|}}}{{{client|}}}{{{owner|}}}{{{governing_body|}}}{{{landlord|}}}{{{management|{{{operator|}}}}}}{{{affiliation|}}}|General information}}

| label10 = Status
| class10 = category
| data10 = {{#if:{{{status|}}}|{{#switch:{{lc:{{{status|}}}}}
| built | completed | finished
| complete = Complete
| destroyed = Destroyed
| demolished = Demolished
| on hold = On hold
| incomplete | unfinished
| under construction = Under construction
| cancelled | canceled
| never built = Never built
| topped out
| topped-out = [[Topping out|Topped-out]]
| planned
| proposed = Proposed
| approved = Approved
| #default = {{{status|}}}
}}|{{#if:{{{cancelled|}}}{{{canceled|}}}|Never built|{{#if:{{{topped_out|}}}|[[Topping out|Topped-out]]}} }} }}

| label11 = Type
| data11 = {{{building_type|}}}
| class11 = category

| label12 = Architectural style
| data12 = {{{architectural_style|{{{style|}}}}}}
| class12 = category

| label13 = Classification
| data13 = {{{classification|}}}
| class13 = category

| class14 = label
| label14 = Location
| data14 = {{{location|}}}

| label15 = Address
| data15 = {{{address|}}}

| label16 = Town or city
| data16 = {{if empty|{{{location_town|}}}|{{{location_city|}}}}}

| label17 = Country
| data17 = {{{location_country|}}}

| label18 = [[Geographic coordinate system|Coordinates]]
| data18 = {{#if:{{{coordinates|}}}|{{#invoke:Coordinates|coordinsert|{{{coordinates|}}}|type:landmark|{{#if:{{{location_country|}}}|region:{{Country abbreviation|{{{location_country}}}}}}}}}|}}

| label19 = {{if empty|{{{grid_name|}}}|Grid&nbsp;position}}
| data19 = {{{grid_position|}}}

| label20 = Elevation
| data20 = {{{altitude|}}}

| label21 = Current tenants
| data21 = {{{current_tenants|}}}

| label22 = Named for
| data22 = {{{namesake|}}}

| label23 = Groundbreaking
| data23 = {{{groundbreaking_date|}}}

| label24 = Built
| data24 = {{{built|}}}

| label24 = {{Nowrap|Construction started}}
| data24 = {{{start_date|{{{construction_start_date|}}}}}}

| label25 = {{Nowrap|Construction stopped}}
| data25 = {{{stop_date|{{{construction_stop_date|}}}}}}

| label26 = Topped-out
| data26 = {{{topped_out_date|}}}

| rowclass27= note
| label27 = {{#if:{{{est_completion|}}}|Estimated completion|{{#if:{{{completion_date|}}}|Completed}} }}
| data27 = {{if empty|{{{est_completion|}}}|{{{completion_date|}}} }}

| label28 = {{#if:{{{opened|{{{opened_date|}}}}}}|{{#iferror:{{#ifexpr: {{#time:U|{{Plain text|1={{MultiReplace|1={{{opened|{{{opened_date}}}}}}|2=%<.*%>|3=|4=%s|5=}}}}}}>{{#time:U}} |Opening|Opened}}|Opened}}|Opening}}
| data28 = {{if empty|{{{opened_date|}}}|{{{opened|}}}|{{{opening_date|}}}|{{{opening|}}}}}

| label29 = Inaugurated
| data29 = {{{inauguration_date|}}}

| label30 = Relocated
| data30 = {{{relocated_date|}}}

| label31 = Renovated
| data31 = {{{renovation_date|}}}

| label32 = Closed
| data32 = {{{closing_date|}}}

| rowclass33= note
| label33 = {{#if:{{{demolition_date|}}}{{{date_demolished|}}}{{{demolished_date|}}}|Demolished|Destroyed}}
| data33 = {{if empty|{{{demolition_date|}}}|{{{date_demolished|}}}|{{{demolished_date|}}}|{{{destruction_date|}}}|{{{destroyed|}}}}}

| label34 = Cost
| data34 = {{{cost|}}}

| label35 = Renovation cost
| data35 = {{{ren_cost|}}}

| label36 = Client
| data36 = {{{client|}}}

| label37 = Owner
| data37 = {{{owner|}}}

| label38 = {{#if:{{{governing_body|}}}|Governing body|{{#if:{{{landlord|}}}|Landlord|Management}}}}
| data38 = {{#if:{{{governing_body|}}}|{{{governing_body|}}}|{{#if:{{{landlord|}}}|{{{landlord}}}|{{{management|{{{operator|}}}}}}}}}}

| label39 = Affiliation
| data39 = {{{affiliation|}}}

| header40 = {{#if:{{{architectural|}}}{{{tip|}}}{{{antenna_spire|}}}{{{roof|}}}{{{top_floor|}}}{{{observatory|}}}|Height}}

| label41 = Height
| data41 = {{{height|}}}

| label42 = Architectural
| data42 = {{{architectural|}}}

| label43 = Tip
| data43 = {{{tip|}}}

| label44 = Antenna spire
| data44 = {{{antenna_spire|}}}

| label45 = Roof
| data45 = {{{roof|}}}

| label46 = Top floor
| data46 = {{{top_floor|}}}

| label47 = Observatory
| data47 = {{{observatory|}}}

| header48 = {{#if:{{{diameter|}}}{{{circumference|}}}{{{weight|}}}{{{other_dimensions|}}}|Dimensions}}

| label49 = Diameter
| data49 = {{{diameter|}}}

| label50 = Circumference
| data50 = {{{circumference|}}}

| label51 = Weight
| data51 = {{{weight|}}}

| label52 = Other dimensions
| data52 = {{{other_dimensions|}}}

| header53 = {{#if:{{{structural_system|}}}{{{material|}}}{{{size|}}}{{{floor_count|{{{floors|}}}}}}{{{floor_area|}}}{{{elevator_count|}}}|Technical details}}

| label54 = Structural system
| data54 = {{{structural_system|}}}
| class54 = category

| label55 = Material
| data55 = {{{material|}}}
| class55 = category

| label56 = Size
| data56 = {{{size|}}}

| label57 = Floor count
| data57 = {{{floor_count|{{{floors|}}}}}}

| label58 = Floor area
| data58 = {{{floor_area|}}}

| label59 = Lifts/elevators
| data59 = {{{elevator_count|}}}

| label60 = Grounds
| data60 = {{{grounds_area|}}}

| header61 = {{#if:{{{architect|}}}{{{architecture_firm|}}}{{{developer|}}}{{{engineer|}}}{{{structural_engineer|}}}{{{civil_engineer|}}}{{{other_designers|}}}{{{quantity_surveyor|}}}{{{main_contractor|}}}{{{main_contractors|}}}|Design and construction}}

| label62 = Architect
| data62 = {{{architect|}}}

| label63 = Architecture firm
| data63 = {{{architecture_firm|}}}

| label64 = Developer
| data64 = {{{developer|}}}

| label65 = Engineer
| data65 = {{{engineer|}}}

| label66 = Structural engineer
| data66 = {{{structural_engineer|}}}

| label67 = Services engineer
| data67 = {{{services_engineer|}}}

| label68 = Civil engineer
| data68 = {{{civil_engineer|}}}

| label69 = Other designers
| data69 = {{{other_designers|}}}

| label70 = Quantity surveyor
| data70 = {{{quantity_surveyor|}}}

| label71 = Main contractor
| data71 = {{{main_contractor|{{{main_contractors|}}}}}}

| rowclass72 = note
| label72 = Awards and prizes
| data72 = {{{awards|}}}

| label73 = Designations
| data73 = {{{designations|}}}

| label74 = Known for
| data74 = {{{known_for|}}}

| header75 = {{#if:{{{ren_architect|}}}{{{ren_firm|}}}{{{ren_engineer|}}}{{{ren_str_engineer|}}}{{{ren_serv_engineer|}}}{{{ren_civ_engineer|}}}{{{ren_oth_designers|}}}{{{ren_qty_surveyor|}}}{{{ren_contractor|}}}{{{ren_awards|}}}|Renovating team}}

| rowclass76 = note
| label76 = Architect
| data76 = {{{ren_architect|}}}

| label77 = Renovating firm
| data77 = {{{ren_firm|}}}

| label78 = Engineer
| data78 = {{{ren_engineer|}}}

| label79 = Structural engineer
| data79 = {{{ren_str_engineer|}}}

| label80 = Services engineer
| data80 = {{{ren_serv_engineer|}}}

| label81 = Civil engineer
| data81 = {{{ren_civ_engineer|}}}

| label82 = Other designers
| data82 = {{{ren_oth_designers|}}}

| label83 = Quantity surveyor
| data83 = {{{ren_qty_surveyor|}}}

| label84 = Main contractor
| data84 = {{{ren_contractor|}}}

| rowclass85 = note
| label85 = Awards and prizes
| data85 = {{{ren_awards|}}}

| header86 = {{#if:{{{seating_type|}}}{{{capacity|{{{seating_capacity|}}}}}}{{{number_of_stores|}}}{{{number_of_anchors|}}}{{{unit_count|}}}{{{number_of_units|}}}{{{number_of_rooms|}}}{{{room_count|}}}{{{rooms|}}}{{{number_of_suites|}}}{{{suite_count|}}}{{{suites|}}}{{{number_of_restaurants|}}}{{{number_of_bars|}}}{{{facilities|}}}{{{parking|}}}{{{public_transit|}}}|Other information}}

| label87 = Seating type
| data87 = {{{seating_type|}}}

| label88 = Seating capacity
| data88 = {{{capacity|{{{seating_capacity|}}}}}}

| label89 = Number of stores
| data89 = {{{number_of_stores|}}}

| label90 = Number of anchors
| data90 = {{{number_of_anchors|}}}

| label91 = Number of {{#if:{{{unit_count|}}}{{{number_of_units|}}}|units|rooms}}
| data91 = {{if empty|{{{unit_count|}}}|{{{number_of_units|}}}|{{{number_of_rooms|}}}|{{{room_count|}}}|{{{rooms|}}}}}

| label92 = Number of suites
| data92 = {{if empty|{{{number_of_suites|}}}|{{{suite_count|}}}|{{{suites|}}}}}

| label93 = Number of restaurants
| data93 = {{{number_of_restaurants|}}}

| label94 = Number of bars
| data94 = {{{number_of_bars|}}}

| label95 = Facilities
| data95 = {{{facilities|}}}

| label96 = Parking
| data96 = {{{parking|}}}

| label97 = Public transit access
| data97 = {{{public_transit|}}}

| header98 = {{#if:{{{website|}}}|Website}}

| data99 = {{{website|}}}

| header100 = {{{nrhp|{{{embedded|{{{module|}}}}}}}}}

| header101 = {{#if:{{{references|}}}|References}}
| data102 = {{{references|}}}
]==========]
]==========]



Revision as of 21:05, 13 April 2022

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

-- STEP 3: Replace the example template text with the template text that you wish to increment.
local templatetext = [==========[
|header3  = Section 1
|label5   = Label A
|data5    = Data A
|label7   = Label C
|data7    = Data C
|header10 = Section 2
|label12  = Label D
|data12   = Data D
]==========]

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