Module:Video game reviews/sandbox: Difference between revisions

Content deleted Content added
clean up, typo(s) fixed: XBOX → Xbox, a award → an award using AWB
include The Escapist
Line 13:
local p = {}
 
local reviewer = {{'[[1UP.com]]', '1UP'}}, {'[[ActionTrip]]', 'Atrip'}, {'[[Adventure Gamers]]', 'AdvGamers'}, {'[[Allgame]]', 'Allgame'}, {'[[Amstrad Action]]', 'AAction'}, {'[[Amtix!]]', 'Amtix'}, {'[[Computer and Video Games]]', 'CVG'}, {'[[Crash (magazine)|Crash]]', 'CRASH'}, {'[[Destructoid]]', 'Destruct'}, {'[[Dragon (magazine)]]', 'Dragon'}, {'[[Edge (magazine)|Edge]]', 'Edge'}, {'[[Electronic Gaming Monthly]]', 'EGM'}, {'[[The Escapist (magazine)|The Escapist]]', 'Escapist'}, {'[[Eurogamer]]', 'EuroG'}, {'[[Famitsu]]', 'Fam'}, {'[[G4 (TV channel)|G4]]', 'G4'}, {'GameCritics', 'GCritics'}, {'[[GameFan]]', 'GameFan'}, {'[[Game Informer]]', 'GI'}, {'[[GamePro]]', 'GamePro'}, {'[[Game Revolution]]', 'GameRev'}, {'[[GamesMaster]]', 'GMaster'}, {'[[GamesRadar]]', 'GRadar'}, {'[[GameSpot]]', 'GSpot'}, {'[[GameSpy]]', 'GSpy'}, {'[[GamesTM]]', 'GTM'}, {'[[GameTrailers]]', 'GT'}, {'GameWire', 'GW'}, {'[[GameZone]]', 'GameZone'}, {'[[Giant Bomb]]', 'GB'}, {'[[Hyper (magazine)|Hyper Magazine]]', 'Hyper'}, {'[[IGN]]', 'IGN'}, {'[[Joystiq]]', 'Joystiq'}, {'[[Maximum PC]]', 'MaxPC'}, {'[[NGC Magazine]]', 'N64'}, {'[[NGC Magazine]]', 'NGC'}, {'[[NGamer]]', 'NG'}, {'NintendoLife', 'NLife'}, {'[[Nintendo Power]]', 'NP'}, {'Nintendo World Report', 'NWR'}, {'[[Official Nintendo Magazine]]', 'ONM'}, {'[[Official U.S. PlayStation Magazine|Official PlayStation Magazine (US)]]', 'OPM'}, {'[[PlayStation Official Magazine (UK)|Official PlayStation Magazine (UK)]]', 'OPMUK'}, {'[[Official PlayStation Magazine (Australia)]]', 'OPMAU'}, {'[[Official Xbox Magazine]]', 'OXM'}, {'[[Official Xbox Magazine|Official Xbox Magazine UK]]', 'OXMUK'}, {'[[PALGN]]', 'PALGN'}, {'[[PC Format]]', 'PCF'}, {'[[PC Gamer|PC Gamer UK]]', 'PCGUK'}, {'[[PC Gamer|PC Gamer US]]', 'PCGUS'}, {'[[PC PowerPlay]]', 'PCPP'}, {'[[PC Zone]]', 'PCZone'}, {'[[Play (UK magazine)|Play Magazine]]', 'Play'}, {'[[Polygon (website)|Polygon]]', 'Poly'}, {'[[PlayStation: The Official Magazine|PlayStation Magazine]]', 'PSM'}, {'[[PSM3|PlayStation 3 Magazine]]', 'PSM3'}, {'[[RPGamer]]', 'RPG'}, {'[[Sinclair User]]', 'SUser'}, {'[[TeamXbox]]', 'TX'}, {'[[VideoGamer.com]]', 'VG'}, {'[[X-Play]]', 'XPlay'}, {{'[[Your Sinclair]]', 'YSinclair'}}
 
local aggregator = {{'[[GameRankings]]','GR'}}, {'Game Ratio','GRO'}, {'[[IGN|GameStats]]','GMS'}, {'GameTab','GTab'}, {{'[[Metacritic]]','MC'}}
 
-- 2 arrays with the title and code of each predefined "system type" field to be used.
local system = {{'[[Atari 2600]]','A2600'}}, {'[[ColecoVision]]','CV'}, {'[[Nintendo DS|DS]]','DS'}, {'[[Game Boy]]','GB'}, {'[[Game Boy Advance|GBA]]','GBA'}, {'[[Game Boy Color|GBC]]','GBC'}, {'[[List of video game consoles|General]]', 'GEN'}, {'[[iOS]]','iOS'}, {'[[N-Gage (device)|N-Gage]]','N-G'}, {'[[Nintendo 64|N64]]','N64'}, {'[[Nintendo Entertainment System|NES]]','NES'}, {'[[GameCube|GC]]','NGC'}, {'[[Nvidia Shield|Shield]]','NSHI'}, {'[[Personal Computer|PC]]','PC'}, {'[[PlayStation|PS]]','PS'}, {'[[PlayStation 2|PS2]]','PS2'}, {'[[PlayStation 3|PS3]]','PS3'}, {'[[PlayStation 4|PS4]]','PS4'}, {'[[PlayStation Portable|PSP]]','PSP'}, {'[[Dreamcast]]','SDC'}, {'[[Sega Game Gear|SGG]]','SGG'}, {'[[Super Nintendo Entertainment System|SNES]]','SNES'}, {'[[Sega Genesis|Mega Drive]]','SMD'}, {'[[Master System]]','SMS'}, {'[[Sega Saturn|Saturn]]','SSAT'}, {'[[TurboGrafx-16]]','TG16'}, {'[[PlayStation Vita]]','VITA'}, {'[[Xbox]]','XboxXBOX'}, {'[[Xbox 360]]','X360'}, {'[[Xbox One]]','XONE'}, {{'[[Wii]]','WII'}}
 
-- Require necessary modules.
local HtmlBuilder = require('Module:HtmlBuilder')
local categoryHandler = require('Module:Category handler').main
 
-- Set aliases for often-used functions to reduce table lookups.
local args
local frame
Line 141 ⟶ 144:
local titleCell = tbl.tag('tr').tag('th').css('font-size', '120%')
 
if args.state == 'plain' then
if args['award1'] or ((#halfkeysagg > 0 or #halfkeysrev > 0 or custome_agg > 0 or custome_rev > 0) and platforms >= 0) then
if args.state == 'plain' thentitleCell
titleCell.tag('span')
.tagcss('spanpadding-left', '5.7em')
.csswikitext('padding-left', '5.7em ')
end
.wikitext(' ')
end
 
if args.title then
titleCell
.addClasswikitext(args.title)
.wikitextdone(args.title)
else
.done()
elsetitleCell
titleCell.addClass('Reception')
.addClasswikitext('Reception')
.wikitextdone('Reception')
end
.done()
end
 
if args.subtitle then
tbl
.tag('tr')
.tag('th')
.css('font-size', '120%')
.addClasswikitext(args.subtitle)
.wikitextdone(args.subtitle)
.done()
end
else
local titleCell = tbl.tag('tr').tag('th').css('font-size', '120%').wikitext('Empty Template')
end
end
Line 491 ⟶ 488:
 
--
-- Inserts ana award into the table output.
--
function award(tbl, awardnum)
Line 548 ⟶ 545:
function renderMainTable()
local tbl
 
if platforms == 0 then
if args['award1'] or ((#halfkeysagg > 0 or #halfkeysrev > 0 or custome_agg > 0 or custome_rev > 0) and platforms >= 0) then
-- Width: 20% Seems better since it scales with the article size.
tblif platforms == 0 HtmlBuilder.create('table')then
-- Width: 20% Seems better since it scales with the article size.
.attr('cellpadding', 0)
tbl = HtmlBuilder.attrcreate('cellspacingtable', 0)
.cssattr('backgroundcellpadding', 'transparent'0)
.cssattr('paddingcellspacing', '0em'0)
.css('margin-topbackground', '0emtransparent')
.css('marginpadding', '1em0em')
.css('text-alignmargin', 'center0em 1em 1em 1em')
.css('fonttext-sizealign', '80%center')
if args .widthcss('font-size', then'80%')
.addClass(if args.state)width then
tbl
.css('width',args.width)
.tag('td')else
tbl
.css('marginwidth', '1em23em')
end
else
tbl = HtmlBuilder.create('table')
.attr('cellpadding', 0)
.attr('cellspacing', 0)
.css('background', 'transparent')
.css('padding', '0em')
.css('margin-top', '0em 1em 1em 1em')
.css('text-align', 'center')
.css('font-size', '80%')
end
if args.state then
tbl
.cssaddClass('width',args.widthstate)
else
tbl
.cssaddClass('width', '23emcollapsible')
end
else
tbl = HtmlBuilder.create('table')
.attr('cellpadding', 0)
.attr('cellspacing', 0)
.css('background', 'transparent')
.css('padding', '0em')
.css('margin-top', '0em')
.css('margin', '1em')
.css('text-align', 'center')
.css('font-size', '80%')
end
if args.state then
tbl
.addClass(args.state)
else
tbl
.addClass('collapsible')
end
 
if args.title and (args.state ~= 'plain' and args.state ~= 'off') then
tbl
.addClass('collapsible')
.addClass(args.state)
end
 
tbl.css('float', args.align or 'right').css('clear', args.align or 'right')
 
renderTitleRow(tbl)
 
tbl
.addClasstag('collapsibletr')
.addClass(args.state or .tag('autocollapsetd')
.node(reviews())
end
.done()
 
if args.align and args.align ~= 'right' then
tbl
.csstag('floattr', args.align)
.wikitexttag(' td')
.donenode(awards())
.done()
else
tblcategory = categoryHandler{
.css('float',main = 'right[[Category:Empty templates on articles]]')
tbl}
category = category or '' -- Check that we don't have a nil value for the category variable.
tbl = HtmlBuilder.create()
tbl.wikitext(category)
end
 
renderTitleRow(tbl)
 
tbl
.tag('tr')
.tag('td')
.node(reviews())
.done()
tbl
.tag('tr')
.tag('td')
.node(awards())
.done()
return tbl
end
Line 707 ⟶ 706:
 
--
-- Main: frame function.
--
function p.reviewbox(frame)
Line 720 ⟶ 719:
end
end
 
return p._reviewbox(args)
end