模組:Category tree/blocks

維基詞典,自由的多語言詞典
local export = {}

function export.contents(frame)
	local pagesInCategory = mw.site.stats.pagesInCategory(mw.title.getCurrentTitle().text, "pages")
	local block = mw.ustring.gsub(mw.title.getCurrentTitle().text, "區段", "")
	local result = "此分類包含了'''[[Appendix:Unicode/" .. block .. "|" .. block .. "]]'''中的字符的詞條。由於一些詞條可能一次定義了來自多個Unicode代碼點的字符,因此頁面標題可能並不是來自此區段的詞條。[[Category:Unicode區段]]"

	-- At least 1 page is the appendix for the current Unicode block.
	if pagesInCategory == 1 then
		result = result .. "[[Category:擁有0個詞條的Unicode區段]]"
	elseif pagesInCategory <= 11 then
		result = result .. "[[Category:擁有1-10個詞條的Unicode區段]]"
	elseif pagesInCategory <= 51 then
		result = result .. "[[Category:擁有11-50個詞條的Unicode區段]]"
	elseif pagesInCategory <= 101 then
		result = result .. "[[Category:擁有51-100個詞條的Unicode區段]]"
	else
		result = result .. "[[Category:擁有超過100個詞條的Unicode區段]]"
	end

	return result
end

return export