Modul:Hatnote: Unterschied zwischen den Versionen
add a demo parameter to makeWikitextError
(merge rellink into hatnote, use an options table to pass options to the hatnote function, and add a tracking category for errors) |
(add a demo parameter to makeWikitextError) |
||
Zeile 74: | Zeile 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 | local errorCategoryLink | ||
if not demo then | |||
errorCategoryLink = string.format( | |||
'[[%s:%s]]', | '[[%s:%s]]', | ||
mw.site.namespaces[14].name, | mw.site.namespaces[14].name, | ||
errorCategory | errorCategory | ||
) | ) | ||
else | |||
errorCategoryLink = '' | |||
end | |||
return string.format( | return string.format( | ||
'<strong class="error">Error: %s.</strong>%s', | '<strong class="error">Error: %s.</strong>%s', |