This module implements {{pagetype}}.


-- 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
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy