Deprecated: ScribuntoContent overrides fillParserOutput which was deprecated in MediaWiki 1.38. [Called from MediaWiki\Content\Renderer\ContentRenderer::getParserOutput in /var/www/html/includes/content/Renderer/ContentRenderer.php at line 47] in /var/www/html/includes/debug/MWDebug.php on line 381

Deprecated: Use of AbstractContent::getParserOutput was deprecated in MediaWiki 1.38. [Called from ContentHandler::callDeprecatedContentGPO in /var/www/html/includes/content/ContentHandler.php at line 1883] in /var/www/html/includes/debug/MWDebug.php on line 381
Module:Achievements: Difference between revisions - ΔV: Wiki

Module:Achievements: Difference between revisions

From ΔV: Wiki
(quick attempt to fix an issue with the header not showing up)
(reorganized the icon to be before the name)
 
(One intermediate revision by the same user not shown)
Line 6: Line 6:
p.view = {}
p.view = {}


p.view['Icon'] = dv.text{'icon'}
p.view['Name'] = dv.title{'key', text='name'}
p.view['Name'] = dv.title{'key', text='name'}
p.view['Description'] = dv.text{'description'}
p.view['Description'] = dv.text{'description'}
p.view['Requirements (if different)'] = dv.text{'altDescription'}
p.view['Requirements (if different)'] = dv.text{'altDescription'}
p.view['Icon'] = dv.text{'icon'}
 
p.defaultColumns = {
    'Icon', 'Name', 'Description', 'Requirements (if different)'
}


p.positionalArgs = function(f)
p.positionalArgs = function(f)
Line 31: Line 35:
     data = d.sort(data, {
     data = d.sort(data, {
         d.on(d.path{'icon'}, d.asc),
         d.on(d.path{'icon'}, d.asc),
         d.on(d.path{'altDescription'}, d.asc),
         d.on(d.path{'name'}, d.asc),
         d.on(d.path{'description'}, d.asc),
         d.on(d.path{'description'}, d.asc),
         d.on(d.path{'name'}, d.asc)
         d.on(d.path{'altDescription'}, d.asc)
     })
     })



Latest revision as of 10:53, 10 November 2024

Documentation for this module may be created at Module:Achievements/doc

local p = {}
local d = require('Module:Data')
local dv = require('Module:Data/View')
local capiunto = require 'capiunto'

p.view = {}

p.view['Icon'] = dv.text{'icon'}
p.view['Name'] = dv.title{'key', text='name'}
p.view['Description'] = dv.text{'description'}
p.view['Requirements (if different)'] = dv.text{'altDescription'}

p.defaultColumns = {
     'Icon', 'Name', 'Description', 'Requirements (if different)'
}

p.positionalArgs = function(f)
    local posArgs = {}
    for i,posArg in ipairs(f.args) do
        -- positional arguments don't get trimmed
        table.insert(posArgs, mw.text.trim(posArg))
    end
    return posArgs
end

p.list = function(f)
    local columns = p.positionalArgs (f)
    if table.getn(columns) == 0 then
        columns = p.defaultColumns
    end


    local data = mw.loadData('Module:Achievements/Data')

    data = d.sort(data, {
        d.on(d.path{'icon'}, d.asc),
        d.on(d.path{'name'}, d.asc),
        d.on(d.path{'description'}, d.asc),
        d.on(d.path{'altDescription'}, d.asc)
    })

    return dv.displayTable(data, p.view, columns)
end

return p