Module:Professional wrestling results table
Appearance
![]() | This module depends on the following other modules: |
This module implements {{Professional wrestling results table}}. Please see the template page for documentation.
Adding notes
Firstly, familiarize yourself with the format of the notes table:
local notes = {
dark = { 'D', 'a [[dark match]]' },
pre = { 'P', 'broadcast on the pre-show' },
aewd = { 'AD', taped ..'<i>[[AEW Dark|Dark]]</i>' },
aewde = { 'DE', taped ..'<i>[[AEW Dark: Elevation|Dark: Elevation]]</i>' },
bti = { 'B', taped ..'<i>[[Before the Impact]]</i>' },
ffa = { 'F', live ..'<i>[[WWE Free for All|Free for All]]</i>' },
fusion = { 'FT', taped ..'<i>[[MLW Fusion|Fusion]]</i>' },
fusionlive = { 'F', live ..'<i>[[MLW Fusion|Fusion]]</i>' },
heat = { 'H', live ..'<i>[[WWE Heat|Sunday Night Heat]]</i>' },
mem = {'MEM', taped ..'<i>Main Event Mondays</i>' },
regnxt = { 'N', taped ..'<i>[[WWE NXT|NXT]]</i>' },
regnxtuk = { 'UK', taped ..'<i>[[WWE NXT UK|NXT UK]]</i>' },
slam = { 'S', live ..'<i>[[WWF Sunday Night Slam|Sunday Night Slam]]</i>' },
wcwme = { 'ME', live ..'<i>[[WCW Main Event|Main Event]]</i>' },
wcwsn = { 'SN', live ..'<i>[[WCW Saturday Night|Saturday Night]]</i>' },
xplosion = { 'X', taped ..'<i>[[Impact! Xplosion|Xplosion]]</i>' }
}
The notes table has been aligned to be easier to understand for editors inexperienced with Lua. Let's break it down further, with a specific example:
heat = { 'H', live ..'<i>[[WWE Heat|Sunday Night Heat]]</i>' },
- heat is the note value (e.g.,
|note1=heat
) - H is the note symbol that appears beside the match number
- The latter entry is the explanation in the Key. There are live (aired prior to the pay-per-view) and taped (recorded for future broadcast) preset options. This should include a wikilink to the program, enclosed by italic HTML tags (<i></i>).
When adding a note, there are a few things to keep in mind:
- The note value should be short, yet comprehensible. Use an abbreviation or acronym of the program. If the resulting value is common and there is potential for overlap, consider including the acronym of the promotion.
- The note symbol should be limited to one or two characters. If there is potential overlap with other symbols in the same results table, then adjust the symbol accordingly. Avoid using "D" or "P" as they are generalized notes for dark match and pre-show, respectively.
local p = {}
function p.main(frame)
local getArgs = require('Module:Arguments').getArgs
local args = getArgs(frame)
local notes = {}
local notes_active = {}
local notes_active_filter = {}
local error_msg = {}
-- Preprocessing
local future_event, results_label
local tense = args['future'] == 'yes' and 'will be' or 'was'
if (args['future'] or args['current']) == 'yes' then
future_event = true
results_label = 'Matches *'
else
future_event = false
results_label = 'Results'
end
local live_msg = tense ..' broadcast prior to the pay-per-view on '
local taped_msg = 'was taped for a future broadcast of '
notes = {
dark = { -- Dark match
id = 'D',
key = 'was a [[dark match]]'
},
pre = { -- Pre-show
id = 'P',
key = tense ..' broadcast on the pre-show'
},
aewd = { -- AEW Dark
id = 'AD',
key = taped_msg ..'<i>[[AEW Dark]]</i>'
},
aewde = { -- AEW Dark: Elevation
id = 'DE',
key = taped_msg ..'<i>[[AEW Dark: Elevation]]</i>'
},
ffa = { -- WWE Free for All
id = 'F',
key = live_msg .. '<i>[[WWE Free for All|Free for All]]</i>'
},
fusion = { -- MLW Fusion (taped)
id = 'FT',
key = taped_msg ..'<i>[[MLW Fusion|Fusion]]</i>'
},
fusionlive = { -- MLW Fusion (live)
id = 'F',
key = live_msg ..'<i>[[MLW Fusion|Fusion]]</i>'
},
heat = { -- WWE Sunday Night Heat
id = 'H',
key = live_msg ..'<i>[[WWE Heat|Sunday Night Heat]]</i>'
},
regnxt = { -- WWE NXT (taped)
id = 'N',
key = taped_msg ..'<i>[[WWE NXT|NXT]]</i>'
},
regnxtuk = { -- WWE NXT UK (taped)
id = 'UK',
key = taped_msg ..'<i>[[WWE NXT UK|NXT UK]]</i>'
},
slam = { -- WWF Sunday Night Slam
id = 'S',
key = live_msg ..'<i>[[WWF Sunday Night Slam|Sunday Night Slam]]</i>'
},
wcwme = { -- WCW Main Event
id = 'ME',
key = live_msg ..'<i>[[WCW Main Event|Main Event]]</i>'
},
wcwsn = { -- WCW Saturday Night
id = 'SN',
key = live_msg ..'<i>[[WCW Saturday Night|Saturday Night]]</i>'
},
xplosion = { -- Impact! Xplosion
id = 'X',
key = taped_msg ..'<i>[[Impact! Xplosion|Xplosion]]</i>'
}
}
local matches = {}
local col_notes, col_times
local row_num = 1
while args['match'..row_num] ~= nil do
local row_note = args['note'..row_num]
if row_note ~= nil then
if notes[row_note] ~= nil then
if not col_notes then
col_notes = true
end
table.insert(notes_active, row_note) -- For sorting
row_note = notes[row_note].id
else -- Error: invalid note
table.insert(error_msg, ' note'.. row_num ..' with args "'.. row_note ..'".')
row_note = nil
end
else -- Fetch old notes, to be deprecated
for k,v in pairs(notes) do
if args[k .. row_num] == 'yes' then
table.insert(notes_active, k) -- For sorting
row_note = notes[row_note].id
break
end
end
end
local row_time = args['time'..row_num]
if row_time ~= nil then
if not col_times then
col_times = true
end
else
row_time = '–'
end
table.insert(matches, {row_note, args['match'..row_num], args['stip'..row_num], row_time})
row_num = row_num+1
end
-- Table start
local root = mw.html.create('table')
:addClass('wikitable')
:css('margin', args['align'] == 'center' and '1em auto' or nil) -- Optional center align
if args['caption'] ~= nil then
root
:tag('caption')
:wikitext(args['caption'])
end
-- Header
local header = root:tag('tr')
header
:tag('th')
:attr('scope', 'col')
:attr('colspan', col_notes and '2' or nil)
:wikitext('No.')
:done()
:tag('th')
:attr('scope', 'col')
:wikitext(results_label .. (args['results'] or '')) -- Optional reference
:done()
:tag('th')
:attr('scope', 'col')
:wikitext('Stipulations')
if col_times then
header
:tag('th')
:attr('scope', 'col')
:wikitext('Times'.. (args['times'] or '')) -- Optional reference
end
-- Matches
for num, v in ipairs(matches) do
local row = root:tag('tr')
-- Note
if col_notes then
if v[1] ~= nil then
row
:tag('th')
:attr('scope', 'row')
:tag('span')
:css('font-size', '90%')
:wikitext(v[1])
else
-- Blank col to maintain consistent alignment of match number
-- Hide border to draw less attention to blank col
row
:tag('th')
:attr('scope', 'row')
:css('border-right-color', 'transparent')
end
end
row
-- Match number
:tag('th')
:attr('scope', 'row')
:wikitext(num)
:done()
-- Match
:tag('td')
:wikitext(v[2])
:done()
-- Stipulation
:tag('td')
:wikitext(v[3])
-- Time
if col_times then
row
:tag('td')
:attr('align', 'center')
:wikitext(v[4])
end
end
-- Key
-- Optionally hide key or champion's note
if args['hide'] ~= ('key' or 'all') then
local key = root:tag('tr')
:tag('th')
:attr('scope', 'row')
:attr('colspan', '5')
:css('border-top', 'solid 2px #aaa')
:css('font-weight', 'normal')
:css('text-align', 'left')
:tag('table')
:css('margin', '0 auto')
:css('padding', '0')
:css('border-spacing', '0')
:css('line-height', '1.4em')
if args['hide'] ~= ('champions' or 'champs') then
key
:tag('tr')
:tag('td')
:attr('align', 'right')
:wikitext('(c) ')
:done()
:tag('td')
:wikitext('– the champion(s) heading into the match')
end
for _, v in ipairs(notes_active) do
if notes_active_filter[v] == nil then -- Filter duplicates
notes_active_filter[v] = true
key
:tag('tr')
:tag('td')
:attr('align', 'right')
:tag('span')
:css('font-size', '90%')
:css('font-weight', 'bold')
:wikitext(notes[v].id ..' ')
:done()
:done()
:tag('td')
:wikitext('– the match '.. notes[v].key)
end
end
if future_event then
key
:tag('tr')
:tag('td')
:attr('colspan', '2')
:attr('align', 'center')
:css('font-size', '85%')
:css('font-weight', 'bold')
:wikitext('* Card subject to change')
end
end
-- Display errors
if next(error_msg) ~= nil then
root
:tag('strong')
:addClass('error')
:wikitext('Error: invalid value at'.. table.concat(error_msg))
-- Add tracking category later
end
return root
end
return p