Zum Inhalt springen

Modul:Hatnote: Unterschied zwischen den Versionen

249 Bytes hinzugefügt ,  vor 10 Jahren
add helpLink parameter to makeWikitextError
(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)
(add helpLink parameter to makeWikitextError)
Zeile 75: Zeile 75:
end
end


function p.makeWikitextError(msg, addTrackingCategory)
function p.makeWikitextError(msg, helpLink, addTrackingCategory)
-- Formats an error message to be returned to wikitext. If
-- Formats an error message to be returned to wikitext. If
-- addTrackingCategory is not false after being returned from
-- addTrackingCategory is not false after being returned from
Zeile 81: Zeile 81:
-- is added.
-- is added.
checkType('makeWikitextError', 1, msg, 'string')
checkType('makeWikitextError', 1, msg, 'string')
checkType('makeWikitextError', 2, helpLink, 'string', true)
yesno = require('Module:Yesno')
yesno = require('Module:Yesno')
local title = mw.title.getCurrentTitle()
local title = mw.title.getCurrentTitle()
-- Make the help link text.
local helpText
if helpLink then
helpText = ' ([[' .. helpLink .. '|help]])'
else
helpText = ''
end
-- Make the category text.
local category
local category
if not title.isTalkPage and yesno(addTrackingCategory) ~= false then
if not title.isTalkPage and yesno(addTrackingCategory) ~= false then
Zeile 95: Zeile 104:
end
end
return string.format(
return string.format(
'<strong class="error">Error: %s.</strong>%s',
'<strong class="error">Error: %s%s.</strong>%s',
msg,
msg,
helpText,
category
category
)
)
Anonymer Benutzer