This module implements the } template.
Please see the template page for usage instructions.
local p = {} -- Ripped from Module:Infobox. TODO: Make a utility module that can do this kind of thing local function getArgNums(args, prefix) -- Returns a table containing the numbers of the arguments that exist -- for the specified prefix. For example, if the prefix was 'data', and -- 'data1', 'data2', and 'data5' exist, it would return {1, 2, 5}. local nums = {} for k, v in pairs(args) do local num = tostring(k):match('^' .. prefix .. '([1-9]%d*)$') if num then table.insert(nums, tonumber(num)) end end table.sort(nums) return nums end function p.main(frame) local args = require('Module:Arguments').getArgs(frame, {wrappers = 'Template:Singles'}) local out = [=[ .. frame:expandTemplate{title = 'Infobox album/color', args = {args.Type}} .. [=[;" colspan="3">[[Single (music)|Singles]] from '']=] .. (args.Name or mw.title.getCurrentTitle().prefixedText) .. [=['' ]=] local nums = getArgNums(args, '[Ss]ingle ') for _, num in ipairs(nums) do out = out .. '\n# "' .. (args['Single ' .. num] or args['single ' .. num]) .. '"' local date = args['Single ' .. num .. ' date'] or args['single ' .. num .. ' date'] if date then out = out .. '
Released: ' .. date end out = out .. '' end out = out .. [=[ ]=] return out end return p