Toggle menu
Toggle preferences menu
Toggle personal menu
Not logged in
Your IP address will be publicly visible if you make any edits.
Revision as of 12:45, 5 April 2025 by >HashJona

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

local p = {}
local months = {
	January = 1,
	February = 2,
	March = 3,
	April = 4,
	May = 5,
	June = 6,
	July = 7,
	August = 8,
	September = 9,
	October = 10,
	November = 11,
	December = 12,
	['-'] = 13
}
	
function p.build_table(frame) 
	local args = frame:getParent().args
	local data = args['data'] or ''
	local lines = mw.text.split(data, "\n")
	

	
	local results = {}
	for _, line in ipairs(lines) do
        line = mw.text.trim(line)
        if line ~= "" then
           
            local parts = mw.text.split(line, "|")
            local month = parts[1] or "-"
            local item  = parts[2] or ""
            
            local key = months[month]
            if  results[key] == nil then 
            	results[key] = '|-\n|' .. month .. '\n|{{ItemLink|' .. item .. '}}'
            else
            	results[key] = results[key] .. '\n|{{ItemLink|' .. item .. '}}'
            end
        end
	end
    return table.concat(results, '\n')
end

return p