Module:Category handler: Difference between revisions
refactor main so debug option is second |
ArrowHead294 (talk | contribs) m Wikitext debugger option |
||
| Line 165: | Line 165: | ||
function p.category_handler(frame) | function p.category_handler(frame) | ||
local args = getArgs(frame) | local args = getArgs(frame) | ||
local excluded_ns_unparsed = args["excluded_ns"] or "" -- Additional namespaces to exclude (EG, a template that should not be used within main namespace, which is allowed by default) | local excluded_ns_unparsed = args["excluded_ns"] or "" -- Additional namespaces to exclude (EG, a template that should not be used within main namespace, which is allowed by default) | ||
local allowed_ns_unparsed = args["allowed_ns" ] or "" -- Namespaces to allow; overrides default list (EG, a template that should be used within user namespace, which is disallowed by default) | local allowed_ns_unparsed = args["allowed_ns" ] or "" -- Namespaces to allow; overrides default list (EG, a template that should be used within user namespace, which is disallowed by default) | ||
local suffixes_unparsed = args["suffixes" ] or "" -- Additional page suffixes in which to disallow categories | local suffixes_unparsed = args["suffixes" ] or "" -- Additional page suffixes in which to disallow categories | ||
local is_debug = yesno(args["debug"], false) | local is_debug = yesno(args["debug"], false) -- Parse debug mode; setting this to TRUE disables all categories | ||
local wtext = yesno(args["wtext"]) -- Used to show the underlying Wikitext | |||
-- Parse categories | -- Parse categories | ||
| Line 212: | Line 213: | ||
end | end | ||
local result = p._category_handler(cats, is_debug, ns_override, suffixes) | |||
if wtext then | |||
result = "<syntaxhighlight lang=\"wikitext\">" .. result .. "</syntaxhighlight>" | |||
end | |||
return frame:preprocess(result) | |||
end | end | ||
return p | return p | ||