Modul:Vorlage:Wertungsspiegel Computerspiel

aus Wikipedia, der freien Enzyklopädie
Wechseln zu: Navigation, Suche
--
-- Ablauf
-- 1 Sammle Argumente
-- 2 Extrahiere alle die Wertung betreffenden Argumente
-- 3 Sortiere Ayrgumente erst nach Herausgebendem Magazin, dann nach Plattform
-- 4 Gib die Zahlenwerte der Argumente überall dort aus, wo Herausgeber + System korellieren
--
 
--
-- Dieses Modul wird in die Vorlage:Wertungsspiegel Computerspiel integriert
--s
local p = {}
 
local reviewer = {{'[[1UP]]', '1UP'}, {'[[4Players]]', '4Players'}, {'[[64’er]]', '64er'}, {'[[360 Live]]', '360Live'}, {'[[ActionTrip]]', 'ActionTrip'}, {'[[Adventure Classic Gaming]]', 'ACG'}, {'[[Adventure Corner]]', 'AdventureCorner'}, {'[[Adventure Gamers]]', 'AdventureGamers'}, {'[[Adventure-Treff]]', 'AdventureTreff'}, {'[[Allgame]]', 'Allgame'}, {'[[Aktueller Software Markt|ASM]]', 'ASM'}, {'[[Amstrad Action]]', 'AmstradAction'}, {'[[Amiga Games]]', 'AmigaGames'}, {'[[Amiga Joker]]', 'AmigaJoker'},  {'[[Amtix!]]', 'Amtix'}, {'[[Bravo Screenfun]]', 'BravoScreenfun'}, {'[[Buffed]]', 'Buffed'}, {'[[Chip Power Play]]', 'ChipPowerPlay'}, {'[[Computer and Video Games]]', 'CVG'}, {'[[Computer Bild Spiele]]', 'CBS'}, {'[[Computer Gaming World|CGW]]', 'CGW'}, {'[[Crash (Magazin)|Crash]]', 'Crash'}, {'[[Club Nintendo]]', 'ClubNintendo'}, {'[[Destructoid]]', 'Destructoid'}, {'[[Dragon (Magazin)|Dragon]]', 'Dragon'}, {'[[Edge (Zeitschrift)|Edge]]', 'Edge'}, {'[[Electronic Gaming Monthly]]', 'EGM'}, {'[[Eurogamer]]', 'Eurogamer'}, {'[[Eurogamer|Eurogamer (UK)]]', 'EurogamerUK'},  {'[[Famitsu]]', 'Famitsu'}, {'[[G4 (Fernsehsender)|G4]]', 'G4'}, {'GameCritics', 'GameCritics'}, {'[[GameFan]]', 'GameFan'}, {'[[Game Informer]]', 'GameInformer'}, {'[[GamePro]]', 'GamePro'}, {'[[GamePro|GamePro (US)]]', 'GameProUS'}, {'[[Game Revolution]]', 'GameRevolution'},  {'[[Gamer.de]]', 'Gamer.de'}, {'[[Gamers (Zeitschrift)|Gamers]]', 'Gamers'}, {'[[Games Aktuell]]', 'GamesAktuell'}, {'[[Games for Windows]]', 'GFW'}, {'[[GamesMaster]]', 'GamesMaster'}, {'[[GamesRadar]]', 'GamesRadar'},  {'[[GameSpot]]', 'GSpot'}, {'[[GameSpot]]', 'GameSpot'}, {'[[GameSpy]]', 'GSpy'}, {'[[GameSpy]]', 'GameSpy'}, {'[[GameStar]]', 'GameStar'}, {'[[GamesTM]]', 'GamesTM'}, {'[[Gameswelt]]', 'Gameswelt'}, {'[[GameTrailers]]', 'GameTrailers'}, {'GameWire', 'GameWire'}, {'[[GameZone]]', 'GameZone'},  {'[[GameZone|GameZone (US)]]', 'GameZoneUS'}, {'[[GamingXP]]', 'GamingXP'}, {'[[Gamona]]', 'Gamona'}, {'[[GBase]]', 'GBase'}, {'[[Giant Bomb]]', 'GiantBomb'}, {'[[Hyper (Zeitschrift)|Hyper Magazine]]', 'Hyper'}, {'[[IGN Entertainment|IGN]]', 'IGN'},  {'[[Insidegames]]', 'Insidegames'}, {'[[JeuxVideo]]', 'JeuxVideo'}, {'[[Joystiq]]', 'Joystiq'}, {'[[Looki]]', 'Looki'}, {'[[M! Games]]', 'MGames'}, {'[[Macwelt]]', 'Macwelt'}, {'[[Macworld (Zeitschrift)|Macworld]]', 'Macworld'}, {'[[Man!ac]]', 'Maniac'}, {'[[Maximum PC]]', 'MaximumPC'}, {'[[Megablast]]', 'Megablast'}, {'[[Mega Fun]]', 'MegaFun'}, {'[[NGC Magazine]]', 'NGCMagazine'}, {'[[NGamer]]', 'NGamer'}, {'[[Nintendo Life]]', 'NintendoLife'}, {'[[Nintendo Power]]', 'NintendoPower'}, {'Nintendo World Report', 'NWR'}, {'[[Official Nintendo Magazine]]', 'ONM'}, {'[[N-Zone]]', 'NZone'}, {'[[Official U.S. PlayStation Magazine|Official PlayStation Magazine (US)]]', 'OPM'}, {'[[Official PlayStation Magazine|Official PlayStation Magazine (UK)]]', 'OPMUK'}, {'[[Official PlayStation Magazine|Official PlayStation Magazine (Australien)]]', 'OPMAU'}, {'[[Official Xbox Magazine|Official Xbox Magazine (US)]]', 'OXMUS'}, {'[[Official Xbox Magazine|Official Xbox Magazine UK]]', 'OXMUK'}, {'[[Onlinewelten]]', 'Onlinewelten'}, {'[[PALGN]]', 'PALGN'}, {'[[PC Action]]', 'PCAction'}, {'[[PC Format]]', 'PCFormat'}, {'[[PC Gamer|PC Gamer UK]]', 'PCGamerGUK'}, {'[[PC Gamer|PC Gamer US]]', 'PCGamerGUS'}, {'[[PC Games]]', 'PCGames'}, {'[[PC Joker]]', 'PCJoker'}, {'[[PC Player]]', 'PCPlayer'}, {'[[PC PowerPlay]]', 'PCPowerPlay'}, {'[[PC Zone]]', 'PCZone'}, {'[[Play3]]', 'Play3'}, {'[[Play Time]]', 'PlayTime'}, {'[[Play (UK Magazin)|Play Magazine]]', 'Play'}, {'[[Polygon (Website)|Polygon]]', 'Polygon'}, {'[[Play The PlayStation]]', 'PTP'}, {'[[PlayStation: The Official Magazine|PlayStation Magazine]]', 'PSM'}, {'[[PlayZone]]', 'PlayZone'}, {'[[Offizielles PlayStation 2 Magazin|OPM2]]', 'OPM2'}, {'[[Power Play (Zeitschrift)|Power Play]]', 'PowerPlay'}, {'[[PSM3|PlayStation 3 Magazine]]', 'PSM3'}, {'[[RPGamer]]', 'RPGamer'}, {'[[Sega Magazin]]', 'SegaMagazin'}, {'[[Sinclair User]]', 'SUser'}, {'[[Svenska PC Gamer]]', 'SPC'}, {'[[TeamXbox]]', 'TeamXbox'}, {'[[Total (Zeitschrift)|Total]]', 'TOTAL'},  {'[[Video Games Zone]]', 'VGZ'}, {'[[VideoGamer.com]]', 'VideoGamer'}, {'[[Video Games]]', 'VideoGames'}, {'[[Wii Magazin]]', 'WIIMagazin'}, {'[[X-Play]]', 'XPlay'}, {'[[Your Sinclair]]', 'YourSinclair'}, {'[[Your Sinclair]]', 'YS'}, {'[[Zzap!64]]', 'Zzap64'}}
 
local aggregator = {{'[[GameRankings]]','GR'}, {'[[GameRankings]]','GameRankings'}, {'Game Ratio','GameRatio'}, {'[[IGN Entertainment|GameStats]]','GameStats'}, {'GameTab','GameTab'}, {'[[Metacritic]]','MC'}, {'[[Metacritic]]','Metacritic'}}
 
-- Zwei Arrays mit Titel und Code des zu verwendenden System-Felds
local system = {{'[[3DO]]','3DO'}, {'[[Amiga]]','AMIGA'}, {'[[Android (Betriebssystem)|Android]]','AND'}, {'[[Apple II]]', 'APPLEII'}, {'[[Atari 2600]]','A2600'}, {'[[Atari ST]]','AST'}, {'[[ColecoVision]]','CV'}, {'[[Commodore 64]]','C64'},  {'[[Nintendo 3DS|3DS]]','3DS'}, {'[[Nintendo DS|DS]]','DS'}, {'[[Disk Operating System|DOS]]','DOS'}, {'[[Game Boy]]','GB'}, {'[[Game Boy Advance|GBA]]','GBA'}, {'[[Game Boy Color|GBC]]','GBC'}, {'[[Liste von Videospielkonsolen|General]]', 'GEN'}, {'[[Apple iOS]]','IOS'}, {'[[Mac OS]]','MAC'}, {'[[Nokia N-Gage|N-Gage]]','NG'}, {'[[Nintendo 64|N64]]','N64'}, {'[[Nintendo Entertainment System|NES]]','NES'}, {'[[GameCube|GC]]','NGC'}, {'[[Nvidia Shield|Shield]]','NSHI'}, {'[[Ouya]]','OUYA'}, {'[[PC Engine]]','PCE'}, {'[[PlayStation|PS]]','PS'}, {'[[PlayStation 2|PS2]]','PS2'}, {'[[PlayStation 3|PS3]]','PS3'}, {'[[PlayStation 4|PS4]]','PS4'}, {'[[PlayStation Portable|PSP]]','PSP'}, {'[[Dreamcast]]','SDC'}, {'[[Sega Game Gear|Game Gear]]','SGG'}, {'[[Sega Mega Drive|Mega Drive]]','SMD'}, {'[[Super Nintendo Entertainment System|SNES]]','SNES'}, {'[[Sega Master System|Master System]]','SMS'}, {'[[Sega Saturn|Saturn]]','SSAT'}, {'[[PlayStation Vita|PS Vita]]','PSVITA'}, {'[[Microsoft Windows|Windows]]','WIN'}, {'[[Microsoft Windows Phone|Windows Phone]]','WINPH'}, {'[[Xbox]]','XBOX'}, {'[[Xbox 360]]','X360'}, {'[[Xbox One]]','XONE'}, {'[[Wii]]','WII'}, {'[[Wii U]]', 'WIIU'}, {'[[Sinclair ZX Spectrum]]', 'ZXSPEC'}}
 
-- Aufruf benötigter Module
local HtmlBuilder = require('Modul:HtmlBuilder')
--local categoryHandler = require('Modul:Category handler').main --deaktiviert da nicht vorhanden bzw nicht benötigt
 
-- Setze Bezeichnungen für häufig verwendete Elemente fest.
local args
local frame
local keys
local halfkeysrev
local halfkeysagg
local platforms
local custome_agg
local custome_rev
local awardnums = {}
 
--
-- Teilt einen String in n Elemente auf.
--
function Split(str, delim, maxNb)
    if string.find(str, delim) == nil then
        return { str }
    end
    if maxNb == nil or maxNb < 1 then
        maxNb = 0 -- No limit
    end
    local result = {}
    local pat = "(.-)" .. delim .. "()"
    local nb = 0
    local lastPos
    for part, pos in string.gfind(str, pat) do
        nb = nb + 1
        result[nb] = part
        lastPos = pos
        if nb == maxNb then break end
    end
    if nb ~= maxNb then
        result[nb + 1] = string.sub(str, lastPos)
    end
    return result
end
 
--
-- Sortiert Schlüssel nach String
--
function pairsByKeys (t, f)
    local a = {}
    for n in pairs(t) do
        if type(n) == 'string' then
            table.insert(a, n)
        end
    end
    table.sort(a, f)
    local i = 0 -- Laufzeitvariable
    local iter = function () -- Laufzeitfunktion
        i = i + 1
        if a[i] == nil then
            return nil
        else
            return a[i]
        end
    end
    return iter
end
 
--
-- Gibt alle Schlüssel in einem Array aus
--
function array_keys(input)
    local key
    local keys = {}
 
    for key in pairs(input) do
        table.insert(keys, key)
    end
 
    return keys
end
 
--
-- Gibt die Anzahl aktiver Plattformen aus
--
function platforms()
    local count = 0
    for i = 1, #system do
        if args[tostring(system[i][2])] ~= nil then
            if string.lower(tostring(args[tostring(system[i][2])])) == 'true' then
                count=count+1
            end
        end
    end
    return count
end
 
--
-- Gibt die Anzahl der verwendeten Meta-Seiten aus
--
function custome_agg()
    local cagg = 0
    for i = 1, 10 do
        if args['agg' .. tostring(i)] ~= nil then
            cagg = cagg + 1
        end
    end
    return cagg
end
 
--
-- Gibt die Anzahl der verwendeten Bewertungs-Seiten aus
--
function custome_rev()
    local crev = 0
    for i = 1, 10 do
        if args['rev' .. tostring(i)] ~= nil then
            crev = crev + 1
        end
    end
    return crev
end
--
-- Titelleiste
--
function renderTitleRow(tbl)
    local titleCell = tbl.tag('tr').tag('th').css('font-size', '120%')
 
    if args.state == 'plain' then
        titleCell
            .tag('span')
            .css('padding-left', '5.7em')
            .wikitext('&nbsp;')
    end
 
    if args.titel then
        titleCell
            .wikitext(args.titel)
            .done()
    else
        titleCell
            .addClass('Reception')
            .wikitext('')
            .done()
    end
 
    if args.untertitel then
        tbl
            .tag('tr')
                .tag('th')
                    .css('font-size', '120%')
                    .wikitext(args.untertitel)
                    .done()
    end
end
 
--
-- Füge Bewertungen ein
--
function reviews()
    local arg_system
    local tbl2
    if (#halfkeysrev > 0 or #halfkeysagg > 0) and platforms >= 1 then
	     tbl2 = HtmlBuilder.create('table')
            .addClass('infobox wikitable')
            .attr('cellpadding', 0)
            .attr('cellspacing', 0)
            .css('width', '100%')
            .css('border-bottom', 'none')
            .css('margin', '0em')
            .done()
    elseif (#halfkeysrev > 0 or #halfkeysagg > 0 or custome_agg > 0 or custome_rev > 0) and  platforms == 0 then
        tbl2 = HtmlBuilder.create('table')
            .addClass('infobox wikitable')
            .attr('cellpadding', 0)
            .attr('cellspacing', 0)
            .css('width', '100%')
            .css('font-size', '100%')
            .css('border-bottom', 'none')
            .css('margin', '0em')
            .done()
    end
    if #halfkeysrev > 0 and (platforms > 1 or string.lower(tostring(args['showplatforms'])) == 'true') then
        tbl2.tag('tr').tag('th')
            .attr('colspan', #system + 1)
            .css('background', '#C6C6C6')
            .css('font-size', '120%')
            .wikitext('Bewertungen')
            .done()
 
        tbl2
            .tag('tr')
                .tag('th')
                    .attr('rowspan', '2')
                    .css('background', '#E0E0E0')
                    .css('text-align', 'center')
                    .css('vertical-align', 'middle')
                    .wikitext('Publikation')
                    .done()
                .tag('th')
                    .attr('colspan', #system)
                    .css('background', '#E0E0E0')
                    .css('vertical-align', 'middle')
                    .wikitext('Wertung')
                    .done()
        local forloop = tbl2.tag('tr')
        for j = 1, #system do
            if string.lower(tostring(args[tostring(system[j][2])])) == 'true' then
                forloop.tag('th').wikitext(tostring(system[j][1]))
            end
        end
    elseif #halfkeysrev > 0 and platforms == 1 and string.lower(tostring(args['showplatforms'])) ~= 'true' then
        tbl2.tag('tr').tag('th')
            .attr('colspan', '2')
            .css('background', '#C6C6C6')
            .css('font-size', '120%')
            .wikitext('Bewertungen')
            .done()
 
	    tbl2
            .tag('tr')
                .tag('th')
                    .css('background', '#E0E0E0')
                    .css('text-align', 'center')
                    .css('vertical-align', 'middle')
                    .wikitext('Publikation')
                    .done()
                .tag('th')
                    .css('background', '#E0E0E0')
                    .css('vertical-align', 'middle')
                    .wikitext('Wertung')
                    .done()
    end
    if platforms >= 1 then
        for i = 1, #reviewer do
            for k = 1, #halfkeysrev do
                if reviewer[i][2] == halfkeysrev[k] then
                    local forloop = tbl2.tag('tr')
                    forloop.tag('td')
                        .css('vertical-align','middle')
                        .wikitext(reviewer[i][1])
                        .done()
 
                    for j = 1, #system do
                        local temp = tostring(reviewer[i][2]) .. '_' .. tostring(system[j][2])
                        if string.lower(tostring(args[tostring(system[j][2])])) == 'true' and args[temp] ~= nil then
                            forloop.tag('td')
                                .css('vertical-align', 'middle')
                                .wikitext(tostring(args[temp]))
                        elseif string.lower(tostring(args[tostring(system[j][2])])) == 'true' and string.lower(tostring(args['na'])) == 'true' then
                            forloop.tag('td')
                                .css('color', 'lightgray')
                                .css('vertical-align','middle')
                                .css('text-align', 'center')
                                .addClass('table-na')
                                .wikitext('k.A.')
                                .done()
                        elseif string.lower(tostring(args[tostring(system[j][2])])) == 'true' then
                            forloop.tag('td').done()
                        end
                    end
                end
            end
        end
        for i = 1, 10 do
            if args['rev' .. tostring(i)] ~= nil then
                local forloop = tbl2.tag('tr')
                forloop.tag('td').wikitext(tostring(args['rev' .. tostring(i)]))
                for j = 1, #system do
				    local temp = 'rev'.. tostring(i) .. '_' .. tostring(system[j][2])
                    if string.lower(tostring(args[tostring(system[j][2])])) == 'true' and args[temp] ~= nil then
	                    forloop.tag('td')
                            .css('vertical-align','middle')
                            .wikitext(tostring(args[temp]))
                            .done()
                    elseif string.lower(tostring(args[tostring(system[j][2])])) == 'true' and string.lower(tostring(args['na'])) == 'true' then
                        forloop.tag('td')
                            .css('color', 'lightgray')
                            .css('vertical-align','middle')
                            .css('text-align', 'center')
                            .addClass('table-na')
                            .wikitext('k.A.')
                            .done()
                    elseif string.lower(tostring(args[tostring(system[j][2])])) == 'true' then
                        forloop.tag('td').done()
                    end
                end
            end
        end
        if (#halfkeysagg > 0 and platforms > 1) and #halfkeysrev == 0 then
            tbl2
                .tag('tr')
                    .tag('th')
                        .attr('colspan', #system+1)
                        .css('background', '#C6C6C6')
                        .css('font-size', '120%')
                        .wikitext('Metawertungen')
                        .done()
            tbl2
                .tag('tr')
                    .tag('th')
                        .attr('rowspan', '2')
                        .css('background', '#E0E0E0')
                        .css('text-align', 'center')
                        .css('vertical-align', 'middle')
                        .wikitext('Publikation')
                        .done()
                    .tag('th')
                        .attr('colspan', #system+1)
                        .css('background', '#E0E0E0')
                        .css('vertical-align', 'middle')
                        .wikitext('Wertung')
                        .done()
            local forloop = tbl2.tag('tr')
            for j = 1, #system do
                if string.lower(tostring(args[tostring(system[j][2])])) == 'true' then
                    forloop.tag('th').wikitext(tostring(system[j][1]))
                end
            end
        elseif (#halfkeysagg > 0 and #halfkeysrev > 0) or (#halfkeysagg > 0 and platforms == 1)then
            tbl2
                .tag('tr')
                    .tag('th')
                        .attr('colspan', #system+1)
                        .css('background', '#C6C6C6')
                        .css('font-size', '120%')
                        .wikitext('Metawertungen')
                        .done()
        end
        for i = 1, #aggregator do
            for k = 1, #halfkeysagg do
                if aggregator[i][2] == halfkeysagg[k] then
                    local forloop = tbl2.tag('tr')
                    forloop.tag('td')
                        .css('vertical-align','middle')
                        .wikitext(aggregator[i][1])
                        .done()
 
                    for j = 1, #system do
                        local temp = tostring(aggregator[i][2]) .. '_' .. tostring(system[j][2])
                        if string.lower(tostring(args[tostring(system[j][2])])) == 'true' and args[temp] ~= nil then
                            forloop.tag('td').wikitext(tostring(args[temp]))
                        elseif string.lower(tostring(args[tostring(system[j][2])])) == 'true' and string.lower(tostring(args['na'])) == 'true' then
                            forloop.tag('td')
                                .css('color', 'lightgray')
                                .css('vertical-align','middle')
                                .css('text-align', 'center')
                                .addClass('table-na')
                                .wikitext('k.A.')
                                .done()
                        elseif string.lower(tostring(args[tostring(system[j][2])])) == 'true' then
                            forloop.tag('td').done()
                        end
                    end
                end
            end
        end
	elseif platforms == 0 then
        if #halfkeysagg > 0 or custome_agg > 0 then
            tbl2
                .tag('tr')
                    .tag('th')
                        .attr('colspan', 2)
                        .css('background', '#C6C6C6')
                        .css('font-size', '120%')
                        .wikitext('Metawertungen')
                        .done()
                .tag('tr')
                    .tag('th')
                        .css('background', '#E0E0E0')
                        .css('text-align', 'center')
                        .wikitext('Datenbank')
                        .done()
                    .tag('th')
                        .css('background', '#E0E0E0')
                        .wikitext('Wertung')
                        .done()
        end
        for i = 1, #aggregator do
            for k = 1, #halfkeysagg do
                if aggregator[i][2] == halfkeysagg[k] then
                    tbl2
                        .tag('tr')
                            .tag('td')
                                .css('text-align', 'center')
                                .css('vertical-align', 'middle')
                                .wikitext(aggregator[i][1])
                                .done()
                            .tag('td')
                                .css('text-align', 'center')
                                .css('font-size', '110%')
                                .wikitext(tostring(args[tostring(aggregator[i][2])]))
                                .done()
                end
            end
        end
        for i = 1, 10 do
            if args['agg' .. tostring(i)] ~= nil then
                tbl2
                    .tag('tr')
                        .tag('td')
                            .css('text-align', 'center')
                            .css('vertical-align', 'middle')
                            .wikitext(tostring(args['agg' .. tostring(i)]))
                            .done()
                        .tag('td')
                            .css('text-align', 'center')
                            .css('font-size', '110%')
                            .wikitext(tostring(args['agg'.. tostring(i) .. 'Score']))
                            .done()
            end
        end
        if #halfkeysrev > 0 or custome_rev > 0 then
            tbl2.tag('tr').tag('th')
                .attr('colspan', #system + 1)
                .css('background', '#C6C6C6')
                .css('font-size', '120%')
                .wikitext('Bewertungen')
                .done()
            tbl2
                .tag('tr')
                    .tag('th')
                        .css('background', '#E0E0E0')
                        .css('text-align', 'center')
                        .wikitext('Publikation')
                        .done()
                    .tag('th')
                        .attr('colspan', '25')
                        .css('background', '#E0E0E0')
                        .wikitext('Wertung')
                        .done()
 
            for i = 1, #reviewer do
                for k = 1, #halfkeysrev do
                    if reviewer[i][2] == halfkeysrev[k] then
                        tbl2
                            .tag('tr')
                                .tag('td')
                                    .css('text-align', 'center')
                                    .css('vertical-align', 'middle')
                                    .wikitext(reviewer[i][1])
                                    .done()
                                .tag('td')
                                    .css('text-align', 'center')
                                    .css('font-size', '110%')
                                    .wikitext(tostring(args[tostring(reviewer[i][2])]))
                                    .done()
                    end
                end
            end
            for i = 1, 10 do
                if args['rev' .. tostring(i)] ~= nil then
                    tbl2
                        .tag('tr')
                            .tag('td')
                                .css('text-align', 'center')
                                .css('vertical-align', 'middle')
                                .wikitext(tostring(args['rev' .. tostring(i)]))
                                .done()
                            .tag('td')
                                .css('text-align', 'center')
                                .css('font-size', '110%')
                                .wikitext(tostring(args['rev'.. tostring(i) .. 'Score']))
                                .done()
                end
            end
        end
	end
    return tbl2
end
 
--
-- Funktion um Auszeichnungen in die Tabelle zu integrieren -- Inserts a award into the table output.
--
function award(tbl, awardnum)
    local temp = tbl.tag('tr')
        .tag('td')
            .css('font-weight','bold')
            .css('background-color','#f2f2f2')
            .wikitext(args['award' .. awardnum .. 'Pub'])
            .done()
        .tag('td')
            .css('background-color','#f2f2f2')
            .wikitext(args['award' .. awardnum])
            .done()
    return temp
end
 
--
-- Erstellt die Kopfzeile für Auszeichnungen und ruft die Anzahl der benötigten Reihen ab -- Insert awards header and calls award row creation.
--
function awards()
    if args['award1'] then
        local Cell = HtmlBuilder.create('table')
            .addClass('infobox wikitable')
            .css('width', '100%')
            .css('margin', '0em')
            .css('border-top', 'none')
            .attr('cellpadding', 3)
            .attr('cellspacing', 0)
        Cell
            .tag('tr')
                .tag('th')
                    .attr('colspan', 2)
                    .css('background', '#C6C6C6')
                    .css('font-size', '120%')
                    .css('border-top', 'none')
                    .wikitext('Auszeichnungen')
                    .done()
        Cell
            .tag('tr')
                .tag('th').wikitext('Publikation')
                .tag('th').wikitext('Auszeichnung')
 
        for i, awardnum in ipairs(awardnums) do
            local awardRow = award(Cell, awardnum)
            awardRow
                .done()
        end
        return Cell
    end
end
 
--
-- Haupttabelle
--
 
function renderMainTable()
    local tbl
 
    if args['award1'] or ((#halfkeysagg > 0 or #halfkeysrev > 0 or custome_agg > 0 or custome_rev > 0) and platforms >= 0) then
        if platforms == 0 then
            -- Width: 20% Seems better since it scales with the article size.
            tbl = HtmlBuilder.create('table')
                .attr('cellpadding', 0)
                .attr('cellspacing', 0)
                .css('background', 'transparent')
                .css('padding', '0em')
                .css('margin', '0em 1em 1em 1em')
                .css('text-align', 'center')
                .css('font-size', '90%')
            if args.width then
                tbl
                    .css('width',args.width)
            else
                tbl
                    .css('width', '23em')
            end
        else
            tbl = HtmlBuilder.create('table')
                .attr('cellpadding', 0)
                .attr('cellspacing', 0)
                .css('background', 'transparent')
                .css('padding', '0em')
                .css('margin', '0em 1em 1em 1em')
                .css('text-align', 'center')
                .css('font-size', '90%')
        end
        if args.state then
            tbl
                .addClass(args.state)
        end
 
        if args.title and (args.state ~= 'plain' and args.state ~= 'off') then
            tbl
                .addClass(args.state)
        end
 
        if args.align and args.align ~= 'right' then
            tbl
                .css('float', args.align)
        else
            tbl
                .css('float', 'right')
        end
 
        renderTitleRow(tbl)
 
        tbl
            .tag('tr')
                .tag('td')
                    .node(reviews())
                    .done()
 
        tbl
            .tag('tr')
                .tag('td')
                    .node(awards())
                    .done()
    else
--  Modul ist nicht vorhanden, daher deaktiviert
--       category = categoryHandler{
--          main = '[[Category:Empty templates on articles]]'      }
--       category = category or '' -- Check that we don't have a nil value for the category variable.
--       tbl = HtmlBuilder.create()
--		tbl.wikitext(category)
    end
    return tbl
end
 
--
-- Erzeugt die Tabelle und ruft Funktionen zur Ausgabe der Bewertungen auf
--
function p._reviewbox(reviewBoxArgs)
    local t = {}
    local flags = {}
    local nitem = {}
    local halfargs = {}
    local j = 1
    -- Ruft die Argumente ab
    args = reviewBoxArgs
    platforms = platforms()
    custome_rev = custome_rev()
    custome_agg = custome_agg()
 
    -- Sortiert Argumente nach String
    for k in pairsByKeys(args) do
        table.insert(t, k)
    end
    keys = t
 
    -- Erzeugt eine Tabelle mit allen Bewertungen
    for i=1,#keys do
        if string.find(tostring(keys[i]), '_') ~= nil and platforms >= 1 then
            halfargs = Split(tostring(keys[i]),'_')
            for k=1, #reviewer do
                if reviewer[k][2] == halfargs[1] then
                    if not flags[halfargs[1]] then
                        flags[halfargs[1]] = true
                        nitem[j] = halfargs[1]
                        j = j + 1
                    end
                end
            end
        elseif string.find(tostring(keys[i]), '_') == nil and platforms == 0 then
            for k=1, #reviewer do
                if reviewer[k][2] == keys[i] then
                    nitem[j] = keys[i]
                    j = j + 1
                end
            end
        end
    end
    halfkeysrev = nitem
 
    local flags = {}
    local nitem = {}
    local halfargs = {}
    local j = 1
    -- Erzeugt einer Tabelle mit den Meta-Seiten
    for i=1,#keys do
        if string.find(tostring(keys[i]), '_') ~= nil and platforms >= 1 then
            halfargs = Split(tostring(keys[i]),'_')
            for k=1, #aggregator do
                if aggregator[k][2] == halfargs[1] then
                    if not flags[halfargs[1]] then
                        flags[halfargs[1]] = true
                        nitem[j] = halfargs[1]
                        j = j + 1
                    end
                end
            end
        elseif string.find(tostring(keys[i]), '_') == nil and platforms == 0 then
            for k=1, #aggregator do
                if aggregator[k][2] == keys[i] then
                    nitem[j] = keys[i]
                    j = j + 1
                end
            end
        end
    end
    halfkeysagg = nitem
    for k, v in pairs(args) do
        local awardnum = ('' .. k):match('^award(%d+)$')
        if awardnum then table.insert(awardnums, tonumber(awardnum)) end
    end
    if awardnums then table.sort(awardnums) end
    local tbl = renderMainTable()
    local res = HtmlBuilder.create()
 
    res.node(tbl)
 
    return tostring(res)
end
 
--
-- Rahmen-Funktion
--
function p.reviewbox(frame)
    -- Der Parser nimmt den leeren String als falsch an, um mit {{Wertungsspiegel Computerspiel}} arbeiten zu können,
    -- alle leeren Argumente werden zu nil geändert, damit Lua die als falsch annimmt
    local args = {}
    local parent_args = frame:getParent().args;
    for k, v in pairs(parent_args) do
        if v ~= '' then
            args[k] = v
        end
    end
 
    return p._reviewbox(args)
end
 
return p