Zum Inhalt springen

Modul:Format link: Unterschied zwischen den Versionen

K
15 Versionen von wpen:Module:Format_link importiert
(Updated from sandbox with new target override functionality)
K (15 Versionen von wpen:Module:Format_link importiert)
 
(2 dazwischenliegende Versionen von 2 Benutzern werden nicht angezeigt)
Zeile 98: Zeile 98:
local function missingArgError(target)
local function missingArgError(target)
mError = require('Module:Error')
mError = require('Module:Error')
return mError._error{message =
return mError.error{message =
'Error: no link or target specified! ([[' .. target .. '#Errors|help]])'
'Error: no link or target specified! ([[' .. target .. '#Errors|help]])'
}
}
Zeile 168: Zeile 168:
local title = nil
local title = nil
if parsed.page then title = mw.title.new(parsed.page) end
if parsed.page then title = mw.title.new(parsed.page) end
if title and (not title.isExternal) and (not title.exists) then
if title and (not title.isExternal) then
category = mw.ustring.format('[[Category:%s]]', catMissing)
local success, exists = pcall(function() return title.exists end)
if success and not exists then
category = mw.ustring.format('[[Category:%s]]', catMissing)
end
end
end
end
end