模組:category tree/blocks

來自維基辭典

呢個模組嘅解說可以喺模組:category tree/blocks/doc度開

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 = "呢個類包含由字元資料盒分類成'''[[附錄:統一碼/" .. block .. "|" .. block .. "]]'''區段入面嘅字元嘅辭條。\n\nSome entries may define characters from multiple Unicode codepoints at once, so the page title could be an entry that is not from this block.[[Category:統一碼區段]]"

	-- At least 1 page is the appendix for the current Unicode block.
	if pagesInCategory == 1 then
		result = result .. "[[Category:無辭條嘅統一碼區段]]"
	elseif pagesInCategory <= 11 then
		result = result .. "[[Category:有1至10篇辭條嘅統一碼區段]]"
	elseif pagesInCategory <= 51 then
		result = result .. "[[Category:有11至50篇辭條嘅統一碼區段]]"
	elseif pagesInCategory <= 101 then
		result = result .. "[[Category:有51至100篇辭條嘅統一碼區段]]"
	else
		result = result .. "[[Category:有100篇辭條以上嘅統一碼區段]]"
	end

	return result
end

return export