Module:Hatnote: Difference between revisions

113 bytes added ,  10 years ago
add a demo parameter to makeWikitextError
m>Mr. Stradivarius
(merge rellink into hatnote, use an options table to pass options to the hatnote function, and add a tracking category for errors)
m>Mr. Stradivarius
(add a demo parameter to makeWikitextError)
Line 74: Line 74:
end
end


function p._makeWikitextError(msg)
function p._makeWikitextError(msg, demo)
-- Formats an error message to be returned to wikitext.
-- Formats an error message to be returned to wikitext. If demo is not nil
-- or false, no error category is added.
checkType('_makeWikitextError', 1, msg, 'string')
checkType('_makeWikitextError', 1, msg, 'string')
local errorCategory = 'Hatnote templates with errors'
local errorCategory = 'Hatnote templates with errors'
local errorCategoryLink = errorCategory
local errorCategoryLink
and string.format(
if not demo then
errorCategoryLink = string.format(
'[[%s:%s]]',
'[[%s:%s]]',
mw.site.namespaces[14].name,
mw.site.namespaces[14].name,
errorCategory
errorCategory
)
)
or ''
else
errorCategoryLink = ''
end
return string.format(
return string.format(
'<strong class="error">Error: %s.</strong>%s',
'<strong class="error">Error: %s.</strong>%s',
Anonymous user