Changes

Jump to navigation Jump to search

Module:Authority control

4,194 bytes removed, 09:30, 5 December 2018
m
per User:Nikkimaria's request, removing Discogs, AllMusic and IMDb identifiers for now
id = parts[1] .. parts[2] .. p.append( parts[3], '0', 6 )
return '[https://id.loc.gov/authorities/'..lccnType..'/'..id..' '..id..']'..p.getCatForId( 'LCCN' )
end
 
function p.imdbLink( id )
local imdbType = string.sub(id, 1, 2)
--P345's format regex: ev\d{7}\/(19|20)\d{2}(-\d)?|(ch|co|ev|tt|nm)\d{7}|(ni|nm)\d{8} (e.g. nm01234567)
if imdbType == 'nm' then
if not string.match( id, '^nm%d%d%d%d%d%d%d%d?$' ) then
return false
end
return '[https://www.imdb.com/name/'..id..'/ '..id..']'..p.getCatForId( 'IMDb' )
elseif imdbType == 'tt' then
if not string.match( id, '^tt%d%d%d%d%d%d%d$' ) then
return false
end
return '[https://www.imdb.com/title/'..id..'/ '..id..']'..p.getCatForId( 'IMDb' )
elseif imdbType == 'ch' then -- since Wikidata kept these, retaining them as Wikidata has done
if not string.match( id, '^ch%d%d%d%d%d%d%d$' ) then
return false
end
return '[https://web.archive.org/web/https://www.imdb.com/character/'..id..'/ '..id..']'..p.getCatForId( 'IMDb' )
elseif imdbType == 'ev' then
if not (string.match( id, '^ev%d%d%d%d%d%d%d$' )
or string.match( id, '^ev%d%d%d%d%d%d%d/%d%d%d%d$' )
or string.match( id, '^ev%d%d%d%d%d%d%d/%d%d%d%d%-%d$' )) then
return false
end
return '[https://www.imdb.com/event/'..id..' '..id..']'..p.getCatForId( 'IMDb' )
elseif imdbType == 'co' then
if not string.match( id, '^co%d%d%d%d%d%d%d$' ) then
return false
end
return '[https://www.imdb.com/company/'..id..'/ '..id..']'..p.getCatForId( 'IMDb' )
elseif imdbType == 'ni' then
if not string.match( id, '^ni%d%d%d%d%d%d%d%d?$' ) then
return false
end
return '[https://www.imdb.com/news/'..id..'/ '..id..']'..p.getCatForId( 'IMDb' )
end
end
end
return '[https://musicbrainz.org/work/'..id..' '..id..']'..p.getCatForId( 'MusicBrainz work' )
end
 
function p.dcaLink( id )
--P1953's format regex: [1-9][0-9]* (e.g. 12345)
if not string.match( id, '^[1-9]%d*$' ) then
return false
end
return '[https://www.discogs.com/artist/'..id..' '..id..']'..p.getCatForId( 'Discogs artist' )
end
 
function p.dccLink( id )
--P6080's format regex: [0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12} (e.g. 12345678-1234-1234-1234-1234567890AB)
if not string.match( id, '^%x%x%x%x%x%x%x%x%-%x%x%x%x%-%x%x%x%x%-%x%x%x%x%-%x%x%x%x%x%x%x%x%x%x%x%x$' ) then
return false
end
return '[https://www.discogs.com/composition/'..id..' '..id..']'..p.getCatForId( 'Discogs composition' )
end
 
function p.dclLink( id )
--P1955's format regex: [1-9][0-9]* (e.g. 12345)
if not string.match( id, '^[1-9]%d*$' ) then
return false
end
return '[https://www.discogs.com/label/'..id..' '..id..']'..p.getCatForId( 'Discogs label' )
end
 
function p.dcmLink( id )
--P1954's format regex: [1-9][0-9]* (e.g. 12345)
if not string.match( id, '^[1-9]%d*$' ) then
return false
end
return '[https://www.discogs.com/master/'..id..' '..id..']'..p.getCatForId( 'Discogs master' )
end
 
function p.amcLink( id )
--P1994's format regex: mc[0-9]{10} (e.g. mc0123456789)
if not string.match( id, '^mc%d%d%d%d%d%d%d%d%d%d$' ) then
return false
end
return '[https://www.allmusic.com/composition/'..id..' '..id..']'..p.getCatForId( 'AllMusic composition' )
end
 
function p.amnLink( id )
--P1728's format regex: mn[0-9]{10} (e.g. mn0123456789)
if not string.match( id, '^mn%d%d%d%d%d%d%d%d%d%d$' ) then
return false
end
return '[https://www.allmusic.com/artist/'..id..' '..id..']'..p.getCatForId( 'AllMusic artist' )
end
 
function p.amwLink( id )
--P1729's format regex: mw[0-9]{10} (e.g. mw0123456789)
if not string.match( id, '^mw%d%d%d%d%d%d%d%d%d%d$' ) then
return false
end
return '[https://www.allmusic.com/album/'..id..' '..id..']'..p.getCatForId( 'AllMusic album' )
end
p.conf = {
{ 'ACM-DL', '[[ACM Digital Library|ACM DL]]', 864, p.acmLink },
{ 'AMC', '[[AllMusic]] composition', 1994, p.amcLink, category = 'AllMusic composition' },
{ 'AMN', '[[AllMusic]]', 1728, p.amnLink, category = 'AllMusic artist' },
{ 'AMW', '[[AllMusic]] album', 1729, p.amwLink, category = 'AllMusic album' },
{ 'autores.uy', '[[autores.uy]]', 2558, p.autoresuyLink },
{ 'BALaT', '[[:d:Q2876688|BALaT]]', 3293, p.balatLink },
{ 'CINII', '[[CiNii]]', 271, p.ciniiLink },
{ 'DBLP', '[[DBLP]]', 2456, p.dblpLink },
{ 'DCA', '[[Discogs]]', 1953, p.dcaLink, category = 'Discogs artist' },
{ 'DCC', '[[Discogs]] composition', 6080, p.dccLink, category = 'Discogs composition' },
{ 'DCL', '[[Discogs]]', 1955, p.dclLink, category = 'Discogs label' },
{ 'DCM', '[[Discogs]] master', 1954, p.dcmLink, category = 'Discogs master' },
{ 'GND', '[[Integrated Authority File|GND]]', 227, p.gndLink },
{ 'HDS', '[[Historical Dictionary of Switzerland|HDS]]', 902, p.hdsLink },
{ 'IAAF', '[[International Association of Athletics Federations|IAAF]]', 1146, p.iaafLink },
{ 'ICIA', '[[Information Center for Israeli Art|ICIA]]', 1736, p.iciaLink },
{ 'IMDb', '[[IMDb]]', 345, p.imdbLink },
{ 'ISNI', '[[International Standard Name Identifier|ISNI]]', 213, p.isniLink },
{ 'Joconde', '[[Joconde|Joconde]]' , 347, p.jocondeLink },
{ 'MusicBrainz release group', 'MBRG' },
{ 'MusicBrainz work', 'MBW' },
{ 'Discogs artist', 'DCA' },
{ 'Discogs composition', 'DCC' },
{ 'Discogs label', 'DCL' },
{ 'Discogs master', 'DCM' },
{ 'Leonore', 'Léonore' },
}
Anonymous user

Navigation menu