Modulo:Controllo di autorità/sandbox: differenze tra le versioni

Contenuto cancellato Contenuto aggiunto
Importo codice per WorldCat da en.wiki
riporto alla versione corrente con modifiche per WorldCat
Etichetta: Modifica da mobile avanzata
Riga 2:
* Modulo che implementa il template Controllo di autorità.
* Il modulo è stato importato inizialmente da:
* httphttps://en.wikipedia.org/w/index.php?title=Module:Authority_control&oldid=633242817
]]
 
Riga 13:
return false
end
return string.format( '[https://viaf.org/viaf/%s %s]', id, id ),
return string.format( '[httphttps://idwww.locworldcat.govorg/authoritiesidentities/%scontainsVIAFID/%s %s]', lccnType, id, id )
end
 
Riga 56 ⟶ 57:
return false
end
return string.format( '[httphttps://opac.sbn.it/opacsbn/opac/iccu/scheda_authority.jsp?bid=%s %s]', id, id )
end
 
Riga 83 ⟶ 84:
local lccnType = parts[1] ~= 'sh' and 'names' or 'subjects'
id = parts[1] .. parts[2] .. append( parts[3], '0', 6 )
local worldCatId
return string.format( '[http://id.loc.gov/authorities/%s/%s %s]', lccnType, id, id )
if lccnParts and lccnPartsparts[1] ~= 'sh' then
worldCatId = parts[1] .. parts[2] .. '-' .. parts[3]
end
return string.format( '[http://id.loc.gov/authorities/%s/%s %s]', lccnType, id, id ),
worldCatId and string.format( '[https://www.worldcat.org/identities/lccn-%s %s]', worldCatId, worldCatId)
end
 
Riga 104 ⟶ 110:
id = 'cb' .. id
end
return string.format( '[httphttps://catalogue.bnf.fr/ark:/12148/%s %s] [httphttps://data.bnf.fr/ark:/12148/%s (data)]', id, id, id )
end
 
Riga 127 ⟶ 133:
end
return string.format( '[https://thesaurus.cerl.org/record/%s %s]', id, id )
end
 
local function ndlLink( id )
if not string.match( id, '^%d+$' ) then
return false
end
return '[httphttps://id.ndl.go.jp/auth/ndlna/' .. id .. ' ' .. id .. ']'
end
 
Riga 181 ⟶ 194:
-- TODO Implement some sanity checking regex
return '[http://www.genealogy.ams.org/id.php?id=' .. id .. ' ' .. id .. ']'
end
 
local function ndlLink( id )
return '[http://id.ndl.go.jp/auth/ndlna/' .. id .. ' ' .. id .. ']'
end
 
Riga 267 ⟶ 276:
{ 'BAV', '[[Biblioteca apostolica vaticana|BAV]]', 1017, bavLink },
{ 'CERL', '[[Consortium of European Research Libraries|CERL]]', 1871, cerlLink },
{ 'NDL', '[[Biblioteca della Dieta nazionale del Giappone|NDL]]', 349, ndlLink, lingue = { 'en', 'ja' } },
--{ 'SELIBR', '[[LIBRIS|SELIBR]]', 906, selibrLink },
--{ 'SUDOC', '[[Système universitaire de documentation|SUDOC]]', 269, sudocLink },
Riga 276 ⟶ 286:
--{ 'MBA', '[[MusicBrainz]]', 434, mbLink },
--{ 'MGP', '[[Mathematics Genealogy Project|MGP]]', 549, mgpLink },
--{ 'NDL', '[[National Diet Library|NDL]]', 349, ndlLink },
--{ 'NCL', '[[National Central Library|NCL]]', 1048, nclLink },
--{ 'NKC', '[[National Library of the Czech Republic|NKC]]', 691, nkcLink },
Riga 293 ⟶ 302:
 
local p = {}
 
--WorldCat
local worldcatId = parentArgs['WORLDCATID']
if worldcatId and worldcatId ~= '' then --if unsuppressed & present
table.insert( elements, p.createRow( 'WORLDCATID', '', worldcatId, '[[WorldCat Identities]]: [https://www.worldcat.org/identities/'..worldcatId..' '..worldcatId..']', false ) ) --Validation?
worldcatCat = '[[Category:Wikipedia articles with WorldCat identifiers]]'
elseif worldcatId == nil then --if unsuppressed & absent
local viafId = parentArgs['VIAF']
local lccnId = parentArgs['LCCN']
if viafId and viafId ~= '' and p.viafLink( viafId ) then --VIAF must be unsuppressed & validated
table.insert( elements, p.createRow( 'VIAF', '', viafId, '[[WorldCat Identities]] (via VIAF): [https://www.worldcat.org/identities/containsVIAFID/'..viafId..' '..viafId..']', false ) )
if namespace == 0 then
worldcatCat = '[[Category:Wikipedia articles with WorldCat-VIAF identifiers]]'
end
elseif lccnId and lccnId ~= '' and p.lccnLink( lccnId ) then --LCCN must be unsuppressed & validated
local lccnParts = p.splitLccn( lccnId )
if lccnParts and lccnParts[1] ~= 'sh' then
local lccnIdFmtd = lccnParts[1] .. lccnParts[2] .. '-' .. lccnParts[3]
table.insert( elements, p.createRow( 'LCCN', '', lccnId, '[[WorldCat Identities]] (via LCCN): [https://www.worldcat.org/identities/lccn-'..lccnIdFmtd..' '..lccnIdFmtd..']', false ) )
if namespace == 0 then
worldcatCat = '[[Category:Wikipedia articles with WorldCat-LCCN identifiers]]'
end
end
end
elseif worldcatId == '' then --if suppressed
suppressedIdCat = '[[Category:Wikipedia articles with suppressed authority control identifiers|WORLDCATID]]'
end
 
 
-- Funzione per il template {{Controllo di autorità}}.
Riga 332 ⟶ 313:
if val then
local el, cat
local link, worldCatLink = params[4]( val )
if link then
local lingue = params['lingue'] and ( modlingue.lingue( params['lingue'] ) .. ' ' ) or ''
el = string.format( '%s <span class="uid">%s%s</span>', params[2], lingue, link )
cat = string.format( '[[Categoria:Voci con codice %s]]', params[1] )
if worldCatLink then elements.worldCatLink = worldCatLink end
else
el = string.format( '<span class="error">Il valore %s di %s non è valido.</span>', val, params[1] )
Riga 344 ⟶ 326:
table.insert( categories, cat )
end
end
 
if elements.worldCatLink then
table.insert( elements, '[[WorldCat Identities]] ' .. modlingue.lingue({ 'en' }) .. '&nbsp;' .. elements.worldCatLink )
table.insert( categories, '[[Categoria:Voci con codice WorldCat]]' )
end