Module:Dochead: Difference between revisions
ArrowHead294 (talk | contribs) mNo edit summary |
autocategorize metatemplates |
||
| (One intermediate revision by one other user not shown) | |||
| Line 133: | Line 133: | ||
-- Helper function: categorize template | -- Helper function: categorize template | ||
local function categorize_template(pagename, has_invoke) | local function categorize_template(pagename, has_invoke, is_metatemplate) | ||
local cats = "" | local cats = "" | ||
if pagename:match("/doc$") then | if pagename:match("/doc$") then | ||
| Line 141: | Line 141: | ||
if has_invoke then | if has_invoke then | ||
cats = cats .. " [[Category:Lua-based templates]]" | cats = cats .. " [[Category:Lua-based templates]]" | ||
end | |||
if is_metatemplate then | |||
cats = cats .. " [[Category:Metatemplates]]" | |||
end | end | ||
end | end | ||
| Line 267: | Line 270: | ||
-- Categorize | -- Categorize | ||
local cats = categorize_template(pagename, #invokes > 0) | local cats = categorize_template(pagename, #invokes > 0, header == "metatemplate") | ||
if header == "none" then | if header == "none" then | ||
| Line 278: | Line 281: | ||
return string.format(": ''%s''%s\n", result, cats) | return string.format(": ''%s''%s\n", result, cats) | ||
else | else | ||
return string.format(": ''%s''\n:''%s''%s\n", result, invocation_hatnote, cats) | return string.format(": ''%s''\n: ''%s'' %s\n", result, invocation_hatnote, cats) | ||
end | end | ||
end | end | ||