Bước tới nội dung

Mô đun:Thảo luận BCB

Bách khoa toàn thư mở Wikipedia
local p = {}-- Hàm ngoàilocal _navbox = require('Module:Navbox')._navboxlocal navbox = function(name, title, list)	return _navbox({		name = name,		title = title,		state = 'uncollapse',		listclass = 'hlist',		list1 = list	})end-- Hàm phụ trợlocal yearHandler = function(index)	return string.format('* [[Thảo luận Wikipedia:Bạn có biết/%s|%s]]', index, index)endlocal weekHandler = function(year)	return function(index)		return string.format(			'* [[Thảo luận Wikipedia:Bạn có biết/%s/Tuần %s|%s]]',			year, index, (index == 1 and 'Tuần ' or '') .. index		)	endend-- Hàm tạo danh sáchlocal list = function(istart, iend, fn)	local list = {}	for i = istart, iend do		list[#list + 1] = fn(i)	end	return table.concat(list, '\n')endlocal yearList = function()	local currentYear = tonumber(os.date('%Y'))	return list(2008, currentYear, yearHandler)endlocal weekList = function(year)	return list(1, 53, weekHandler(year))end-- Hàm trong packagefunction p.year(frame)	local year = frame.args[1]	return p._year(year)endfunction p._year(year)	local title = 'Thảo luận BCB ' .. year	return navbox(		title,		string.format('[[Thảo luận Wikipedia:Bạn có biết/%s|%s]]', year, title),		weekList(year)	)endfunction p.index()	return navbox(		'Thảo luận BCB theo năm',		'[[Thảo luận Wikipedia:Bạn có biết|Thảo luận BCB]]',		yearList()	)endreturn p