မာတိကာသို့ ခုန်သွားရန်

မဝ်ဂျူ:pages/templates

နူ ဝိက်ရှေန်နရဳ

Documentation for this module may be created at မဝ်ဂျူ:pages/templates/doc

-- Prevent substitution.
if mw.isSubsting() then
	return require("Module:unsubst")
end

local get_current_title = mw.title.getCurrentTitle
local new_title = mw.title.new

local export = {}

function export.pagetype_t(frame)
	local args = require("Module:parameters").process(frame:getParent().args, {
		["article"] = {type = "boolean"},
		["pagename"] = {demo = true},
	})
	
	local pagename = args.pagename
	local pagetype = require("Module:pages").pagetype(
		not pagename and get_current_title() or new_title(pagename) or error(mw.dumpObject(pagename) .. " is not a valid page name.")
	)
	
	return not args.article and pagetype or
		pagetype:sub(1, 4) == "user" and "a " .. pagetype or -- avoids "an user"
		require("Module:string utilities").add_indefinite_article(pagetype)
end

return export