Module:Code review backlog

From Laserwiki
Jump to navigation Jump to search

Documentation for this module may be created at Module:Code review backlog/doc

local cre = require( 'Module:Code review entry' )

local build_list = function ( title, entries )
	local retval = '=== ' .. title .. ' ===\n'

	for i, entry in ipairs( entries ) do
		retval = retval .. cre._dl( entry.link, entry.desc, entry.done ) .. '\n'
	end

	return retval
end

return {
	_build_list = build_list,

	build_list = function ( frame )
		local index = 1
		local args = frame.args
		local title = args.title
		local entries = {}
		local entry = {}

		while args[index] ~= nil do
			v = args[index]

			if entry.link == nil then
				entry.link = v
			elseif entry.desc == nil then
				entry.desc = v
			elseif entry.done == nil then
				entry.done = v
				table.insert( entries, entry )
				entry = {}
			end

			index = index + 1
		end

		return build_list( title, entries )
	end
}