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 args = require('Module:Arguments').getArgs(frame, {wrappers = 'Template:Professional wrestling results table'})
local warnings = {}
-- Preprocessing
local live_msg = 'broadcast prior to the pay-per-view on '
local taped_msg = 'taped for a future broadcast of '
local notes = {
dark = { 'D', 'a [[dark match]]' },
pre = { 'P', 'broadcast on the pre-show' },
aewd = { 'AD', taped_msg ..'<i>[[AEW Dark]]</i>' },
aewde = { 'DE', taped_msg ..'<i>[[AEW Dark: Elevation]]</i>' },
ffa = { 'F', live_msg ..'<i>[[WWE Free for All|Free for All]]</i>' },
fusion = { 'FT', taped_msg ..'<i>[[MLW Fusion|Fusion]]</i>' },
fusionlive = { 'F', live_msg ..'<i>[[MLW Fusion|Fusion]]</i>' },
heat = { 'H', live_msg ..'<i>[[WWE Heat|Sunday Night Heat]]</i>' },
regnxt = { 'N', taped_msg ..'<i>[[WWE NXT|NXT]]</i>' },
regnxtuk = { 'UK', taped_msg ..'<i>[[WWE NXT UK|NXT UK]]</i>' },
slam = { 'S', live_msg ..'<i>[[WWF Sunday Night Slam|Sunday Night Slam]]</i>' },
wcwme = { 'ME', live_msg ..'<i>[[WCW Main Event|Main Event]]</i>' },
wcwsn = { 'SN', live_msg ..'<i>[[WCW Saturday Night|Saturday Night]]</i>' },
xplosion = { 'X', taped_msg ..'<i>[[Impact! Xplosion|Xplosion]]</i>' }
}
local matches, notes_key, notes_key_filter = {}, {}, {}
local times_active, champions_active
local row_num = 1
-- Fetch old note parameters, to be deprecated
for k, v in pairs(args) do
if v == 'yes' then
local note_key, note_num = k:match('(%a*)(%d*)')
if notes[note_key] then
args['note'.. note_num] = note_key
end
end
end
while args['match'.. row_num] do
local row_note = args['note'.. row_num]
if row_note then
if notes[row_note] then
-- Add note to Key, avoid duplicates
-- Index numerically to render in order
if not notes_key_filter[row_note] then
notes_key_filter[row_note] = true
table.insert(notes_key, row_note)
end
-- Add tense to Key
if args['match'.. row_num]:match('defeated')
or args['match'.. row_num]:match('ended in')
or args['match'.. row_num]:match('won by') then
notes[row_note][2] = 'was '.. notes[row_note][2]
else
notes[row_note][2] = 'will be '.. notes[row_note][2]
end
row_note = notes[row_note][1]
else -- Invalid note
table.insert(warnings, '<b>note'.. row_num ..'</b> with "'.. row_note ..'"')
row_note = nil
end
end
local row_time = args['time'.. row_num]
if row_time then
if row_time:match('[0-9]:[0-5][0-9]') then
times_active = true
else -- Invalid time format
table.insert(warnings, '<b>time'.. row_num ..'</b> with "'.. row_time ..'" (M:SS expected)')
row_time = nil
end
end
-- Detect champions for Key
if not champions_active then
if args['match'.. row_num]:match('%(c%)') then
champions_active = true
end
end
table.insert(matches, {row_note, args['match'.. row_num], args['stip'.. row_num], row_time})
row_num = row_num+1
end
local notes_active = #notes_key > 0 and true or false
local future_event = true
-- Check if event has concluded
if row_num > 1 then
if args['match'.. row_num-1]:match('defeated')
or args['match'.. row_num-1]:match('ended in')
or args['match'.. row_num-1]:match('won by') then
future_event = false
end
end
-- Table start
local root = mw.html.create('table')
:addClass('wikitable')
:css('margin', args['align'] == 'center' and '1em auto !important' or nil) -- Optional center align
if args['caption'] then
root
:tag('caption')
:wikitext(args['caption'])
end
-- Header
local header = root:tag('tr')
header
:tag('th')
:attr('scope', 'col')
:attr('colspan', notes_active and '2' or nil)
:tag('abbr')
:attr('title', notes_active and 'Note and number' or 'Number')
:wikitext('No.')
:done()
:done()
:tag('th')
:attr('scope', 'col')
:wikitext(future_event and 'Matches*' or 'Results' .. (args['results'] or '')) -- Optional reference
:done()
:tag('th')
:attr('scope', 'col')
:wikitext('Stipulations')
if times_active 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 v[1] then
row
:tag('th')
:attr('scope', 'row')
:tag('span')
:css('font-size', '90%')
:wikitext(v[1])
elseif notes_active then
-- 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
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 v[4] then
row
:tag('td')
:css('text-align', 'center')
:wikitext(v[4])
elseif times_active then
-- mirror Template:N/a
row
:tag('td')
:addClass('table-na')
:css('text-align', 'center')
:css('background-color', '#ececec')
:css('color', '#2C2C2C')
:wikitext('—')
end
end
-- Key
if champions_active or notes_active or future_event 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 !important')
:css('padding', '0')
:css('border-spacing', '0')
:css('line-height', '1.4em')
if champions_active then
key
:tag('tr')
:tag('td')
:css('text-align', 'right')
:wikitext('(c)')
:done()
:tag('td')
:wikitext(' – the champion(s) heading into the match')
end
for _, v in ipairs(notes_key) do
key
:tag('tr')
:tag('td')
:css('text-align', 'right')
:tag('span')
:css('font-size', '90%')
:css('font-weight', 'bold')
:wikitext(notes[v][1])
:done()
:done()
:tag('td')
:wikitext(' – the match '.. notes[v][2])
end
if future_event then
key
:tag('tr')
:tag('td')
:attr('colspan', '2')
:css('text-align', 'center')
:css('font-size', '85%')
:css('font-weight', 'bold')
:wikitext('*Card subject to change')
end
end
-- Preview warnings and tracking
if args['align'] and args['align'] ~= 'center' then
table.insert(warnings, '<b>align</b> with "'.. args['align'] ..'" ("center" expected)')
end
if #warnings > 0 then
root = require('Module:If preview')._warning({'Invalid parameter value at '.. table.concat(warnings, '; ') ..'.'})
.. '[[Category:Pages using professional wrestling results table with invalid parameter values]]'
.. tostring(root)
end
return root
end
return p