<?xml version="1.0"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en">
	<id>https://docs.tcsdcc.com/index.php?action=history&amp;feed=atom&amp;title=Module%3AAuthority_control</id>
	<title>Module:Authority control - Revision history</title>
	<link rel="self" type="application/atom+xml" href="https://docs.tcsdcc.com/index.php?action=history&amp;feed=atom&amp;title=Module%3AAuthority_control"/>
	<link rel="alternate" type="text/html" href="https://docs.tcsdcc.com/index.php?title=Module:Authority_control&amp;action=history"/>
	<updated>2026-04-04T02:41:31Z</updated>
	<subtitle>Revision history for this page on the wiki</subtitle>
	<generator>MediaWiki 1.40.4</generator>
	<entry>
		<id>https://docs.tcsdcc.com/index.php?title=Module:Authority_control&amp;diff=3976&amp;oldid=prev</id>
		<title>Tcsdcc: 1 revision imported</title>
		<link rel="alternate" type="text/html" href="https://docs.tcsdcc.com/index.php?title=Module:Authority_control&amp;diff=3976&amp;oldid=prev"/>
		<updated>2019-12-16T16:09:48Z</updated>

		<summary type="html">&lt;p&gt;1 revision imported&lt;/p&gt;
&lt;table style=&quot;background-color: #fff; color: #202122;&quot; data-mw=&quot;interface&quot;&gt;
				&lt;tr class=&quot;diff-title&quot; lang=&quot;en&quot;&gt;
				&lt;td colspan=&quot;1&quot; style=&quot;background-color: #fff; color: #202122; text-align: center;&quot;&gt;← Older revision&lt;/td&gt;
				&lt;td colspan=&quot;1&quot; style=&quot;background-color: #fff; color: #202122; text-align: center;&quot;&gt;Revision as of 16:09, 16 December 2019&lt;/td&gt;
				&lt;/tr&gt;&lt;tr&gt;&lt;td colspan=&quot;2&quot; class=&quot;diff-notice&quot; lang=&quot;en&quot;&gt;&lt;div class=&quot;mw-diff-empty&quot;&gt;(No difference)&lt;/div&gt;
&lt;/td&gt;&lt;/tr&gt;&lt;/table&gt;</summary>
		<author><name>Tcsdcc</name></author>
	</entry>
	<entry>
		<id>https://docs.tcsdcc.com/index.php?title=Module:Authority_control&amp;diff=3975&amp;oldid=prev</id>
		<title>mwmain&gt;Jonesey95: update regex based on the check used at Wikidata</title>
		<link rel="alternate" type="text/html" href="https://docs.tcsdcc.com/index.php?title=Module:Authority_control&amp;diff=3975&amp;oldid=prev"/>
		<updated>2019-12-13T04:31:25Z</updated>

		<summary type="html">&lt;p&gt;update regex based on the check used at Wikidata&lt;/p&gt;
&lt;a href=&quot;https://docs.tcsdcc.com/index.php?title=Module:Authority_control&amp;amp;diff=3975&amp;amp;oldid=21&quot;&gt;Show changes&lt;/a&gt;</summary>
		<author><name>mwmain&gt;Jonesey95</name></author>
	</entry>
	<entry>
		<id>https://docs.tcsdcc.com/index.php?title=Module:Authority_control&amp;diff=21&amp;oldid=prev</id>
		<title>Tcsdcc: 1 revision imported</title>
		<link rel="alternate" type="text/html" href="https://docs.tcsdcc.com/index.php?title=Module:Authority_control&amp;diff=21&amp;oldid=prev"/>
		<updated>2018-04-24T16:47:03Z</updated>

		<summary type="html">&lt;p&gt;1 revision imported&lt;/p&gt;
&lt;table style=&quot;background-color: #fff; color: #202122;&quot; data-mw=&quot;interface&quot;&gt;
				&lt;tr class=&quot;diff-title&quot; lang=&quot;en&quot;&gt;
				&lt;td colspan=&quot;1&quot; style=&quot;background-color: #fff; color: #202122; text-align: center;&quot;&gt;← Older revision&lt;/td&gt;
				&lt;td colspan=&quot;1&quot; style=&quot;background-color: #fff; color: #202122; text-align: center;&quot;&gt;Revision as of 16:47, 24 April 2018&lt;/td&gt;
				&lt;/tr&gt;&lt;tr&gt;&lt;td colspan=&quot;2&quot; class=&quot;diff-notice&quot; lang=&quot;en&quot;&gt;&lt;div class=&quot;mw-diff-empty&quot;&gt;(No difference)&lt;/div&gt;
&lt;/td&gt;&lt;/tr&gt;&lt;/table&gt;</summary>
		<author><name>Tcsdcc</name></author>
	</entry>
	<entry>
		<id>https://docs.tcsdcc.com/index.php?title=Module:Authority_control&amp;diff=20&amp;oldid=prev</id>
		<title>imported&gt;Elegie: Use HTTPS for the CiNii and NKC (National Library of the Czech Republic) links in order to provide increased privacy and security for users. (From what it appears, accessing an HTTP version of a link generates a 301 redirect to an HTTPS ve...</title>
		<link rel="alternate" type="text/html" href="https://docs.tcsdcc.com/index.php?title=Module:Authority_control&amp;diff=20&amp;oldid=prev"/>
		<updated>2018-04-14T07:37:38Z</updated>

		<summary type="html">&lt;p&gt;Use HTTPS for the CiNii and NKC (National Library of the Czech Republic) links in order to provide increased privacy and security for users. (From what it appears, accessing an HTTP version of a link generates a &lt;a href=&quot;/index.php?title=HTTP_301&amp;amp;action=edit&amp;amp;redlink=1&quot; class=&quot;new&quot; title=&quot;HTTP 301 (page does not exist)&quot;&gt;301 redirect&lt;/a&gt; to an HTTPS ve...&lt;/p&gt;
&lt;p&gt;&lt;b&gt;New page&lt;/b&gt;&lt;/p&gt;&lt;div&gt;require('Module:No globals')&lt;br /&gt;
&lt;br /&gt;
local function getCatForId( id )&lt;br /&gt;
	local title = mw.title.getCurrentTitle()&lt;br /&gt;
	local namespace = title.namespace&lt;br /&gt;
	if namespace == 0 then&lt;br /&gt;
		return '[[Category:Wikipedia articles with ' .. id .. ' identifiers]]'&lt;br /&gt;
	elseif namespace == 2 and not title.isSubpage then&lt;br /&gt;
		return '[[Category:User pages with ' .. id .. ' identifiers]]'&lt;br /&gt;
	else&lt;br /&gt;
		return '[[Category:Miscellaneous pages with ' .. id .. ' identifiers]]'&lt;br /&gt;
	end&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
local function viafLink( id )&lt;br /&gt;
	if not string.match( id, '^%d+$' ) then&lt;br /&gt;
		return false&lt;br /&gt;
	end&lt;br /&gt;
	return '[https://viaf.org/viaf/' .. id .. ' ' .. id .. ']' .. getCatForId( 'VIAF' )&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
local function kulturnavLink( id )&lt;br /&gt;
	return '[http://kulturnav.org/' .. id .. ' ' .. id .. ']'&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
local function sikartLink( id )&lt;br /&gt;
	return '[http://www.sikart.ch/KuenstlerInnen.aspx?id=' .. id .. '&amp;amp;lng=en ' .. id .. ']'&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
local function tlsLink( id )&lt;br /&gt;
	local id2 = id:gsub(' +', '_')&lt;br /&gt;
	return '[http://tls.theaterwissenschaft.ch/wiki/' .. id2 .. ' ' .. id .. ']'&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
local function ciniiLink( id )&lt;br /&gt;
	return '[https://ci.nii.ac.jp/author/' .. id .. '?l=en ' .. id .. ']'&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
local function bneLink( id )&lt;br /&gt;
	return '[http://catalogo.bne.es/uhtbin/authoritybrowse.cgi?action=display&amp;amp;authority_id=' .. id .. ' ' .. id .. ']'&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
local function uscongressLink( id )&lt;br /&gt;
	return '[http://bioguide.congress.gov/scripts/biodisplay.pl?index=' .. id .. ' ' .. id .. ']'&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
local function narapersonLink( id )&lt;br /&gt;
	return '[https://research.archives.gov/person/' .. id .. ' ' .. id .. ']'&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
local function naraorganizationLink( id )&lt;br /&gt;
	return '[https://research.archives.gov/organization/' .. id .. ' ' .. id .. ']'&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
local function botanistLink( id )&lt;br /&gt;
	local id2 = id:gsub(' +', '%%20')&lt;br /&gt;
	return '[http://www.ipni.org/ipni/advAuthorSearch.do?find_abbreviation=' .. id2 .. ' ' .. id .. ']'&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
local function mgpLink( id )&lt;br /&gt;
	-- TODO Implement some sanity checking regex&lt;br /&gt;
	return '[http://www.genealogy.ams.org/id.php?id=' .. id .. ' ' .. id .. ']'&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
local function rslLink( id )&lt;br /&gt;
	-- TODO Implement some sanity checking regex&lt;br /&gt;
	return '[http://aleph.rsl.ru/F?func=find-b&amp;amp;find_code=SYS&amp;amp;adjacent=Y&amp;amp;local_base=RSL11&amp;amp;request=' .. id .. '&amp;amp;CON_LNG=ENG ' .. id .. ']'&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
local function leonoreLink( id )&lt;br /&gt;
-- Identifiants allant de LH/1/1 à LH/2794/54 (légionnaires)&lt;br /&gt;
-- Identifiants allant de C/0/1 à C/0/84 (84 légionnaires célèbres)&lt;br /&gt;
-- Identifiants allant de 19800035/1/1 à 19800035/385/51670 (légionnaires décédés entre 1954 et 1977, et quelques dossiers de légionnaires décédés avant 1954)&lt;br /&gt;
	if not string.match( id, '^LH/%d%d?%d?%d?/%d%d?%d?$' ) and&lt;br /&gt;
	   not string.match( id, '^C/0/%d%d?$' ) and&lt;br /&gt;
	   not string.match( id, '^19800035/%d%d?%d?%d?/%d%d?%d?%d?%d?$' ) then&lt;br /&gt;
		return false&lt;br /&gt;
	end&lt;br /&gt;
	return '[http://www.culture.gouv.fr/public/mistral/leonore_fr?ACTION=CHERCHER&amp;amp;FIELD_1=COTE&amp;amp;VALUE_1=' .. id .. ' ' .. id .. ']'&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
local function sbnLink( id )&lt;br /&gt;
	if not string.match( id, '^IT\\ICCU\\%d%d%d%d%d%d%d%d%d%d$' ) and not string.match( id, '^IT\\ICCU\\%u%u[%d%u]%u\\%d%d%d%d%d%d$' ) then&lt;br /&gt;
		return false&lt;br /&gt;
	end&lt;br /&gt;
	return '[http://opac.sbn.it/opacsbn/opac/iccu/scheda_authority.jsp?bid=' .. id .. ' ' .. id .. ']' .. getCatForId( 'SBN' )&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
local function nkcLink( id )&lt;br /&gt;
	return '[https://aleph.nkp.cz/F/?func=find-c&amp;amp;local_base=aut&amp;amp;ccl_term=ica=' .. id .. '&amp;amp;CON_LNG=ENG ' .. id .. ']'&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
local function nclLink( id )&lt;br /&gt;
	if not string.match( id, '^%d+$' ) then&lt;br /&gt;
		return false&lt;br /&gt;
	end&lt;br /&gt;
	return '[http://aleweb.ncl.edu.tw/F/?func=accref&amp;amp;acc_sequence=' .. id .. '&amp;amp;CON_LNG=ENG ' .. id .. ']'&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
local function ndlLink( id )&lt;br /&gt;
	return '[https://id.ndl.go.jp/auth/ndlna/' .. id .. ' ' .. id .. ']'&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
local function sudocLink( id )&lt;br /&gt;
	if not string.match( id, '^%d%d%d%d%d%d%d%d[%dxX]$' ) then&lt;br /&gt;
		return false&lt;br /&gt;
	end&lt;br /&gt;
	return '[https://www.idref.fr/' .. id .. ' ' .. id .. ']'&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
local function hlsLink( id )&lt;br /&gt;
	if not string.match( id, '^%d+$' ) then&lt;br /&gt;
		return false&lt;br /&gt;
	end&lt;br /&gt;
	return '[http://www.hls-dhs-dss.ch/textes/f/F' .. id .. '.php ' .. id .. ']'&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
local function lirLink( id )&lt;br /&gt;
	if not string.match( id, '^%d+$' ) then&lt;br /&gt;
		return false&lt;br /&gt;
	end&lt;br /&gt;
	return '[http://www.e-lir.ch/e-LIR___Lexicon.' .. id .. '.450.0.html ' .. id .. ']'&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
local function splitLccn( id )&lt;br /&gt;
	if id:match( '^%l%l?%l?%d%d%d%d%d%d%d%d%d?%d?$' ) then&lt;br /&gt;
		id = id:gsub( '^(%l+)(%d+)(%d%d%d%d%d%d)$', '%1/%2/%3' )&lt;br /&gt;
	end&lt;br /&gt;
	if id:match( '^%l%l?%l?/%d%d%d?%d?/%d+$' ) then&lt;br /&gt;
		return mw.text.split( id, '/' )&lt;br /&gt;
	end&lt;br /&gt;
	return false&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
local function append(str, c, length)&lt;br /&gt;
	while str:len() &amp;lt; length do&lt;br /&gt;
		str = c .. str&lt;br /&gt;
	end&lt;br /&gt;
	return str&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
local function lccnLink( id )&lt;br /&gt;
	local parts = splitLccn( id )&lt;br /&gt;
	if not parts then&lt;br /&gt;
		return false&lt;br /&gt;
	end&lt;br /&gt;
	local lccnType = parts[1] ~= 'sh' and 'names' or 'subjects'&lt;br /&gt;
	id = parts[1] .. parts[2] .. append( parts[3], '0', 6 )&lt;br /&gt;
	return '[http://id.loc.gov/authorities/' .. lccnType .. '/' .. id .. ' ' .. id .. ']' .. getCatForId( 'LCCN' )&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
local function mbLink( id )&lt;br /&gt;
	-- TODO Implement some sanity checking regex&lt;br /&gt;
	return '[https://musicbrainz.org/artist/' .. id .. ' ' .. id .. ']' .. getCatForId( 'MusicBrainz' )&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
--Returns the ISNI check digit isni must be a string where the 15 first elements are digits&lt;br /&gt;
local function getIsniCheckDigit( isni )&lt;br /&gt;
	local total = 0&lt;br /&gt;
	for i = 1, 15 do&lt;br /&gt;
		local digit = isni:byte( i ) - 48 --Get integer value&lt;br /&gt;
		total = (total + digit) * 2&lt;br /&gt;
	end&lt;br /&gt;
	local remainder = total % 11&lt;br /&gt;
	local result = (12 - remainder) % 11&lt;br /&gt;
	if result == 10 then&lt;br /&gt;
		return &amp;quot;X&amp;quot;&lt;br /&gt;
	end&lt;br /&gt;
	return tostring( result )&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
--Validate ISNI (and ORCID) and retuns it as a 16 characters string or returns false if it's invalid&lt;br /&gt;
--See http://support.orcid.org/knowledgebase/articles/116780-structure-of-the-orcid-identifier&lt;br /&gt;
local function validateIsni( id )&lt;br /&gt;
	id = id:gsub( '[ %-]', '' ):upper()&lt;br /&gt;
	if not id:match( '^%d%d%d%d%d%d%d%d%d%d%d%d%d%d%d[%dX]$' ) then&lt;br /&gt;
		return false&lt;br /&gt;
	end&lt;br /&gt;
	if getIsniCheckDigit( id ) ~= string.char( id:byte( 16 ) ) then&lt;br /&gt;
		return false&lt;br /&gt;
	end&lt;br /&gt;
	return id&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
local function isniLink( id )&lt;br /&gt;
	id = validateIsni( id )&lt;br /&gt;
	if not id then&lt;br /&gt;
		return false&lt;br /&gt;
	end&lt;br /&gt;
	return '[http://isni.org/isni/' .. id .. ' ' .. id:sub( 1, 4 ) .. ' ' .. id:sub( 5, 8 ) .. ' '  .. id:sub( 9, 12 ) .. ' '  .. id:sub( 13, 16 ) .. ']' .. getCatForId( 'ISNI' )&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
local function orcidLink( id )&lt;br /&gt;
	id = validateIsni( id )&lt;br /&gt;
	if not id then&lt;br /&gt;
		return false&lt;br /&gt;
	end&lt;br /&gt;
	id = id:sub( 1, 4 ) .. '-' .. id:sub( 5, 8 ) .. '-'  .. id:sub( 9, 12 ) .. '-'  .. id:sub( 13, 16 )&lt;br /&gt;
	return '[https://orcid.org/' .. id .. ' ' .. id .. ']' .. getCatForId( 'ORCID' )&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
local function gndLink( id )&lt;br /&gt;
	return '[https://d-nb.info/gnd/' .. id .. ' ' .. id .. ']' .. getCatForId( 'GND' )&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
local function selibrLink( id )&lt;br /&gt;
	if not string.match( id, '^%d+$' ) then&lt;br /&gt;
		return false&lt;br /&gt;
	end&lt;br /&gt;
	return '[https://libris.kb.se/auth/' .. id .. ' ' .. id .. ']' .. getCatForId( 'SELIBR' )&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
local function bnfLink( id )&lt;br /&gt;
	--Add cb prefix if it has been removed&lt;br /&gt;
	if not string.match( id, '^cb.+$' ) then&lt;br /&gt;
		id = 'cb' .. id&lt;br /&gt;
	end&lt;br /&gt;
&lt;br /&gt;
	return '[http://catalogue.bnf.fr/ark:/12148/' .. id .. ' ' .. id .. '] [http://data.bnf.fr/ark:/12148/' .. id .. ' (data)]' .. getCatForId( 'BNF' )&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
local function bpnLink( id )&lt;br /&gt;
	if not string.match( id, '^%d+$' ) then&lt;br /&gt;
		return false&lt;br /&gt;
	end&lt;br /&gt;
	return '[http://www.biografischportaal.nl/en/persoon/' .. id .. ' ' .. id .. ']' .. getCatForId( 'BPN' )&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
local function ridLink( id )&lt;br /&gt;
	return '[https://www.researcherid.com/rid/' .. id .. ' ' .. id .. ']' .. getCatForId( 'RID' )&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
local function bibsysLink( id )&lt;br /&gt;
	return '[https://authority.bibsys.no/authority/rest/authorities/html/' .. id .. ' ' .. id .. ']' .. getCatForId( 'BIBSYS' )&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
local function ulanLink( id )&lt;br /&gt;
	return '[https://www.getty.edu/vow/ULANFullDisplay?find=&amp;amp;role=&amp;amp;nation=&amp;amp;subjectid=' .. id .. ' ' .. id .. ']' .. getCatForId( 'ULAN' )&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
local function nlaLink( id )&lt;br /&gt;
	return '[https://nla.gov.au/anbd.aut-an' .. id .. ' ' .. id .. ']' .. getCatForId( 'NLA' )&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
local function rkdartistsLink( id )&lt;br /&gt;
	return '[https://rkd.nl/en/explore/artists/' .. id .. ' ' .. id .. ']' .. getCatForId( 'RKDartists' )&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
local function snacLink( id )&lt;br /&gt;
	return '[http://socialarchive.iath.virginia.edu/ark:/99166/' .. id .. ' ' .. id .. ']' .. getCatForId( 'SNAC-ID' )&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
local function dblpLink( id )&lt;br /&gt;
	return '[https://dblp.org/pid/' .. id .. ' ' .. id .. ']' .. getCatForId( 'DBLP' )&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
local function acmLink( id )&lt;br /&gt;
	return '[https://dl.acm.org/author_page.cfm?id=' .. id .. ' ' .. id .. ']' .. getCatForId( 'ACM-DL' )&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
local function autoresuyLink( id )&lt;br /&gt;
	return '[http://autores.uy/autor/' .. id .. ' ' .. id .. ']' ..  getCatForId( 'autores.uy' )&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
local function picLink( id )&lt;br /&gt;
	return '[https://pic.nypl.org/constituents/' .. id .. ' ' .. id .. ']' .. getCatForId( 'PIC' )&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
local function getIdsFromWikidata( itemId, property )&lt;br /&gt;
	local ids = {}&lt;br /&gt;
	local statements = mw.wikibase.getBestStatements( itemId, property )&lt;br /&gt;
	if statements then&lt;br /&gt;
		for _, statement in ipairs( statements ) do&lt;br /&gt;
			if statement.mainsnak.datavalue then&lt;br /&gt;
				table.insert( ids, statement.mainsnak.datavalue.value )&lt;br /&gt;
			end&lt;br /&gt;
		end&lt;br /&gt;
	end&lt;br /&gt;
	return ids&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
local function matchesWikidataRequirements( itemId, reqs )&lt;br /&gt;
	for _, group in ipairs( reqs ) do&lt;br /&gt;
		local property = 'P' .. group[1]&lt;br /&gt;
		local qid = group[2]&lt;br /&gt;
		local statements = mw.wikibase.getBestStatements( itemId, property )&lt;br /&gt;
		if statements ~= nil then&lt;br /&gt;
			for _, statement in ipairs( statements ) do&lt;br /&gt;
				if statement.mainsnak.datavalue ~= nil then&lt;br /&gt;
					if statement.mainsnak.datavalue.value['numeric-id'] == qid then&lt;br /&gt;
						return true&lt;br /&gt;
					end&lt;br /&gt;
				end&lt;br /&gt;
			end&lt;br /&gt;
		end&lt;br /&gt;
	end&lt;br /&gt;
	return false&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
local function createRow( id, label, rawValue, link, withUid )&lt;br /&gt;
	if link then&lt;br /&gt;
		if withUid then&lt;br /&gt;
			return '*&amp;lt;span class=&amp;quot;nowrap&amp;quot;&amp;gt;' .. label .. ' &amp;lt;span class=&amp;quot;uid&amp;quot;&amp;gt;' .. link .. '&amp;lt;/span&amp;gt;&amp;lt;/span&amp;gt;\n'&lt;br /&gt;
		else&lt;br /&gt;
			return '*&amp;lt;span class=&amp;quot;nowrap&amp;quot;&amp;gt;' .. label .. ' ' .. link .. '&amp;lt;/span&amp;gt;\n'&lt;br /&gt;
		end&lt;br /&gt;
	else&lt;br /&gt;
		return '* &amp;lt;span class=&amp;quot;error&amp;quot;&amp;gt;The ' .. id .. ' id ' .. rawValue .. ' is not valid.&amp;lt;/span&amp;gt;[[Category:Wikipedia articles with faulty authority control identifiers (' .. id .. ')]]\n'&lt;br /&gt;
	end&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
--In this order: name of the parameter, label, propertyId in Wikidata, formatting function&lt;br /&gt;
local conf = {&lt;br /&gt;
	{ 'VIAF', '[[Virtual International Authority File|VIAF]]', 214, viafLink },&lt;br /&gt;
	{ 'LCCN', '[[Library of Congress Control Number|LCCN]]', 244, lccnLink },&lt;br /&gt;
	{ 'ISNI', '[[International Standard Name Identifier|ISNI]]', 213, isniLink },&lt;br /&gt;
	{ 'ORCID', '[[ORCID]]', 496, orcidLink },&lt;br /&gt;
	{ 'GND', '[[Integrated Authority File|GND]]', 227, gndLink },&lt;br /&gt;
	{ 'SELIBR', '[[LIBRIS|SELIBR]]', 906, selibrLink },&lt;br /&gt;
	{ 'SUDOC', '[[Système universitaire de documentation|SUDOC]]', 269, sudocLink },&lt;br /&gt;
	{ 'BNF', '[[Bibliothèque nationale de France|BNF]]', 268, bnfLink },&lt;br /&gt;
	{ 'BPN', '[[Biografisch Portaal|BPN]]', 651, bpnLink },&lt;br /&gt;
	{ 'RID', '[[ResearcherID]]', 1053, ridLink },&lt;br /&gt;
	{ 'BIBSYS', '[[BIBSYS]]', 1015, bibsysLink },&lt;br /&gt;
	{ 'ULAN', '[[Union List of Artist Names|ULAN]]', 245, ulanLink },&lt;br /&gt;
	{ 'HDS', '[[Historical Dictionary of Switzerland|HDS]]', 902, hlsLink },&lt;br /&gt;
	{ 'LIR', '[[Historical Dictionary of Switzerland#Lexicon_Istoric_Retic|LIR]]', 886, lirLink },&lt;br /&gt;
	{ 'MBA', '[[MusicBrainz]]', 434, mbLink },&lt;br /&gt;
	{ 'MGP', '[[Mathematics Genealogy Project|MGP]]', 549, mgpLink },&lt;br /&gt;
	{ 'NLA', '[[National Library of Australia|NLA]]', 409, nlaLink },&lt;br /&gt;
	{ 'NDL', '[[National Diet Library|NDL]]', 349, ndlLink },&lt;br /&gt;
	{ 'NCL', '[[National Central Library|NCL]]', 1048, nclLink },&lt;br /&gt;
	{ 'NKC', '[[National Library of the Czech Republic|NKC]]', 691, nkcLink },&lt;br /&gt;
	{ 'Léonore', '[[Base Léonore|Léonore]]', 640, leonoreLink },&lt;br /&gt;
	{ 'SBN', '[[Istituto Centrale per il Catalogo Unico|ICCU]]', 396, sbnLink },&lt;br /&gt;
	{ 'RLS', '[[Russian State Library|RLS]]', 947, rslLink },&lt;br /&gt;
	{ 'Botanist', '[[Author citation (botany)|Botanist]]', 428, botanistLink },&lt;br /&gt;
	{ 'NARA-person', '[[National Archives and Records Administration|NARA]]', 1222, narapersonLink },&lt;br /&gt;
	{ 'NARA-organization', '[[National Archives and Records Administration|NARA]]', 1223, naraorganizationLink },&lt;br /&gt;
	{ 'USCongress', '[[Biographical Directory of the United States Congress|US Congress]]', 1157, uscongressLink },&lt;br /&gt;
	{ 'BNE', '[[Biblioteca Nacional de España|BNE]]', 950, bneLink },&lt;br /&gt;
	{ 'CINII', '[[CiNii]]', 271, ciniiLink },&lt;br /&gt;
	{ 'TLS', '[[Theaterlexikon der Schweiz|TLS]]', 1362, tlsLink },&lt;br /&gt;
	{ 'SIKART', '[[SIKART]]', 781, sikartLink },&lt;br /&gt;
	{ 'KULTURNAV', '[[KulturNav]]', 1248, kulturnavLink },&lt;br /&gt;
	{ 'RKDartists', '[[Netherlands Institute for Art History#Online artist pages|RKD]]', 650, rkdartistsLink },&lt;br /&gt;
	{ 'SNAC-ID', '[[SNAC]]', 3430, snacLink },&lt;br /&gt;
	{ 'DBLP', '[[DBLP]]', 2456, dblpLink },&lt;br /&gt;
	{ 'ACM-DL', '[[ACM Digital Library|ACM DL]]', 864, acmLink },&lt;br /&gt;
	{ 'autores.uy', '[[autores.uy]]', 2558, autoresuyLink },&lt;br /&gt;
	{ 'PIC', '[[:d:Q23892012|PIC]]', 2750, picLink },&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
-- Check that the Wikidata item has this property--&amp;gt;value before adding it&lt;br /&gt;
local reqs = {}&lt;br /&gt;
&lt;br /&gt;
local p = {}&lt;br /&gt;
&lt;br /&gt;
function p.authorityControl( frame )&lt;br /&gt;
	local parentArgs = frame:getParent().args&lt;br /&gt;
	--Create rows&lt;br /&gt;
	local elements = {}&lt;br /&gt;
&lt;br /&gt;
	--redirect PND to GND&lt;br /&gt;
	if (parentArgs.GND == nil or parentArgs.GND == '') and parentArgs.PND ~= nil and parentArgs.PND ~= '' then&lt;br /&gt;
		parentArgs.GND = parentArgs.PND&lt;br /&gt;
	end&lt;br /&gt;
&lt;br /&gt;
	--Wikidata fallback if requested&lt;br /&gt;
	local itemId = mw.wikibase.getEntityIdForCurrentPage()&lt;br /&gt;
	if itemId ~= nil then&lt;br /&gt;
		for _, params in ipairs( conf ) do&lt;br /&gt;
			if params[3] ~= 0 then&lt;br /&gt;
				local val = parentArgs[params[1]]&lt;br /&gt;
				if not val or val == '' then&lt;br /&gt;
					local canUseWikidata = nil&lt;br /&gt;
					if reqs[params[1]] ~= nil then&lt;br /&gt;
						canUseWikidata = matchesWikidataRequirements( itemId, reqs[params[1]] )&lt;br /&gt;
					else&lt;br /&gt;
						canUseWikidata = true&lt;br /&gt;
					end&lt;br /&gt;
					if canUseWikidata then&lt;br /&gt;
						local wikidataIds = getIdsFromWikidata( itemId, 'P' .. params[3] )&lt;br /&gt;
						if wikidataIds[1] then&lt;br /&gt;
							parentArgs[params[1]] = wikidataIds[1]&lt;br /&gt;
						end&lt;br /&gt;
					end&lt;br /&gt;
				end&lt;br /&gt;
			end&lt;br /&gt;
		end&lt;br /&gt;
	end&lt;br /&gt;
&lt;br /&gt;
	--Worldcat&lt;br /&gt;
	if parentArgs['WORLDCATID'] and parentArgs['WORLDCATID'] ~= '' then&lt;br /&gt;
		table.insert( elements, createRow( 'WORLDCATID', '', parentArgs['WORLDCATID'], '[https://www.worldcat.org/identities/' .. parentArgs['WORLDCATID'] .. ' WorldCat Identities]', false ) ) --Validation?&lt;br /&gt;
	elseif parentArgs['VIAF'] and string.match( parentArgs['VIAF'], '^%d+$' ) then -- Hackishly copy the validation code; this should go away when we move to using P1793 and P1630&lt;br /&gt;
		table.insert( elements, createRow( 'VIAF', '', parentArgs['VIAF'], '[https://www.worldcat.org/identities/containsVIAFID/' .. parentArgs['VIAF'] .. ' WorldCat Identities]', false ) )&lt;br /&gt;
	elseif parentArgs['LCCN'] and parentArgs['LCCN'] ~= '' then&lt;br /&gt;
		local lccnParts = splitLccn( parentArgs['LCCN'] )&lt;br /&gt;
		if lccnParts and lccnParts[1] ~= 'sh' then&lt;br /&gt;
			table.insert( elements, createRow( 'LCCN', '', parentArgs['LCCN'], '[https://www.worldcat.org/identities/lccn-' .. lccnParts[1] .. lccnParts[2] .. '-' .. lccnParts[3] .. ' WorldCat Identities]', false ) )&lt;br /&gt;
		end&lt;br /&gt;
	end&lt;br /&gt;
&lt;br /&gt;
	--Configured rows&lt;br /&gt;
	local rct = 0&lt;br /&gt;
	for _, params in ipairs( conf ) do&lt;br /&gt;
		local val = parentArgs[params[1]]&lt;br /&gt;
		if val and val ~= '' then&lt;br /&gt;
			table.insert( elements, createRow( params[1], params[2] .. ':', val, params[4]( val ), true ) )&lt;br /&gt;
			rct = rct + 1&lt;br /&gt;
		end&lt;br /&gt;
	end&lt;br /&gt;
	local Navbox = require('Module:Navbox')&lt;br /&gt;
	local elementscats = ''&lt;br /&gt;
	if rct &amp;gt; 13 then&lt;br /&gt;
		elementscats  = '[[Category:AC with ' .. rct .. ' elements]]'&lt;br /&gt;
	end&lt;br /&gt;
&lt;br /&gt;
	if #elements ~= 0 then&lt;br /&gt;
		return Navbox._navbox( {&lt;br /&gt;
			name  = 'Authority control',&lt;br /&gt;
			bodyclass = 'hlist',&lt;br /&gt;
			group1 = '[[Help:Authority control|Authority control]]' .. elementscats,&lt;br /&gt;
			list1 = table.concat( elements )&lt;br /&gt;
			} )&lt;br /&gt;
	else&lt;br /&gt;
		return &amp;quot;&amp;quot;&lt;br /&gt;
	end&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
return p&lt;/div&gt;</summary>
		<author><name>imported&gt;Elegie</name></author>
	</entry>
</feed>