Open main menu

Changes

Module:Authority control

477 bytes added, 07:21, 6 April 2013
no edit summary
function outputErrorgetCatForId( message, cat id ) local str title = mw.title.getCurrentTitle() local namespace = title.namespace if namespace == 0 then return '<span class="error">[[Category:Wikipedia articles with ' .. message id .. '</span>identifiers]]' if cat elseif namespace == 2 and not title.isSubpage then str = str return '[[Category:User pages with ' .. id .. ' identifiers]]' else return '[[Category:Miscellaneous pages with ' .. cat id .. 'identifiers]]'
end
return str
end
function viafLink( id )
if not string.match( id, '^%d+$' ) then
return outputError( 'The VIAF id ' .. id .. ' is not valid.', 'Wikipedia articles with faulty authority control identifiers (VIAF)' )false
end
return '<span class="uid">[http://viaf.org/viaf/' .. id .. ' ' .. id .. ']</span>'
end
local elements = {}
for k, params in pairs( conf ) do
if local val = parentArgs[params[1]] if val and parentArgs[params[1]] val ~= '' then local link = params[4]( val ) if link then table.insert( elements, params[2] .. ': <span class="uid">' .. link .. '</span>' .. getCatForId( params[41]) ) else table.insert( parentArgselements, '<span class="error">The ' .. params[1] .. ' id ' .. val .. ' is not valid.</span>[[Category:Wikipedia articles with faulty authority control identifiers (' .. params[1] .. ')]] ' ) ) end
end
end
Anonymous user