Module:Dochead: Difference between revisions
Created page with "-- This module follows User:Ganaram inukshuk/Provisional style guide for Lua local getArgs = require("Module:Arguments").getArgs local ctg = require("Module:Category handler")._category_handler local p = {} -- Produces a hatnote that is placed on the top of a documentation page (either -- template or module documentation) and can autodetect and categorize: -- - FOR MODULES: -- - whether a module has an accompanying template (overridable) -- - whether a modu..." |
No edit summary |
||
| Line 18: | Line 18: | ||
-- - (MODULES) whether it's a metamodule (used the same way as a metatemplate, | -- - (MODULES) whether it's a metamodule (used the same way as a metatemplate, | ||
-- but direct use of module code is allowed) | -- but direct use of module code is allowed) | ||
-- Detect whether a page exists, where pagename is "Namespace:Title" | |||
function p.page_exists(pagename) | |||
local pagename = pagename or "Template:Dochead" | |||
local title = mw.title.new(pagename) | |||
if title and title.exists then | |||
return true | |||
else | |||
return false | |||
end | |||
end | |||
function p._dochead(args) | function p._dochead(args) | ||
local pagename = args["pagename"] | |||
local is_metause = args["is_metause"] or false | |||