Changes
added comment regarding usage of custom inter-wiki prefixes instead of external links per m:Interwiki_map (example :VIAF:)
end
function p.redCatLink( catName ) --catName == 'Blah', (not 'Category:Blah', not '[[Category:Blah]]')
if catName and catName ~= '' and
testcases == false and
end
return ''
end
function p.createRow( id, label, rawValue, link, withUid, specialCat )
if link then
if withUid then
return '*<span class="nowrap">'..label..' <span class="uid">'..link..'</span></span>\n'
end
return '*<span class="nowrap">'..label..' '..link..'</span>\n'
end
local catName = 'Wikipedia articles with faulty '..(specialCat or id)..' identifiers'
return '* <span class="error">The '..id..' id '..rawValue..' is not valid.</span>[[Category:'..catName..']]'..p.redCatLink(catName)..'\n'
end
--[[ Property formatting functions ]]
--[[==========================================================================]]
-- If a link has a suitable entry in the global inter-wiki prefix table at [[:m:Interwiki_map]], please consider routing through this prefix rather than as external link URL. This will ease future maintenance as necessary updates to the link can be centrally carried out there rather than by updating this module. The "external link" icon would disappear for such entries.
function p.aagLink( id )
return false
end
return '[https://dl.acm.org/author_page.cfm?id=profile/'..id..' '..id..']'..p.getCatForId( 'ACM-DL' )
end
end
return '[https://ci.nii.ac.jp/author/'..id..'?l=en '..id..']'..p.getCatForId( 'CINII' )
end
function p.cwgcLink( id )
--P1908's format regex: [1-9]\d* (e.g. 75228351)
if not id:match( '^[1-9]%d*$' ) then
return false
end
return '[https://www.cwgc.org/find-war-dead/casualty/'..id..'/ '..id..']'..p.getCatForId( 'CWGC' )
end
end
function p.gndLink( id )
--P227's format regex: 1[012]?\d{7}[0-9X]|[47]\d{6}-\d|[1-9]\d{0,7}-[0-9X]|3\d{7}[0-9X] (e.g. 4079154-3)
if not id:match( '^1[012]?%d%d%d%d%d%d%d[0-9X]$' ) and
return false
end
return '[httphttps://isni.org/isni/'..id..' '..id:sub( 1, 4 )..' '..id:sub( 5, 8 )..' '..id:sub( 9, 12 )..' '..id:sub( 13, 16 )..']'..p.getCatForId( 'ISNI' ) --no https as of 9/2019
end
return false
end
return '[http://alephnewaleph.bibnat.ro:8991/F/?func=find-bdirect&requestlocal_base='..id..'NLR10&find_codedoc_number=SYS&adjacent=Y&local_base=NLR10 '..id..']'..p.getCatForId( 'NLR' )
end
function p.ridLink( id )
--P1053's format regex: [A-Z]{1,3}-\d{4}-(19|20)\d[0-2]\d (e.g. AAAS-12345150-19342020) if not id:match( '^[A-Z]%[A-%d%d%d%d%-19%d%d$' ) and not id:match( '^Z]?[A-Z]?%-%d%d%d%d%-20%d[0-2]%d$' ) then
return false
end
end
function p.sbnLinkiccuLink( id )
--P396's format regex: IT\\ICCU\\(\d{10}|\D\D[\D\d]\D\\\d{6}) (e.g. IT\ICCU\CFIV\000163)
if not id:match( '^IT\\ICCU\\%d%d%d%d%d%d%d%d%d%d$' ) and
return false
end
return '[https://opac.sbn.it/opacsbn/opac/iccu/scheda_authority.jsp?bid='..id..' '..id..']'..p.getCatForId( 'SBNICCU' )end
function p.selibrLink( id )
end
return '[https://trove.nla.gov.au/people/'..id..' '..id..']'..p.getCatForId( 'Trove' )
end
function p.ukparlLink( id )
--P6213's format regex: [a-zA-Z\d]{8} (e.g. AQUupyiR)
if not id:match( '^[a-zA-Z%d][a-zA-Z%d][a-zA-Z%d][a-zA-Z%d][a-zA-Z%d][a-zA-Z%d][a-zA-Z%d][a-zA-Z%d]$' ) then
return false
end
return '[https://id.parliament.uk/'..id..' '..id..']'..p.getCatForId( 'UKPARL' )
end
end
return '[http://bioguide.congress.gov/scripts/biodisplay.pl?index='..id..' '..id..']'..p.getCatForId( 'USCongress' ) --no https as of 9/2019
end
function p.vcbaLink( id )
--P8034's format regex: \d{3}\/[1-9]\d{0,5} (e.g. 494/9793)
if not id:match( '^%d%d%d\/[1-9]%d?%d?%d?%d?%d?$' ) then
return false
end
local id2 = id:gsub('\/', '_')
return '[https://opac.vatlib.it/auth/detail/'..id2..' '..id..']'..p.getCatForId( 'VcBA' )
end
return false
end
-- If the "VIAF" entry at [[:m:Interwiki map]] would resolve to "https://viaf.org/viaf/$1" (rather than "http://viaf.org/viaf/$1", as it currently still does), the code below could change from '[https://viaf.org/viaf/'..id..' '..id..']' to '[[:VIAF:'..id..'|'..id..']]'.
return '[https://viaf.org/viaf/'..id..' '..id..']'..p.getCatForId( 'VIAF' )
end
--[[==========================================================================]]
--[[ Wikidata, navigation bar, and & documentation functions ]]
--[[==========================================================================]]
end end end end end
return false
end
--[[ Configuration ]]
--[[==========================================================================]]
-- If a specific "(identifier) redirect" exists for an identifier, please route through this particular redirect rather than linking directly to the target page. This reduces clutter in "What links here" and improves reverse lookup of articles where a manifestation of this particular identifier is used.
-- Check that the Wikidata item has this property-->value before adding it
-- Parameter format: { 'parameter name', 'label', propertyId # in Wikidata, formatting/validation function }
p.conf = {
{ 'AAG', '[[Auckland Art Gallery Toi o TāmakiAAG (identifier)|AAG]]', 3372, p.aagLink }, { 'ACM-DL', '[[ACM Digital LibraryDL (identifier)|ACM DL]]', 864, p.acmLink }, { 'ADB', '[[Australian Dictionary of BiographyADB (identifier)|ADB]]', 1907, p.adbLink }, { 'AGSA', '[[Art Gallery of South AustraliaAGSA (identifier)|AGSA]]', 6804, p.agsaLink }, { 'autores.uy', '[[autores.uy (identifier)|autores.uy]]', 2558, p.autoresuyLink }, { 'AWR', '[[Australian Women\'s RegisterAWR (identifier)|AWR]]', 4186, p.awrLink }, { 'BALaT', '[[Royal Institute for Cultural Heritage#Online artworks pagesBALaT (identifier)|BALaT]]', 3293, p.balatLink }, { 'BIBSYS', '[[BibsysBIBSYS (identifier)|BIBSYS]]', 1015, p.bibsysLink }, { 'Bildindex', '[[Marburg Picture IndexBildindex (identifier)|Bildindex]]', 2092, p.bildLink }, { 'BNC', '[[Biblioteca Nacional de ChileBNC (identifier)|BNC]]', 1890, p.bncLink }, { 'BNE', '[[Biblioteca Nacional de EspañaBNE (identifier)|BNE]]', 950, p.bneLink }, { 'BNF', '[[Bibliothèque nationale de FranceBNF (identifier)|BNF]]', 268, p.bnfLink }, { 'Botanist', '[[Author citation Botanist (botanyidentifier)|Botanist]]', 428, p.botanistLink }, { 'BPN', '[[Biografisch PortaalBPN (identifier)|BPN]]', 651, p.bpnLink }, { 'CANTIC', '[[Name and Title Authority File of CataloniaCANTIC (identifier)|CANTIC]]', 1273, p.canticLink }, { 'CINII', '[[CiNii (identifier)|CiNii]]', 271, p.ciniiLink }, { 'CWGC', '[[CWGC (identifier)|CWGC]]', 1908, p.cwgcLink }, { 'DAAO', '[[Dictionary of Australian ArtistsDAAO (identifier)|DAAO]]', 1707, p.daaoLink }, { 'DBLP', '[[DBLP (identifier)|DBLP]]', 2456, p.dblpLink }, { 'DSI', '[[Stuttgart Database of Scientific Illustrators 1450–1950DSI (identifier)|DSI]]', 2349, p.dsiLink },
{ 'FNZA', '[[:d:Property:P6792|FNZA]]', 6792, p.fnzaLink },
{ 'GND', '[[Integrated Authority FileGND (identifier)|GND]]', 227, p.gndLink }, { 'HDS', '[[Historical Dictionary of SwitzerlandHDS (identifier)|HDS]]', 902, p.hdsLink }, { 'IAAF', '[[World AthleticsIAAF (identifier)|IAAF]]', 1146, p.iaafLink }, { 'ICCU', '[[ICCU (identifier)|ICCU]]', 396, p.iccuLink }, --formerly SBN { 'ICIA', '[[Information Center for Israeli ArtICIA (identifier)|ICIA]]', 1736, p.iciaLink }, { 'ISNI', '[[International Standard Name IdentifierISNI (identifier)|ISNI]]', 213, p.isniLink }, { 'Joconde', '[[Joconde (identifier)|Joconde]]' , 347, p.jocondeLink }, { 'KULTURNAV', '[[KulturNav (identifier)|KulturNav]]', 1248, p.kulturnavLink }, { 'LCCN', '[[Library of Congress Control NumberLCCN (identifier)|LCCN]]', 244, p.lccnLink }, { 'LIR', '[[Historical Dictionary of Switzerland#Lexicon_Istoric_ReticLIR (identifier)|LIR]]', 886, p.lirLink }, { 'LNB', '[[National Library of LatviaLNB (identifier)|LNB]]', 1368, p.lnbLink }, { 'Léonore', '[[Base Léonore(identifier)|Léonore]]', 640, p.leonoreLink }, { 'MBA', '[[MusicBrainzMBA (identifier)|MBA]]', 434, p.mbaLink, category = 'MusicBrainz' }, --special category name { 'MBAREA', '[[MusicBrainzMBAREA (identifier)|MBAREA]]', 982, p.mbareaLink, category = 'MusicBrainz area' }, --special category name { 'MBI', '[[MusicBrainzMBI (identifier)|MBI]]', 1330, p.mbiLink, category = 'MusicBrainz instrument' }, --special category name { 'MBL', '[[MusicBrainzMBL (identifier)|MBL]]', 966, p.mblLink, category = 'MusicBrainz label' }, --special category name { 'MBP', '[[MusicBrainzMBP (identifier)|MBP]]', 1004, p.mbpLink, category = 'MusicBrainz place' }, --special category name { 'MBRG', '[[MusicBrainzMBRG (identifier)|MBRG]] release group', 436, p.mbrgLink, category = 'MusicBrainz release group' }, --special category name { 'MBS', '[[MusicBrainzMBS (identifier)|MBS]]', 1407, p.mbsLink, category = 'MusicBrainz series' }, --special category name { 'MBW', '[[MusicBrainzMBW (identifier)|MBW]] work', 435, p.mbwLink, category = 'MusicBrainz work' }, --special category name { 'MGP', '[[Mathematics Genealogy ProjectMGP (identifier)|MGP]]', 549, p.mgpLink }, { 'NARA', '[[National Archives and Records AdministrationNARA (identifier)|NARA]]', 1225, p.naraLink }, { 'NCL', '[[National Central LibraryNCL (identifier)|NCLNBL]]', 1048, p.nclLink }, { 'NDL', '[[National Diet LibraryNDL (identifier)|NDL]]', 349, p.ndlLink }, { 'NGV', '[[National Gallery of VictoriaNGV (identifier)|NGV]]', 2041, p.ngvLink }, { 'NKC', '[[National Library of the Czech RepublicNKC (identifier)|NKC]]', 691, p.nkcLink }, { 'NLA', '[[National Library of AustraliaNLA (identifier)|NLA]]', 409, p.nlaLink }, { 'NLG', '[[National Library of GreeceNLG (identifier)|NLG]]', 3348, p.nlgLink }, { 'NLI', '[[National Library of IsraelNLI (identifier)|NLI]]', 949, p.nliLink }, { 'NLK', '[[National Library of KoreaNLK (identifier)|NLK]]', 5034, p.nlkLink }, { 'NLP', '[[National Library of PolandNLP (identifier)|NLP]]', 1695, p.nlpLink }, { 'NLR', '[[National Library of RomaniaNLR (identifier)|NLR]]', 1003, p.nlrLink }, { 'NSK', '[[National and University Library in ZagrebNSK (identifier)|NSK]]', 1375, p.nskLink }, { 'NTA', '[[Royal Library of the NetherlandsNTA (identifier)|NTA]]', 1006, p.ntaLink }, { 'ORCID', '[[ORCID (identifier)|ORCID]]', 496, p.orcidLink },
{ 'PIC', '[[:d:Q23892012|PIC]]', 2750, p.picLink },
{ 'RID', '[[RID (identifier)|ResearcherID]]', 1053, p.ridLink }, { 'RERO', '[[RERO (Library Network of Western Switzerlandidentifier)|RERO]]', 3065, p.reroLink }, { 'RKDartists', '[[Netherlands Institute for Art History#Online artist pagesRKDartists (identifier)|RKD]]', 650, p.rkdartistsLink }, { 'RKDID', '[[:d:Q17299580RKDID (identifier)|RKDimages ID]]', 350, p.rkdidLink }, { 'RSL', '[[Russian State LibraryRSL (identifier)|RSL]]', 947, p.rslLink }, { 'SBNSELIBR', '[[Istituto Centrale per il Catalogo Unico|ICCU]]', 396, p.sbnLink }, { 'SELIBR', '[[LIBRIS(identifier)|SELIBR]]', 906, p.selibrLink }, { 'SIKART', '[[SIKART (identifier)|SIKART]]', 781, p.sikartLink }, { 'SNAC-ID', '[[SNAC-ID (identifier)|SNAC]]', 3430, p.snacLink }, { 'SUDOC', '[[Système universitaire de documentationSUDOC (identifier)|SUDOC]]', 269, p.sudocLink }, { 'S2AuthorId', '[[Semantic ScholarS2AuthorId (identifier)|S2AuthorId]]', 4012, p.s2authoridLink, category = 'Semantic Scholar author' }, --special category name { 'TA98', '[[Terminologia AnatomicaTA98 (identifier)|TA98]]', 1323, p.ta98Link }, { 'TDVİA', '[[:d:Q21527102TDVİA (identifier)|TDVİA]]', 7314, p.tdviaLink }, { 'TE', '[[Terminologia EmbryologicaTE (identifier)|TE]]', 1693, p.teLink }, { 'TePapa', '[[Museum of New Zealand Te Papa TongarewaTePapa (identifier)|TePapa]]', 3544, p.tepapaLink }, { 'TH', '[[Terminologia HistologicaTH (identifier)|TH]]', 1694, p.thLink }, { 'TLS', '[[Theaterlexikon der SchweizTLS (identifier)|TLS]]', 1362, p.tlsLink }, { 'Trove', '[[Trove (identifier)|Trove]]', 1315, p.troveLink }, --formerly NLA-person { 'UKPARL', '[[UKPARL (identifier)|UKPARL]]', 6213, p.ukparlLink }, { 'ULAN', '[[Union List of Artist NamesULAN (identifier)|ULAN]]', 245, p.ulanLink }, { 'USCongress', '[[Biographical Directory of the United States US Congress(identifier)|US Congress]]', 1157, p.uscongressLink }, { 'VcBA', '[[VcBA (identifier)|VcBA]]', 8034, p.vcbaLink }, { 'VIAF', '[[Virtual International Authority FileVIAF (identifier)|VIAF]]', 214, p.viafLink }, { 'WORLDCATID', '[[WorldCat Identities (identifier)|WorldCat Identities]]', 7859, nil },
}
-- Format: { 'alias', 'parameter name in p.conf' }
p.aliases = {
{ 'RLSLeonore', 'RSLLéonore' },--alias name without diacritics { 'leonore', 'Léonore' }, --lowercase variant without diacritics
{ 'MusicBrainz', 'MBA' },
{ 'MusicBrainz artist', 'MBA' },
{ 'MusicBrainz release group', 'MBRG' },
{ 'MusicBrainz work', 'MBW' },
{ 'LeonoreSBN', 'LéonoreICCU' },--SBN alias to be deprecated at a later stage { 'TDVIA', 'TDVİA' },--alias name without diacritics { 'tdvia', 'TDVİA' }, --lowercase variant without diacritics
}
{ 'GKD', 'GND' },
{ 'PND', 'GND' },
{ 'RLS', 'RSL' },
{ 'SWD', 'GND' },
{ 'NARA-organization', 'NARA' },
for _, params in ipairs( p.conf ) do
if params[3] > 0 then
local val = parentArgs[mw.ustring.lower(params[1])] or parentArgs[params[1]]
if val == nil or val == '' then
local canUseWikidata = nil
local rct = 0
for _, params in ipairs( p.conf ) do
local val = parentArgs[mw.ustring.lower(params[1])] or parentArgs[params[1]]
if val and val ~= '' and type(params[4]) == 'function' then
table.insert( elements, p.createRow( params[1], params[2]..':', val, params[4]( val ), true, params.category ) )
--WorldCat
local worldcatId = parentArgs['worldcatid'] or parentArgs['WORLDCATID'] if worldcatId and worldcatId ~= '' then --if WORLDCATID present & unsuppressed table.insert( elements, p.createRow( 'WORLDCATID', '', worldcatId, '[[WorldCat Identities (identifier)|WorldCat Identities]]: [https://www.worldcat.org/identities/'..mw.uri.encode(worldcatId, 'PATH')..' '..worldcatId..']', false ) ) --Validation? worldcatCat = p.getCatForId( '[[Category:Wikipedia articles with WorldCat identifiers]]WORLDCATID') elseif worldcatId == nil then --if WORLDCATID absent & but unsuppressed local viafId = parentArgs['viaf'] or parentArgs['VIAF'] local lccnId = parentArgs['lccn'] or parentArgs['LCCN']
if viafId and viafId ~= '' and p.viafLink( viafId ) then --VIAF must be present, unsuppressed, & validated
table.insert( elements, p.createRow( 'VIAF', '', viafId, '[[WorldCat Identities (identifier)|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]]'
if lccnParts and lccnParts[1] ~= 'sh' then
local lccnIdFmtd = lccnParts[1]..lccnParts[2]..'-'..lccnParts[3]
table.insert( elements, p.createRow( 'LCCN', '', lccnId, '[[WorldCat Identities (identifier)|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 WORLDCATID suppressed
suppressedIdCat = '[[Category:Wikipedia articles with suppressed authority control identifiers|WORLDCATID]]'
end
local Navbox = require('Module:Navbox')
local elementsCat = ''
if rct == 0 or rct >= 25 then
local eCat = 'AC with '..rct..' elements'
elementsCat = '[[Category:'..eCat..']]'..p.redCatLink(eCat)
local outString = ''
if #elements > 0 then
local args = {pid = 'identifiers' }-- #target the list of identifiers if testcases and itemId then args = { pid = 'identifiers', qid = itemId } end --expensive
local pencil = frame:expandTemplate{ title = 'EditAtWikidata', args = args}
outString = Navbox._navbox( {
list1 = table.concat( elements )
} )
end