Module:pages/templates
Jump to navigation
Jump to search
- The following documentation is located at Module:pages/templates/documentation. [edit] Categories were auto-generated by Module:documentation. [edit]
- Useful links: root page • root page’s subpages • links • transclusions • testcases • sandbox
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