Module:Authority control
Appearance
![]() | This Lua module is used on approximately 2,180,000 pages, or roughly 3% of all pages. To avoid major disruption and server load, any changes should be tested in the module's /sandbox or /testcases subpages, or in your own module sandbox. The tested changes can be added to this page in a single edit. Consider discussing changes on the talk page before implementing them. |
![]() | This module is rated as ready for general use. It has reached a mature form and is thought to be relatively bug-free and ready for use wherever appropriate. It is ready to mention on help pages and other Wikipedia resources as an option for new users to learn. To reduce server load and bad output, it should be improved by sandbox testing rather than repeated trial-and-error editing. |
![]() | This module is subject to page protection. It is a highly visible module in use by a very large number of pages, or is substituted very frequently. Because vandalism or mistakes would affect many pages, and even trivial editing might cause substantial load on the servers, it is protected from editing. |
Wikipedia authority control |
---|
![]() | This module depends on the following other modules: |
This module contains the code for the {{Authority control}} template.
Please see Template:Authority control/doc.
function outputError( message, cat )
local str = '<span class="error">' .. message .. '</span>'
if cat then
str = str .. '[[Category:' .. cat .. ']]'
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)' )
end
return '<span class="uid">[http://viaf.org/viaf/' .. id .. ' ' .. id .. ']</span>'
end
local config = {
{ 'VIAF', '[[Virtual International Authority File|VIAF]]', 0, viafLink }
}
local p = {}
function p.authorityControl( frame )
local parentArgs = frame.getParent().args
--Create rows
local lines = {}
for k, conf in config do
if parentArgs[conf[0]] and parentArgs[conf[0]] ~= '' then
table.append( lines, conf[1] .. ': ' .. conf[3]( parentArgs[conf[0]] ) )
end
end
local Navbox = require('Module:Navbox')
return navbox._navbox( {
name = 'Authority control',
bodyclass = 'hlist',
group1 = '[[Authority control]]',
list1 = table.concat( lines, '*' )
} )
end