বিষয়বস্তুতে চলুন

মডিউল:list description

উইকিঅভিধান, মুক্ত অভিধান থেকে

এই মডিউলের জন্য মডিউল:list description/নথি-এ নথিপত্র তৈরি করা হয়ে থাকতে পারে

local export = {}

function export.show(frame)
	local title = mw.title.getCurrentTitle()
	local rootpagename = title.rootText
	local isSubpage = title.isSubpage
	local subpagename = title.subpageText
	mw.log(rootpagename, isSubpage, subpagename)
	
	local lang, canonicalName
	if isSubpage then
		lang = require("Module:languages").getByCode(subpagename)
	end
	
	local listName, matches
	if rootpagename then
		listName, matches = mw.ustring.gsub(rootpagename, "list:", "")
	end
	
	local description
	local category = ""
	if lang then
		if matches == 1 then
			description =  "This is a list of " .. listName .. " in the " .. lang:getCanonicalName() .. " language."
			if mw.ustring.match(listName, "Latin script") then
				category = "[[Category:Latin script templates]]"
			end
		else
			description = "This is a list in the " .. lang:getCanonicalName() .. " language."
		end
	end
	
	if description then
		return description .. category
	end
end

return export