Anonymous user
Module:Hatnote: Difference between revisions
update the makeWikitextError function - don't use Module:Category handler, and use an addTrackingCategory parameter instead of a demo parameter, to make it easy for daughter modules to add a category=no parameter
(don't categorise talk namespaces) |
(update the makeWikitextError function - don't use Module:Category handler, and use an addTrackingCategory parameter instead of a demo parameter, to make it easy for daughter modules to add a category=no parameter) |
||
Line 11:
local mArguments -- lazily initialise [[Module:Arguments]]
local yesno -- lazily initialise [[Module:Yesno]]
local p = {}
Line 76 ⟶ 75:
end
function p.makeWikitextError(msg,
-- Formats an error message to be returned to wikitext. If
-- addTrackingCategory is not false after being returned from
-- [[Module:Yesno]], and if we are not on a talk page, a tracking category
-- is added.
checkType('makeWikitextError', 1, msg, 'string')
yesno = require('Module:Yesno')
local title = mw.title.getCurrentTitle()
local category
local errorCategory = 'Hatnote templates with errors'▼
if not title.isTalkPage and yesno(addTrackingCategory) ~= false then
local errorCategoryLink = string.format(▼
'[[%s:%s]]',▼
mw.site.namespaces[14].name,▼
▲ '[[%s:%s]]',
▲ mw.site.namespaces[14].name,
category
)
else
category = ''
end
return string.format(
'<strong class="error">Error: %s.</strong>%s',
msg,
category
)
end
|