Documentation[voir] [modifier] [historique] [purger]

Utilisation

Fonctions exportables :

  • authorityControl(frame) – Point d'entrée pour le modèle {{Autorité}}

Exemples

Voir {{Autorité}}

local wd = require( 'Module:Wikidata' )
local Outils = require( 'Module:Outils' )

--nombre maximum de référence "autorité" qui doivent être affichée. La valeur de 18 a été acté par défaut en 2017.
local nbMaxReferenceParPage = 18

local function blbnbUrl( id )
	if not id:match( '^%d%d%d%d%d%d%d%d%d$' ) then
		return false
	end
	return 'http://acervo.bn.br/sophia_web/autoridade/detalhe/' .. id
end

local function nlgUrl( id )
	if not id:match( '^[1-9]%d*$' ) then
		return false
	end
	return 'https://catalogue.nlg.gr/Authority/Record?id=au.' .. id
end

local function bneUrl( id )
	if id:match( '^XX%d%d%d%d%d?%d?%d?$' ) then
		return 'http://catalogo.bne.es/uhtbin/authoritybrowse.cgi?action=display&authority_id=' .. id
	elseif ( id:match( '^[Mb]ise%d%d%d%d%d%d%d%d%d%d$' ) or id:match( '^bivi%d%d%d%d%d%d%d%d%d%d$' ) ) then
		return 'https://datos.bne.es/edicion/' .. id
	else
		return false
	end
end

local function sbnUrl( id )
	if not id:match( '^%u%u[%u%d]%u%d%d%d%d%d%d$' ) then
		return false
	end
	return 'https://opac.sbn.it/nome/' .. id
end

local function ndlUrl( id )
	if not id:match( '^0?%d%d%d%d%d%d%d%d$' ) then
		return false
	end
	return 'https://id.ndl.go.jp/auth/ndlna/' .. id
end

local function ntaUrl( id )
	if not id:match( '^%d%d%d%d%d%d%d%d.$' ) then
		return false
	end
	return 'http://data.bibliotheken.nl/id/thes/p' .. id
end

local function nlpUrl( id )
	-- nouveau format valide (P7293) - 981[0-9]{8}05606 : 981066973640560
	-- ou ancien format Wikidata (P1695) - A[0-9]{7}[0-9X] modifié depuis 2023 en a[0-9]{13}
	if id:match( '^981%d%d%d%d%d%d%d%d05606$' ) or id:match( '^a%d%d%d%d%d%d%d%d%d%d%d%d%d$' ) then
		return 'https://dbn.bn.org.pl/descriptor-details/' .. id
	else
		return false
	end
end

local function nliUrl( id )
	if not id:match( '^9870[01]%d%d%d%d%d%d%d%d05171$' ) then
		return false
	end
	return 'http://olduli.nli.org.il/F/?func=find-b&local_base=NLX10&find_code=UID&request=' .. id
end

local function nukatUrl( id )
	if not id:match( '^n%d%d%d%d%d%d%d%d$' ) and not id:match( '^n%d%d%d%d%d%d%d%d%d%d$' ) and 
	   not id:match( '^p %d%d%d%d%d%d%d%d$' ) and not id:match( '^p %d%d%d%d%d%d%d%d%d%d$' ) and 
	   not id:match( '^s  %d%d%d%d%d%d%d%d$' ) and not id:match( '^s  %d%d%d%d%d%d%d%d%d%d$' ) then
		return false
	end
	id = id:gsub( ' ', '%%20' ) -- pour les ids commencent par s ou p
	if id:len() == 9 then
		id = id:gsub( 'n', 'n%%20%%20' ) -- pour les ids commencent par n
	else 
		id = id:gsub( 'n', 'n%%20' ) -- pour les ids commencent par n20
	end
	return 'http://nukat.edu.pl/aut/' .. id
end

local function catalUrl( id)
	if not id:match( '^%d%d%d%d%d%d%d%d%d%d%d%d%d%d%d%d%d%d$' ) then
		if not id:match( '^a?%d%d%d%d%d%d%d.$' ) then
			return false
		end
		return 'https://cantic.bnc.cat/registres/CUCId/' .. id
	end
	return 'https://cantic.bnc.cat/registre/' .. id
end

local function selibrUrl( id )
	if not id:match( '^[1-9]%d%d%d%d$' ) and not id:match( '^[1-9]%d%d%d%d%d$' ) then
		return false
	end
	return 'https://libris.kb.se/auth/' .. id
end

local function reroUrl( id )
	--exemple d'un code valide est 01-R008412216, 02-A000173676
	if not id:match( '^0[1234]%-[AR]%d%d%d%d%d%d%d%d%d$' ) then
		return false
	end
	return 'http://data.rero.ch/' .. id
end

local function bavUrl( id )
	--exemple d'un code valide est 494/9793
	if not id:match( '^49%d/[1-9]%d*$' ) then -- 49\d\/[1-9]\d{0,5}
		return false
	end
	id = id:gsub( '/', '_' )
	return 'https://opac.vatlib.it/auth/detail/' .. id
end

local function idCanadia( id )
	--exemple d'un code valide est 1024H9993
	if not id:match( '^%d%d%d%d[A-Z]%d%d%d%d[EF]?$' ) then
		return false
	end
	return 'https://www.collectionscanada.gc.ca/canadiana-authorities/index/view?index_name=cdnAutNbr&lang=fr&search_text=' .. id .. '&page=1&cdnAutNbr' .. id
end

local function nlaUrl( id )
	--exemple d'un code valide est nm1942312
	if not id:match( '^%d+$' ) then
		return false
	end
	return 'http://nla.gov.au/anbd.aut-an' .. id
end

--[=[ en attendant que la bibliothèque du Québec ait une page sur son site web pour les articles référencés par l'idBAnQ (actuellement, page du site Viaf
local function idBAnQa( id )
	exemple d'un code valide est 0001215324
	if not id:match( '^%d%d%d%d%d+$' ) then
		return false
    end
	return 'http://viaf.org/processed/B2Q|' .. id
end
]=]


local function bibsysUrl( id )
--	exemple d'un code valide est 0001215324
	if not id:match( '^%d+$' ) then
		return false
    end
	return 'https://authority.bibsys.no/authority/rest/authorities/html/' .. id
end

local function n6iUrl( id )
--	exemple d'un code valide est vtls000033830 mais pas de format officiel précisé pour les tests dans le module
	if not id:match( '^vtls%d+$' ) then
		return false
    end
	return 'http://catalogue.nli.ie/Record/' .. id
end

local function nskUrl( id )
--	exemple d'un code valide est 000339950 
	if not id:match( '^%d+$' ) then
		return false
    end
	return 'http://katalog.nsk.hr/F/?func=direct&doc_number=' .. id .. '&local_base=nsk10'
end

--Bibliothèque Nationale de Russie (NLR ou RSL)
local function rslUrl( id )
--	exemple d'un code valide est 000080362 
	if not id:match( '^%d+$' ) then
		return false
    end
	return 'http://aleph.rsl.ru/F?func=find-b&find_code=SYS&adjacent=Y&local_base=RSL11&request=' .. id 
end
--Bibliothèque Nationale Tchèque (NKCL)
local function nkcUrl( id )
--	exemple d'un code valide est jcu2014834887 format [a-z]{2,4}[0-9]{2,14}
	if not id:match( '^%a%a+%d%d+$' ) then
		return false
    end
	return 'http://aut.nkp.cz/' .. id 
end
--Bibliothèque Nationale du Québec pour les ouvrages
local function idBAnQo( id )
	--exemple d'un code valide est 1986863
	if not id:match( '^%d+$' ) then
		return false
    end
	return 'http://collections.banq.qc.ca/ark:/52327/|' .. id
end
--Bibliothèque Nationale du Danemark
--[=[ en attendant que la bibliothèque du Québec ait une page sur son site web pour les articles référencés par l'idDBC (actuellement, page du site Viaf
local function idDbc( id )
	--exemple d'un code valide est 87097968101751
	if not id:match( '^87%d+$' ) then
		return false
    end
	return 'https://viaf.org/processed/DBC|' .. id
end
]=]
--Bibliothèque Nationale du Chili
local function idBnchl( id )
	--exemple d'un code valide est 10000000000000000063660
	if not id:match( '^%d+$' ) then
		return false
    end
	return 'http://www.bncatalogo.cl/F?func=direct&local_base=BNC01&doc_number=' .. id
end
--Bibliothèque Nationale du Portugal
local function idPtbnp( id )
	--exemple d'un code valide est 130325
	if not id:match( '^%d%d+$' ) then
		return false
    end
	return 'http://urn.bn.pt/nca/unimarc-authorities/txt?id=' .. id
end
--Bibliothèque nationale de Lettonie
local function idLnb( id )
	--exemple d'un code valide est 000001327
	if not id:match( '^%d%d+$' ) then
		return false
    end
	return 'https://kopkatalogs.lv/F/?func=direct&local_base=lnc10&doc_number=' .. id
end

--Bibliothèque nationale du Luxembourg
local function idBNL( id )
	--exemple d'un code valide est 000035166
	if not id:match( '^%d%d+$' ) then
		return false
    end
	return 'http://viaf.org/processed/BNL|' .. id
end

local function idworldcat( id )
	--exemple d'un code valide est viaf-000001327
	if not id:match( '^viaf.%d+$' ) and not id:match( '^lccn.n[a-z]?[0-9\-]+$') and not id:match( '^n[pc]..+$') then
		return false
	end
	return 'https://www.worldcat.org/identities/' .. id
end
local function idOclc( id )
	--exemple d'un code valide est 000001327
	if not id:match( '^0*[1-9]%d*$' ) then
		return false
    end
	return 'http://www.worldcat.org/oclc/' .. id
end

local function kbrUrl( id )
	if not id:match( '^%d+$' ) then
		return false
	end
	return 'https://opac.kbr.be/LIBRARY/doc/AUTHORITY/' .. id
end

----***********************************************************************************************************************
-- ajouter ici les nouvelles fonctions pour références
----***********************************************************************************************************************

local function leonoreUrl( id )
-- Identifiants allant de LH/1/1 à LH/2794/54 (légionnaires)
-- Identifiants allant de C/0/1 à C/0/84 (84 légionnaires célèbres)
-- 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)
	if not id:match( '^LH/%d%d?%d?%d?/%d%d?%d?$' ) and
	   not id:match( '^C/0/%d%d?$' ) and
	   not id:match( '^19800035/%d%d?%d?%d?/%d%d?%d?%d?%d?$' ) and
	   not id:match( '^19800035/%d%d?%d?%d?/%d%d?%d?%d?%d?Bis$' ) then
		return false
	end
	return 'http://www.culture.gouv.fr/public/mistral/leonore_fr?ACTION=CHERCHER&FIELD_1=COTE&VALUE_1=' .. id
end


--Returns the ISNI check digit isni must be a string where the 15 first elements are digits
local function getIsniCheckDigit( isni )
	local total = 0
	for i = 1, 15 do
		local digit = isni:byte( i ) - 48 --Get integer value
		total = ( total + digit ) * 2
	end
	local remainder = total % 11
	local result = ( 12 - remainder ) % 11
	if result == 10 then
		return "X"
	end
	return tostring( result )
end

--Validate ISNI and returns it as a 16 characters string or returns false if it's invalid
--See http://support.orcid.org/knowledgebase/articles/116780-structure-of-the-orcid-identifier
local function validateIsni( id )
	id = id:gsub( '[ %-]', '' ):upper()
	if not id:match( '^%d%d%d%d%d%d%d%d%d%d%d%d%d%d%d[%dX]$' ) then
		return false
	end
	if getIsniCheckDigit( id ) ~= string.char( id:byte( 16 ) ) then
		return false
	end
	return id
end

local function isniUrl( id )
	id = validateIsni( id )
	if not id then
		return false
	end
	return 'https://isni.org/isni/' .. id
end

local function ciniiUrl( id )
	return 'http://ci.nii.ac.jp/author/' .. id .. '?l=en'
end

local function sudocUrl( id )
	if not id:match( '^%d%d%d%d%d%d%d%d[%dxX]$' ) then
		return false
	end
	return 'http://www.idref.fr/' .. id
end

local function archivesnationalesUrl( id )
	if not id:match( '^FRAN_NP_%d%d%d%d%d%d$' ) then
		return false
	end
	return 'https://www.siv.archives-nationales.culture.gouv.fr/siv/NP/' .. id
end

local function bnfUrls( id )
	--Add cb prefix if it has been removed
	if not id:match( '^cb.+$' ) then
		id = 'cb' .. id
	end
	return {
		'https://catalogue.bnf.fr/ark:/12148/' .. id,
		'https://data.bnf.fr/ark:/12148/' .. id }
end

local function viafUrl( id )
	if not id:match( '^%d+$' ) then
		return false
	end
	return 'http://viaf.org/viaf/' .. id
end

local function splitLccn( id )
	if id:match( '^%l%l?%l?%d%d%d%d%d%d%d%d%d?%d?$' ) then
		id = id:gsub( '^(%l+)(%d+)(%d%d%d%d%d%d)$', '%1/%2/%3' )
	end
	if id:match( '^%l%l?%l?/%d%d%d?%d?/%d+$' ) then
		 return mw.text.split( id, '/' )
	end
	return false
end

local function padLeft( str, c, length )
	return c:rep( length - #str ) .. str
end

local function lccnUrl( id )
	local parts = splitLccn( id )
	if not parts then
		return false
	end
	id = parts[1] .. parts[2] .. padLeft( parts[3], '0', 6 )
	return 'http://id.loc.gov/authorities/' .. id
end

local function gndUrl( id )
	return 'http://d-nb.info/gnd/' .. id
end

local function nszlUrl( id )
	if not id:match( '^%d%d%d%d%d%d%d%d%d%d%d%d$' ) then
		return false
	end
	return 'https://viaf.org/processed/NSZL|' .. id
end

local function ltiUrl( id )
	if not id:match( '^[1-9]%d*$' ) then
		return false
	end
	return 'https://library.ltikorea.or.kr/node/' .. id
end

local function krnlkUrl( id )
	if not id:match( '^KA[BC]%d%d%d%d%a?%d%d%d%d%d?%d?$' ) and
		not id:match( '^KMU%d%d%d%d%a?%d%d%d%d%d?%d?$' ) and
		not id:match( '^KSH%d%d%d%d%a?%d%d%d%d%d?%d?$' ) and
		not id:match( '^CNTS%-%d%d%d%d%d%d%d%d%d%d%d$' ) then
			return false
	end 
	return 'https://lod.nl.go.kr/resource/' .. id
end

local function bnaUrl( id )
	if not id:match( '^%d%d%d%d%d%d%d%d%d$' ) then
		return false
	end
	return 'https://catalogo.bn.gov.ar/F/?func=direct&doc_number=' .. id ..'&local_base=GENER' 
end

local function bnsUrl( id )
	if not id:match( '^[1-9]%d*$' ) then
		return false
	end
	return 'https://www.helveticarchives.ch/detail.aspx?ID=' .. id 
end

local function arbabnUrl( id )
	if not id:match( '^%d%d%d%d%d%d%d%d%d$' ) then
		return false
	end
	return 'https://catalogo.bn.gov.ar/F/?func=direct&local_base=BNA10&doc_number=' .. id 
end
--Bibliothèque Nationale d'Arménie, en 3 modules distincts
local function nlaBookUrl( id )
	if not id:match( '^[1-9]%d*$' ) then
		return false
	end
	return 'http://haygirk.nla.am/cgi-bin/koha/opac-detail.pl?biblionumber=' .. id 
end
local function nlaPersUrl( id )
	if not id:match( '^[1-9]%d*$' ) then
		return false
	end
	return 'http://armunicat.nla.am/cgi-bin/koha/opac-authoritiesdetail.pl?marc=1&authid=' .. id 
end
local function nlaResUrl( id )
	if not id:match( '^[1-9]%d*$' ) then
		return false
	end
	return 'http://tert.nla.am/cgi-bin/koha/opac-detail.pl?biblionumber=' .. id 
end

local function glottoUrl( id )
	if not id:match( '^[a-z][a-z][a-z][a-z]%d%d%d%d$' ) then
		return false
	end
	return 'https://glottolog.org/resource/languoid/id/' .. id
end

local function makeLink( url, label )
	return '<span class="nowrap uid noarchive">[' .. url .. ' ' .. label .. ']</span>'
end

local function createRow( id, label, rawValue, url )
	if type( url ) == 'table' then
		return makeLink( url[1], label[1] ) .. ' (' .. makeLink( url[2], label[2] ) .. ')'
	elseif url then
		return makeLink( url, label )
	else
		local cat = ''
		if mw.title.getCurrentTitle().namespace == 0 then
			cat = '[[Catégorie:Page utilisant le modèle Autorité avec un paramètre erroné]]'
		end
		return '<span class="error">L\'identifiant ' .. id .. ' "' .. rawValue .. '" n\'est pas valide.</span>' .. cat
	end
end

local function getIdsFromWikidata( entity, property )
	local ids = {}
	for _, statement in ipairs(mw.wikibase.getBestStatements(entity, property)) do
		if type( statement.mainsnak.datavalue ) == 'table' then
			table.insert( ids, statement.mainsnak.datavalue.value )
		end
	end
	return ids
end

local BiblioNat = "Bibliothèque nationale"
--In this order: name of the parameter, label, propertyId in Wikidata, formatting function

-- optionally, a named parameter "condition" that is a predicate function with the entity object as a parameter
-- this function specifies conditions on which the identifier url should be shown, for example only if a person is dead
local conf = {
		{ 'VIAF', 'VIAF', 214, viafUrl },
		{ 'ISNI', 'ISNI', 213, isniUrl },
		{ 'BNF', {'BnF', 'données' }, 268, bnfUrls },
		{ 'AN', 'Archives nationales (France)', 3599, archivesnationalesUrl },
		{ 'SUDOC', 'IdRef', 269, sudocUrl },
		{ 'LCCN', 'LCCN', 244, lccnUrl },
		{ 'GND', 'GND', 227, gndUrl },
		{ 'SBN', 'Italie', 396, sbnUrl },
		{ 'NDL', 'Japon', 349, ndlUrl },
		{ 'CINII', 'CiNii', 271, ciniiUrl },
		{ 'BNE', 'Espagne', 950, bneUrl },
		{ 'KBR', 'Belgique', 11249, kbrUrl },
		{ 'NTA', 'Pays-Bas', 1006, ntaUrl },
		{ 'NLP1', 'Pologne', 1695, nlpUrl, condition = function(entity)
			-- affichage de l’ancien identifiant uniquement si le nouvel identifiant n’est pas renseigné
			return wd.getClaims{entity = entity, property = 'P7293'} == nil
		end },  --ancien identifiant
		{ 'NLP', 'Pologne', 7293, nlpUrl },  --nouvel identifiant
		{ 'NLI', 'Israël', 8189, nliUrl },
		{ 'NUKAT', 'NUKAT', 1207, nukatUrl },
		{ 'CATAL', 'Catalogne', 9984, catalUrl, 1273 },
		{ 'SELIBR', 'Suède', 906, selibrUrl },
	--	{ 'RERO', 'Réseau des bibliothèques de Suisse occidentale', 3065, reroUrl },
		{ 'BAV', 'Vatican', 8034, bavUrl },
		{ 'LAC', 'Canada', 1670, idCanadia },
		{ 'NLA', 'Australie', 409, nlaUrl },
	--{ 'BAnQa', 'Bibliothèque nationale du Québec', 3280, idBAnQa }, -- pour les auteurs -- à activer si BAnQ crée un espace dédié sur son site web.
		{ 'BIBSYS', 'Norvège', 1015, bibsysUrl },
	--{ 'N6I', 'Bibliothèque nationale d’Irlande', 1946, n6iUrl }, -- propriété supprimé de wikidata, ne concerne pas les auteurs, voir https://www.wikidata.org/wiki/Wikidata:Requests_for_deletions/Archive/2019/Properties/1#P1946_(P1946)
		{ 'NSK', 'Croatie', 1375, nskUrl },
		{ 'RSL', 'Russie', 947, rslUrl },
		{ 'NKC', 'Tchéquie', 691, nkcUrl },
		{ 'BAnQo', 'Québec', 1823, idBAnQo },  --pour les ouvrages
	--{ 'DBC', 'Danemark', 3846, idDbc },  -- à activer si DBC crée un espace dédié sur son site web.
		{ 'BNCHL', 'Chili', 1966, idBnchl }, 
		{ 'PTBNP', 'Portugal', 1005, idPtbnp }, 
		{ 'LNB', 'Lettonie', 1368, idLnb },
		{ 'BNL', 'Luxembourg', 7028, idBNL },
		{ 'BLBNB', 'Brésil', 4619, blbnbUrl },
		{ 'NLG', 'Grèce', 3348, nlgUrl },
	--{ 'NSZL', BiblioNat .. ' de Hongrie', 951, nszlUrl },  -- à activer si NSZL crée un espace dédié sur son site web.
		{ 'LTI', 'LTI', 4760, ltiUrl },
		{ 'KRNLK', 'Corée du Sud', 5034, krnlkUrl },
		{ 'BN', 'Argentine', 1143, bnaUrl },
		{ 'BNS', 'Suisse', 1255, bnsUrl },
		{ 'ARBABN', 'Argentine', 3788, arbabnUrl },
	-- La bibliothèque d'Arménie fournit 3 sites web différents pour 3 types de documents différents Livre, Personne et ouvrage)
		{ 'NLABOOK', 'Arménie', 9398, nlaBookUrl },
		{ 'NLAPERS', 'Arménie', 8833, nlaPersUrl },
		{ 'NLARES', 'Arménie', 9147, nlaResUrl },
		{ 'WORLDCATID', 'WorldCat Id', 7859 , idworldcat },
		{ 'OCLC', 'WorldCat', 243, idOclc }, 
		{ 'GLOTTOLANG', 'Glottocode', 1394 , glottoUrl },

----***********************************************************************************************************************
--- ajouter ici les nouvelles références (appels des fonctions construisant les URL)
----***********************************************************************************************************************
}

local p = {}

function p.authorityControl( frame )
	local args = Outils.extractArgs(frame)

	--Build a map of valid local arguments
	local goodArgs = {}
	for _, params in ipairs( conf ) do
		goodArgs[params[1]] = true
	end
	goodArgs.entity = true
	goodArgs.id = true
	goodArgs.wikidata = true

	local hasLocalArgs = false
	local hasInvalidArgs = false
	for name, value in pairs( args ) do
		if name ~= 'id' and name ~= 'wikidata' and name ~= 'entity' then --"entity" parameter doesn't add to category
			hasLocalArgs = true
		end
		if not goodArgs[name] then
			hasInvalidArgs = true
		end
	end

	local entityArg = Outils.validTextArg(args , 'id', 'wikidata', 'entity')

	local entity -- The entity id string variable
	if entityArg then
		if entityArg ~= '-' then
			entity = entityArg:upper()
		else
			entity = nil
		end
	else
		entity = mw.wikibase.getEntityIdForCurrentPage() -- (if nil, no entity for current page )
	end
    
	if entity then
		for _, params in ipairs( conf ) do
			if params[3] ~= 0 then
				local val = args[params[1]]
				if not val or val == '' then
					local wikidataIds = getIdsFromWikidata( entity, 'P' .. params[3] )
					if wikidataIds[1] then
						args[params[1]] = wikidataIds[1]
					elseif params[5] ~= nil and params[5] ~= 0 then
						wikidataIds = getIdsFromWikidata( entity, 'P' .. params[5] )
						if wikidataIds[1] then
							args[params[1]] = wikidataIds[1]
						end	
					end
				end
			end
		end
	end

	--Create rows
	local elements = {}

	--compteur utilisé pour les références aujouté dans le module "autorité". Ce nombre est <= à nbMaxReferenceParPage
	local nbReferenceValide = 0
	--Configured rows
	for _, params in ipairs( conf ) do
		--l'id OCLC (ou WORLDCATID) est affiché en dernier par le code spécifique WorldCat en dehors de cette boucle.
		if params[1] ~= 'OCLC' and params[1] ~= 'WORLDCATID' then 
			local val = args[params[1]]
			if val and val ~= '' and nbReferenceValide < nbMaxReferenceParPage then
				local show_authority = params["condition"] or function() return true end
				if show_authority(entity) then
					elements[#elements+1] = createRow( params[1], params[2], val, params[4](val) )
					nbReferenceValide = nbReferenceValide+1
				end
			end
		end
	end

	--Worldcat
	if args['WORLDCATID'] and args['WORLDCATID'] ~= '' then
		if args['WORLDCATID'] ~= '-' then
			elements[#elements+1] = createRow( 'WORLDCATID', 'WorldCat', args['WORLDCATID'], idworldcat(args['WORLDCATID']) ) -- avec vérification de la validité du paramètre.
		end
	elseif args['LCCN'] and args['LCCN'] ~= '' then
		local lccnParts = splitLccn( args['LCCN'] )
		if lccnParts and lccnParts[1] ~= 'sh' then
			elements[#elements+1] = createRow( 'LCCN', 'WorldCat', args['LCCN'], 'http://www.worldcat.org/identities/lccn-' .. lccnParts[1] .. lccnParts[2] .. '-' .. lccnParts[3] ) -- L'éventuelle invalidité de la valeur du paramètre aurait déjà déclenché un message d'erreur plus haut lors de l'affichage du lien « Bibliothèque du Congrès ».
		end
	elseif args['OCLC'] and args['OCLC'] ~= '' then
		elements[#elements+1] = createRow( 'OCLC', 'WorldCat', args['OCLC'], idOclc(args['OCLC']) ) 
	end

	local entityInfo = ''
	if entityArg and entityArg ~= '-' and entity ~= mw.wikibase.getEntityIdForCurrentPage() then --Has "entity" parameter
		local label = mw.wikibase.getLabel(entity)
		local link = wd.siteLink(entity)
		if label then
			if link then
				entityInfo = ' (pour [[' .. link .. '|' .. label  .. ']])'
			else
				entityInfo = ' (pour ' .. label  .. ')'
			end
		elseif link then
			entityInfo = ' (pour [[' .. link .. ']])'
		end
	end

	if #elements == 0 then
		return '[[Catégorie:Page utilisant le modèle Autorité inactif]]'
	end

	local cats = "[[Catégorie:Article de Wikipédia avec notice d'autorité]]"
	if hasLocalArgs then
		cats = cats .. '[[Catégorie:Page utilisant le modèle Autorité avec un paramètre local]]'
	end
	if hasInvalidArgs then
		cats = cats .. '[[Catégorie:Page utilisant le modèle Autorité avec un paramètre invalide]]'
	end

	local title = wd.addLinkBack("[[Autorité (sciences de l'information)|Notices d'autorité]]" .. entityInfo, entity, "identifiers")
	local elementsHtml = mw.html.create('div')
		:addClass('liste-horizontale')
		:wikitext(title .. ' : ')
		:tag('ul')
	for _, element in pairs(elements) do
		elementsHtml:tag('li'):wikitext(element):done():wikitext(' ')
	end

	return tostring(elementsHtml:allDone()) .. cats
end

return p