Module:Miscellaneous/sandbox: Difference between revisions

From Path of Exile Wiki
Jump to navigation Jump to search
(Tweak)
(Add support for suppressing columns from table)
Line 18: Line 18:


local i18n = {
local i18n = {
    tooltips = {
tooltips = {
        item_class = 'Item class',
item_class = 'Item class',
        item_class_id = 'Internal ID',
item_class_id = 'Internal ID',
        item_class_category = 'Category',
item_class_category = 'Category',
    },
},
}
}


Line 30: Line 30:


function p.item_class_list(frame)
function p.item_class_list(frame)
    g_args = getArgs(frame, {
g_args = getArgs(frame, {
        parentFirst = true
parentFirst = true
    })
})
    g_frame = util.misc.get_frame(frame)
g_frame = util.misc.get_frame(frame)
   
    local skip = {['SmallRelic'] = true, ['MediumRelic'] = true, ['LargeRelic'] = true}
g_args.noid = g_args.noid or false
    local out = {}
g_args.nocategory = g_args.nocategory or false
   
    for id, data in pairs(m_game.constants.item.classes) do
local skip = {['SmallRelic'] = true, ['MediumRelic'] = true, ['LargeRelic'] = true}
        if skip[id] == nil then
local out = {}
        local datafull = "''none''"
        if (data['full'] ~= nil) and (data['full'] ~= '') then
        datafull = string.format('[[%s]]', data['full'])
for id, data in pairs(m_game.constants.item.classes) do
        end
if skip[id] == nil then
        local datacategory = "''none''"
local datafull = "''none''"
        if (data['category'] ~= nil) and (data['category'] ~= '') then
if (data['full'] ~= nil) and (data['full'] ~= '') then
        datacategory = data['category']
datafull = string.format('[[%s]]', data['full'])
        end
end
        local tr = mw.html.create('tr')
local datacategory = "''none''"
            tr
if (data['category'] ~= nil) and (data['category'] ~= '') then
                :tag('td')
datacategory = data['category']
                :wikitext(datafull)
end
                    :done()
local tdfull = mw.html.create('td')
                :tag('td')
        :wikitext(datafull)
                    :wikitext(id)
local tdid
                    :done()
if not g_args.noid then
                :tag('td')
tdid = mw.html.create('td')
                    :wikitext(datacategory)
:wikitext(id)
                    :done()
end
            out[data['id']] = tostring(tr)
local tdcategory
        else
if not g_args.nocategory then
            out[data['id']] = ''
tdcategory = mw.html.create('td')
        end
:wikitext(datacategory)
    end
end
   
local tr = mw.html.create('tr')
    local tbl = mw.html.create('table')
:node(tdfull)
    tbl
:node(tdid)
        :attr('class', 'wikitable sortable')
:node(tdcategory)
        :tag('tr')
out[data['id']] = tostring(tr)
            :tag('th')
else
                :wikitext(i18n.tooltips.item_class)
out[data['id']] = ''
                :done()
end
            :tag('th')
end
                :wikitext(i18n.tooltips.item_class_id)
                :done()
local thfull = mw.html.create('th')
            :tag('th')
:wikitext(i18n.tooltips.item_class)
                :wikitext(i18n.tooltips.item_class_category)
local thid
                :done()
if not g_args.noid then
            :done()
thid = mw.html.create('th')
        :wikitext(table.concat(out))
:wikitext(i18n.tooltips.item_class_id)
   
end
    return tostring(tbl)
local thcategory
if not g_args.nocategory then
thid = mw.html.create('th')
:wikitext(i18n.tooltips.item_class_category)
end
local tbl = mw.html.create('table')
:attr('class', 'wikitable sortable')
:tag('tr')
:node(thfull)
:node(thid)
:node(thcategory)
:done()
:wikitext(table.concat(out))
return tostring(tbl)
end
end


function p.item_class_category_list(frame)
function p.item_class_category_list(frame)
    --[[
--[[
        Displays a list of categories for all item classes.
Displays a list of categories for all item classes.
    ]]
]]


    local tpl_args = getArgs(frame, {parentFirst = true})
local tpl_args = getArgs(frame, {parentFirst = true})
    local frame = util.misc.get_frame(frame)
local frame = util.misc.get_frame(frame)
   
    tpl_args.format = tpl_args.format or 'default'
tpl_args.format = tpl_args.format or 'default'
   
    local fmt
local fmt
    if tpl_args.format == 'default' then
if tpl_args.format == 'default' then
        fmt = '<li>%s</li>'
fmt = '<li>%s</li>'
    else
else
        error(string.format('Unrecognized format: %s', tpl_args.format))
error(string.format('Unrecognized format: %s', tpl_args.format))
    end
end
   
    out = {'<ul>'}
out = {'<ul>'}
    save_tbl = {}
save_tbl = {}
    for _, data in pairs(m_game.constants.item.classes) do
for _, data in pairs(m_game.constants.item.classes) do
        if not save_tbl[data.category] and data.category ~= '' then
if not save_tbl[data.category] and data.category ~= '' then
            save_tbl[data.category] = true
save_tbl[data.category] = true
           
            out[#out+1] = string.format(fmt, data.category)
out[#out+1] = string.format(fmt, data.category)
        end
end
    end
end
    out[#out+1] = '</ul>'
out[#out+1] = '</ul>'
   
    return table.concat(out)
return table.concat(out)
end
end


Line 119: Line 133:
--
--
function p.filter_list(frame)
function p.filter_list(frame)
    g_args = getArgs(frame, {
g_args = getArgs(frame, {
        parentFirst = true
parentFirst = true
    })
})
    g_frame = util.misc.get_frame(frame)
g_frame = util.misc.get_frame(frame)
   
    g_args.type = g_args.type or ''
g_args.type = g_args.type or ''
   
    local tbl = mw.html.create('table')
local tbl = mw.html.create('table')
    tbl
tbl
        :attr('class', 'wikitable sortable')
:attr('class', 'wikitable sortable')
    local tblrow = tbl:tag('tr')
local tblrow = tbl:tag('tr')
            :tag('th')
:tag('th')
                :attr('rowspan', 2)
:attr('rowspan', 2)
                :wikitext('Name')
:wikitext('Name')
                :done()
:done()
            :tag('th')
:tag('th')
                :attr('rowspan', 2)
:attr('rowspan', 2)
                :wikitext('Author')
:wikitext('Author')
                :done()
:done()
            :tag('th')
:tag('th')
                :attr('rowspan', 2)
:attr('rowspan', 2)
                :wikitext('Release')
:wikitext('Release')
                :done()
:done()
            :tag('th')
:tag('th')
                :attr('colspan', 9)
:attr('colspan', 9)
                :wikitext('Ingame Features')
:wikitext('Ingame Features')
                :done()
:done()
            :tag('th')
:tag('th')
                :attr('colspan', 1)
:attr('colspan', 1)
                :wikitext('Other Features')
:wikitext('Other Features')
                :done()
:done()
            :tag('th')
:tag('th')
                :attr('colspan', 2)
:attr('colspan', 2)
                :wikitext('Filtration Support')
:wikitext('Filtration Support')
                :done()
:done()
    if g_args.type == 'specialized' then
if g_args.type == 'specialized' then
            tblrow:tag('th')
tblrow:tag('th')
                :attr('rowspan', 2)
:attr('rowspan', 2)
                :wikitext('Description')
:wikitext('Description')
                :done()
:done()
    end
end
           
    tblrow = tbl:tag('tr')
tblrow = tbl:tag('tr')
            :tag('th')
:tag('th')
                :wikitext('Colours')
:wikitext('Colours')
                :done()
:done()
            :tag('th')
:tag('th')
                :wikitext('Borders')
:wikitext('Borders')
                :done()
:done()
            :tag('th')
:tag('th')
                :wikitext('Font<br>Size')
:wikitext('Font<br>Size')
                :done()
:done()
            :tag('th')
:tag('th')
                :wikitext('Background')
:wikitext('Background')
                :done()
:done()
            :tag('th')
:tag('th')
                :wikitext('Item<br>Hiding')
:wikitext('Item<br>Hiding')
                :done()
:done()
            :tag('th')
:tag('th')
                :wikitext('Leveling')
:wikitext('Leveling')
                :done()
:done()
            :tag('th')
:tag('th')
                :wikitext('Endgame')
:wikitext('Endgame')
                :done()
:done()
            :tag('th')
:tag('th')
                :wikitext('Vendor<br>recipes')
:wikitext('Vendor<br>recipes')
                :done()
:done()
            :tag('th')
:tag('th')
                :wikitext('Crafting')
:wikitext('Crafting')
                :done()
:done()
            -- Other Features
-- Other Features
            :tag('th')
:tag('th')
                :wikitext('Customizable')
:wikitext('Customizable')
                :done()
:done()
            -- Filtration
-- Filtration
            :tag('th')
:tag('th')
                :wikitext('General')
:wikitext('General')
                :done()
:done()
            :tag('th')
:tag('th')
                :wikitext('Themes')
:wikitext('Themes')
                :done()
:done()
        :done()
:done()
        :wikitext(g_args.rows)
:wikitext(g_args.rows)
   
    --return tostring(tbl) .. frame:extensionTag{ name = 'references', content = '', args = {group='note'}}
--return tostring(tbl) .. frame:extensionTag{ name = 'references', content = '', args = {group='note'}}
    return tostring(tbl)
return tostring(tbl)
end
end


Line 219: Line 233:


function h.filter_list_get_arg(arg)
function h.filter_list_get_arg(arg)
    --[[
--[[
    Return a formatted table cell for the given argument
Return a formatted table cell for the given argument
    ]]--
]]--
    local val = g_args[arg]
local val = g_args[arg]
    if type(val) == 'number' then
if type(val) == 'number' then
        val = filter_list_range_values[val]
val = filter_list_range_values[val]
    end
end
    if g_args[arg .. '_note'] ~= nil then
if g_args[arg .. '_note'] ~= nil then
        local abbr = mw.html.create('abbr')
local abbr = mw.html.create('abbr')
        abbr
abbr
            :attr('title', g_args[arg .. '_note'])
:attr('title', g_args[arg .. '_note'])
            :css('color', 'black')
:css('color', 'black')
            :wikitext(val)
:wikitext(val)
            :done()
:done()
        return tostring(abbr)
return tostring(abbr)
    else
else
        return val
return val
    end
end
end
end


Line 242: Line 256:
-- =p.filter_list{type='specialized',rows=p.filter_list_row{type='specialized', name='a', release_link='http://google.de', author='Mario', author_contact='No idea', direct_link='http://google.de', colour='yes',colour_note="test", border='yes', font_size='no', background='no', item_hiding='yes', leveling=0, endgame=4, vendor_recipes='partial', crafting='no', release='2015', description='test'}}
-- =p.filter_list{type='specialized',rows=p.filter_list_row{type='specialized', name='a', release_link='http://google.de', author='Mario', author_contact='No idea', direct_link='http://google.de', colour='yes',colour_note="test", border='yes', font_size='no', background='no', item_hiding='yes', leveling=0, endgame=4, vendor_recipes='partial', crafting='no', release='2015', description='test'}}
function p.filter_list_row(frame)
function p.filter_list_row(frame)
    g_args = getArgs(frame, {
g_args = getArgs(frame, {
        parentFirst = true
parentFirst = true
    })
})
    g_frame = util.misc.get_frame(frame)
g_frame = util.misc.get_frame(frame)
   
    -- Checking args
-- Checking args
   
    for _, arg in ipairs(filter_list_required_args) do
for _, arg in ipairs(filter_list_required_args) do
        if g_args[arg] == nil then
if g_args[arg] == nil then
            error('Required argument ' .. arg .. ' is missing')
error('Required argument ' .. arg .. ' is missing')
        end
end
    end
end
   
    g_args.filtration_general = g_args.filtration_general or 'unknown'
g_args.filtration_general = g_args.filtration_general or 'unknown'
    g_args.filtration_themes = g_args.filtration_themes or 'unknown'
g_args.filtration_themes = g_args.filtration_themes or 'unknown'
    g_args.customization = g_args.customization or 'unknown'
g_args.customization = g_args.customization or 'unknown'
    g_args.descriptipon = g_args.description or '<br>'
g_args.descriptipon = g_args.description or '<br>'
    g_args.type = g_args.type or ''
g_args.type = g_args.type or ''
   
    -- Checking & formatting args
-- Checking & formatting args
   
    for _, arg in ipairs(filter_list_range_args) do
for _, arg in ipairs(filter_list_range_args) do
        local val = g_args[arg]
local val = g_args[arg]
        local index = filter_list_range_values:index(val)
local index = filter_list_range_values:index(val)
        if index then
if index then
            g_args[arg] = index
g_args[arg] = index
        else
else
            index = util.cast.number(val)
index = util.cast.number(val)
            if index ~= nil and index >= 0 and index < filter_list_range_values:size() then
if index ~= nil and index >= 0 and index < filter_list_range_values:size() then
                -- Lua starts counting at 1
-- Lua starts counting at 1
                g_args[arg] = index+1
g_args[arg] = index+1
            else
else
                error('Argument ' .. arg .. ' requires one of the following arguments: ' .. table.concat(filter_list_range_values, ' '))
error('Argument ' .. arg .. ' requires one of the following arguments: ' .. table.concat(filter_list_range_values, ' '))
            end
end
        end
end
    end
end
   
    for _, arg in ipairs(filter_list_yes_no_args) do
for _, arg in ipairs(filter_list_yes_no_args) do
        local val = g_args[arg]
local val = g_args[arg]
        if not filter_list_yes_no:contains(val) then
if not filter_list_yes_no:contains(val) then
            error('Argument ' .. arg .. ' requires one of the following arguments: ' .. table.concat(filter_list_yes_no, ' '))
error('Argument ' .. arg .. ' requires one of the following arguments: ' .. table.concat(filter_list_yes_no, ' '))
        end
end
    end
end
   
    -- Output
-- Output
   
    local tblrow = mw.html.create('tr')
local tblrow = mw.html.create('tr')
    tblrow
tblrow
        :tag('td')
:tag('td')
            :wikitext('[' .. g_args.release_link .. ' ' .. g_args.name .. ']')
:wikitext('[' .. g_args.release_link .. ' ' .. g_args.name .. ']')
            :done()
:done()
        :tag('td')
:tag('td')
            :wikitext(g_args.author)
:wikitext(g_args.author)
            :done()
:done()
        :tag('td')
:tag('td')
            :wikitext(g_args.release)
:wikitext(g_args.release)
            :done()
:done()
           
    -- Basic Features
-- Basic Features
    for _, arg in ipairs(filter_list_range_args) do
for _, arg in ipairs(filter_list_range_args) do
        local index = g_args[arg]
local index = g_args[arg]
        local text = filter_list_range_values[index] or ''
local text = filter_list_range_values[index] or ''
        local note = g_args[arg .. '_note']
local note = g_args[arg .. '_note']
        tblrow
tblrow
            :tag('td')
:tag('td')
                :attr('class', 'table-cell-coloured table-cell-' .. text )
:attr('class', 'table-cell-coloured table-cell-' .. text )
                :attr('data-sort-value', index)
:attr('data-sort-value', index)
                :wikitext(h.filter_list_get_arg(arg))
:wikitext(h.filter_list_get_arg(arg))
                :done()
:done()
    end
end
   
    -- Other Features
-- Other Features
    for _, arg in ipairs(filter_list_yes_no_args) do
for _, arg in ipairs(filter_list_yes_no_args) do
        local val = g_args[arg]
local val = g_args[arg]
        tblrow
tblrow
            :tag('td')
:tag('td')
                :attr('class', 'table-cell-coloured table-cell-' .. val)
:attr('class', 'table-cell-coloured table-cell-' .. val)
                :attr('data-sort-value', '' .. filter_list_yes_no:index(val))
:attr('data-sort-value', '' .. filter_list_yes_no:index(val))
                :wikitext(h.filter_list_get_arg(arg))
:wikitext(h.filter_list_get_arg(arg))
                :done()
:done()
    end
end
   
    if g_args.type == 'specialized' then
if g_args.type == 'specialized' then
        tblrow
tblrow
            :tag('td')
:tag('td')
                :wikitext(h.filter_list_get_arg('description'))
:wikitext(h.filter_list_get_arg('description'))
                :done()
:done()
    end
end


    return tostring(tblrow)
return tostring(tblrow)
end
end



Revision as of 01:08, 19 December 2021

This is the module sandbox page for Module:Miscellaneous (diff).

Module documentation[view] [edit] [history] [purge]


Lua logo

This module depends on the following other modules:

Overview

Module for implementing various templates in lua that are not big/complex enough to warrent their own module.

List of currently implemented templates


--[[
Module for implementing miscellaneous templates in lua.  
Mostly exists here so we don't have hundred of module pages for templates that don't have a lot of code.
 
If a template requires a *lot* of coding consider moving it into it's own lua module.
]]--

local xtable = require('Module:Table')
local util = require('Module:Util')
local getArgs = require('Module:Arguments').getArgs
local mbox = require('Module:Message box').main

local m_game = mw.loadData('Module:Game')

local h = {}
local p = {}
local g_frame, g_args

local i18n = {
	tooltips = {
		item_class = 'Item class',
		item_class_id = 'Internal ID',
		item_class_category = 'Category',
	},
}

--
-- Template: Item class list
--

function p.item_class_list(frame)
	g_args = getArgs(frame, {
		parentFirst = true
	})
	g_frame = util.misc.get_frame(frame)
	
	g_args.noid = g_args.noid or false
	g_args.nocategory = g_args.nocategory or false
	
	local skip = {['SmallRelic'] = true, ['MediumRelic'] = true, ['LargeRelic'] = true}
	local out = {}
	
	
	for id, data in pairs(m_game.constants.item.classes) do
		if skip[id] == nil then
			local datafull = "''none''"
			if (data['full'] ~= nil) and (data['full'] ~= '') then
				datafull = string.format('[[%s]]', data['full'])
			end
			local datacategory = "''none''"
			if (data['category'] ~= nil) and (data['category'] ~= '') then
				datacategory = data['category']
			end
			local tdfull = mw.html.create('td')
	        	:wikitext(datafull)
			local tdid
			if not g_args.noid then
				tdid = mw.html.create('td')
					:wikitext(id)
			end
			local tdcategory
			if not g_args.nocategory then
				tdcategory = mw.html.create('td')
					:wikitext(datacategory)
			end
			local tr = mw.html.create('tr')
				:node(tdfull)
				:node(tdid)
				:node(tdcategory)
			out[data['id']] = tostring(tr)
		else
			out[data['id']] = ''
		end
	end
	
	local thfull = mw.html.create('th')
		:wikitext(i18n.tooltips.item_class)
	local thid
	if not g_args.noid then
		thid = mw.html.create('th')
			:wikitext(i18n.tooltips.item_class_id)
	end
	local thcategory
	if not g_args.nocategory then
		thid = mw.html.create('th')
			:wikitext(i18n.tooltips.item_class_category)
	end
	local tbl = mw.html.create('table')
		:attr('class', 'wikitable sortable')
		:tag('tr')
			:node(thfull)
			:node(thid)
			:node(thcategory)
			:done()
		:wikitext(table.concat(out))
	
	return tostring(tbl)
end

function p.item_class_category_list(frame)
	--[[
		Displays a list of categories for all item classes.
	]]

	local tpl_args = getArgs(frame, {parentFirst = true})
	local frame = util.misc.get_frame(frame)
	
	tpl_args.format = tpl_args.format or 'default'
	
	local fmt
	if tpl_args.format == 'default' then
		fmt = '<li>%s</li>'
	else
		error(string.format('Unrecognized format: %s', tpl_args.format))
	end
	
	out = {'<ul>'}
	save_tbl = {}
	for _, data in pairs(m_game.constants.item.classes) do
		if not save_tbl[data.category] and data.category ~= '' then
			save_tbl[data.category] = true
			
			out[#out+1] = string.format(fmt, data.category)
		end
	end
	out[#out+1] = '</ul>'
	
	return table.concat(out)
end

--
-- Template: ItemFilterList
--
function p.filter_list(frame)
	g_args = getArgs(frame, {
		parentFirst = true
	})
	g_frame = util.misc.get_frame(frame)
	
	g_args.type = g_args.type or ''
	
	local tbl = mw.html.create('table')
	tbl
		:attr('class', 'wikitable sortable')
	local tblrow = tbl:tag('tr')
			:tag('th')
				:attr('rowspan', 2)
				:wikitext('Name')
				:done()
			:tag('th')
				:attr('rowspan', 2)
				:wikitext('Author')
				:done()
			:tag('th')
				:attr('rowspan', 2)
				:wikitext('Release')
				:done()
			:tag('th')
				:attr('colspan', 9)
				:wikitext('Ingame Features')
				:done()
			:tag('th')
				:attr('colspan', 1)
				:wikitext('Other Features')
				:done()
			:tag('th')
				:attr('colspan', 2)
				:wikitext('Filtration Support')
				:done()
	if g_args.type == 'specialized' then
			tblrow:tag('th')
				:attr('rowspan', 2)
				:wikitext('Description')
				:done()
	end
			
	tblrow = tbl:tag('tr')
			:tag('th')
				:wikitext('Colours')
				:done()
			:tag('th')
				:wikitext('Borders')
				:done()
			:tag('th')
				:wikitext('Font<br>Size')
				:done()
			 :tag('th')
				:wikitext('Background')
				:done()
			:tag('th')
				:wikitext('Item<br>Hiding')
				:done()
			:tag('th')
				:wikitext('Leveling')
				:done()
			:tag('th')
				:wikitext('Endgame')
				:done()
			:tag('th')
				:wikitext('Vendor<br>recipes')
				:done()
			:tag('th')
				:wikitext('Crafting')
				:done()
			-- Other Features
			:tag('th')
				:wikitext('Customizable')
				:done()
			-- Filtration
			:tag('th')
				:wikitext('General')
				:done()
			:tag('th')
				:wikitext('Themes')
				:done()
		:done()
		:wikitext(g_args.rows)
	
	--return tostring(tbl) .. frame:extensionTag{ name = 'references', content = '', args = {group='note'}}
	return tostring(tbl)
end

--
-- Template: ItemFilterListRow
--

local filter_list_required_args = xtable:new({'name', 'release_link', 'author', 'release', 'colour', 'border', 'font_size', 'background', 'item_hiding', 'leveling', 'endgame', 'vendor_recipes', 'crafting'})
local filter_list_range_args = xtable:new({'colour', 'border', 'font_size', 'background', 'item_hiding', 'leveling', 'endgame', 'vendor_recipes', 'crafting'})
local filter_list_range_values = xtable:new({'no', 'minor', 'partial', 'major', 'yes'})

local filter_list_yes_no_args = xtable:new({'customization', 'filtration_general', 'filtration_themes'})
local filter_list_yes_no = xtable:new({'no', 'partial', 'yes', 'unknown'})

function h.filter_list_get_arg(arg)
	--[[
	Return a formatted table cell for the given argument
	]]--
	local val = g_args[arg]
	if type(val) == 'number' then
		val = filter_list_range_values[val]
	end
	if g_args[arg .. '_note'] ~= nil then
		local abbr = mw.html.create('abbr')
		abbr
			:attr('title', g_args[arg .. '_note'])
			:css('color', 'black')
			:wikitext(val)
			:done()
		return tostring(abbr)
	else
		return val
	end
end

-- Test: =p.filter_list{rows=p.filter_list_row{name='a', release_link='http://google.de', author='Mario', author_contact='No idea', direct_link='http://google.de', colour='yes', border='yes', font_size='no', item_hiding='yes', leveling=0, endgame=4, vendor_recipes='partial', crafting='no', release='2015'}}
-- =p.filter_list{type='specialized',rows=p.filter_list_row{type='specialized', name='a', release_link='http://google.de', author='Mario', author_contact='No idea', direct_link='http://google.de', colour='yes',colour_note="test", border='yes', font_size='no', background='no', item_hiding='yes', leveling=0, endgame=4, vendor_recipes='partial', crafting='no', release='2015', description='test'}}
function p.filter_list_row(frame)
	g_args = getArgs(frame, {
		parentFirst = true
	})
	g_frame = util.misc.get_frame(frame)
	
	-- Checking args
	
	for _, arg in ipairs(filter_list_required_args) do
		if g_args[arg] == nil then
			error('Required argument ' .. arg .. ' is missing')
		end
	end
	
	g_args.filtration_general = g_args.filtration_general or 'unknown'
	g_args.filtration_themes = g_args.filtration_themes or 'unknown'
	g_args.customization = g_args.customization or 'unknown'
	g_args.descriptipon = g_args.description or '<br>'
	g_args.type = g_args.type or ''
	
	-- Checking & formatting args
	
	for _, arg in ipairs(filter_list_range_args) do
		local val = g_args[arg]
		local index = filter_list_range_values:index(val)
		if index then
			g_args[arg] = index
		else
			index = util.cast.number(val)
			if index ~= nil and index >= 0 and index < filter_list_range_values:size() then
				-- Lua starts counting at 1
				g_args[arg] = index+1
			else
				error('Argument ' .. arg .. ' requires one of the following arguments: ' .. table.concat(filter_list_range_values, ' '))
			end
		end
	end
	
	for _, arg in ipairs(filter_list_yes_no_args) do
		local val = g_args[arg]
		if not filter_list_yes_no:contains(val) then
			error('Argument ' .. arg .. ' requires one of the following arguments: ' .. table.concat(filter_list_yes_no, ' '))
		end
	end
	
	-- Output
	
	local tblrow = mw.html.create('tr')
	tblrow
		:tag('td')
			:wikitext('[' .. g_args.release_link .. ' ' .. g_args.name .. ']')
			:done()
		:tag('td')
			:wikitext(g_args.author)
			:done()
		:tag('td')
			:wikitext(g_args.release)
			:done()
			
	-- Basic Features
	for _, arg in ipairs(filter_list_range_args) do
		local index = g_args[arg]
		local text = filter_list_range_values[index] or ''
		local note = g_args[arg .. '_note']
		tblrow
			:tag('td')
				:attr('class', 'table-cell-coloured table-cell-' .. text )
				:attr('data-sort-value', index)
				:wikitext(h.filter_list_get_arg(arg))
				:done()
	end
	
	-- Other Features
	for _, arg in ipairs(filter_list_yes_no_args) do
		local val = g_args[arg]
		tblrow
			:tag('td')
				:attr('class', 'table-cell-coloured table-cell-' .. val)
				:attr('data-sort-value', '' .. filter_list_yes_no:index(val))
				:wikitext(h.filter_list_get_arg(arg))
				:done()
	end
	
	if g_args.type == 'specialized' then
		tblrow
			:tag('td')
				:wikitext(h.filter_list_get_arg('description'))
				:done()
	end

	return tostring(tblrow)
end

-- ----------------------------------------------------------------------------

return p