Module:Authority control: Difference between revisions

m
add brackets to musicbrainz link to match other entries
m (1 revision imported)
m (add brackets to musicbrainz link to match other entries)
Line 1: Line 1:
require('Module:No globals')
require('strict')


local p = {}
local p = {}
Line 11: Line 11:


local function addCat( cat )
local function addCat( cat )
if cat then return '[[Category:'..cat..']]'..p.redCatLink(cat) end
if cat and cat ~= '' then return '[[Category:'..cat..']]'..p.redCatLink(cat) end
return ''
return ''
end
end
Line 19: Line 19:
if namespace == 0 then
if namespace == 0 then
cat = 'Articles with '..id..' identifiers'
cat = 'Articles with '..id..' identifiers'
elseif namespace == 2 and not title.isSubpage then
cat = 'User pages with '..id..' identifiers'
else
cat = 'Miscellaneous pages with '..id..' identifiers'
end
end
return addCat(cat)
return addCat(cat)
Line 28: Line 24:


function p.redCatLink( cat ) --cat == 'Blah' (not 'Category:Blah', not '[[Category:Blah]]')
function p.redCatLink( cat ) --cat == 'Blah' (not 'Category:Blah', not '[[Category:Blah]]')
if cat and cat ~= '' and
if cat and cat ~= '' and testcases == false and mw.title.new(cat, 14).exists == false then
  testcases == false and
  mw.title.new(cat, 14).exists == false
then
return '[[Category:Pages with red-linked authority control categories]]'
return '[[Category:Pages with red-linked authority control categories]]'
end
end
Line 41: Line 34:
if links then -- all links[] use withUid = false; no check needed
if links then -- all links[] use withUid = false; no check needed
local row = ''
local row = ''
if prefix then  
if prefix then
row = row..'*'..prefix
row = row..'*'..prefix
end
end
Line 60: Line 53:
return '*<span class="nowrap">'..link..'</span>\n'
return '*<span class="nowrap">'..link..'</span>\n'
end
end
 
return '* <span class="error">The '..id..' id '..rawValues..' is not valid.</span>'..addCat(faultyCat)..'\n'
return '* <span class="error">The '..id..' id '..rawValues..' is not valid.</span>'..addCat(faultyCat)..'\n'
end
end
Line 187: Line 180:
end
end
return '[https://catalogue.bnf.fr/ark:/12148/'..id..' '..(label or 'France')..'] [https://data.bnf.fr/ark:/12148/'..id..' (data)]'..p.getCatForId( 'BNF' )
return '[https://catalogue.bnf.fr/ark:/12148/'..id..' '..(label or 'France')..'] [https://data.bnf.fr/ark:/12148/'..id..' (data)]'..p.getCatForId( 'BNF' )
end
function p.bnmmLink( id, label )
--P3788's format regex: \d{9} (e.g. 000024044)
if id:match( '^%d%d%d%d%d%d%d%d%d$' ) then
return '[https://catalogo.bn.gov.ar/F/?func=direct&local_base=BNA10&doc_number='..id..' '..(label or 'Argentina')..']'..p.getCatForId( 'BNMM' )
else
return false
end
end
end


Line 215: Line 217:
end
end
return '[http://cantic.bnc.cat/registres/CUCId/'..id..' '..(label or 'Catalonia')..']'..p.getCatForId( 'CANTIC' ) --no https as of 10/2019
return '[http://cantic.bnc.cat/registres/CUCId/'..id..' '..(label or 'Catalonia')..']'..p.getCatForId( 'CANTIC' ) --no https as of 10/2019
end
function p.canticnLink( id, label )
--P9984's format regex: 981(0|1)\d{9}06706 (e.g. 981058515460906706)
if not id:match( '^981[0-1]%d%d%d%d%d%d%d%d%d06706$' ) then
return false
end
return '[https://cantic.bnc.cat/registre/'..id..' '..(label or 'Catalonia')..']'..p.getCatForId( 'CANTICN' )
end
end


function p.ccgLink( id, label )
function p.ccgLink( id, label )
--P3920's format regex: ([NAIP])?[1-9]\d*(\.\d+)? (e.g. A1761)
--P3920's format regex: ([NAIP])?[1-9]\d*(\.\d+)? (e.g. A1761)
if not id:match( '^[NAIP]?[1-9]%d*$' ) and  
if not id:match( '^[NAIP]?[1-9]%d*$' ) and
  not id:match( '^[NAIP]?[1-9]%d*%.%d+$' ) then
  not id:match( '^[NAIP]?[1-9]%d*%.%d+$' ) then
return false
return false
Line 256: Line 266:
end
end
return '[https://www.daao.org.au/bio/'..id..' '..(label or 'Australian Artists')..']'..p.getCatForId( 'DAAO' )
return '[https://www.daao.org.au/bio/'..id..' '..(label or 'Australian Artists')..']'..p.getCatForId( 'DAAO' )
end
function p.dbiLink( id, label )
--P1986's format regex: [a-z]+(\-[a-z]+)*(_res\-[0-9a-f]{8}(\-[0-9a-f]{4}){3}\-[0-9a-f]{12})? (e.g. pietro-lombardo_res-ab60c9da-c50a-11e5-b181-00271042e8d9)
local function dbi_is_valid (id)
local part1, part2;
if id:find ('_res', 1, true) then
part1, part2 = id:match ('([^_]+)(_res.+)'); -- split at constant '_res'; part 2 nil when no constant '_res'
else
part1 = id; -- part2 not in target
end
if part1:find ('[^%-%l]') then -- if <part1> has anything but lowercase letters and hyphens
return false; -- invalid so return false
else -- here when <part1> has only lowercase letters and hyphens
if part1:match ('^%-') or part1:match ('%-$') then -- first and last characters in <part1> must be lowercase letters
return false; -- invalid so return false
end
end
if part2 then
if not part2:match ('^_res%-%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; -- invalid so return false
end
end
return true; -- valid so return true
end
if not dbi_is_valid(id) then
return false
end
return '[https://www.treccani.it/enciclopedia/'..id..'_(Dizionario-Biografico) '..(label or 'Italian People')..']'..p.getCatForId( 'DBI' )
end
end


function p.dblpLink( id, label )
function p.dblpLink( id, label )
--P2456's format regex: \d{2,3} /\d+(-\d+)?|[a-z] /[a-zA-Z][0-9A-Za-z]*(-\d+)? (e.g. 123/123)
--P2456's format regex: \d{2,3}\/\d+(-\d+)?[a-zA-Z-]*(-\d+)?|[a-z]\/[0-9A-Za-z]*(-\d+)? (e.g. 89/4185-p)
if not id:match( '^%d%d%d?/%d+$' ) and
if not id:match( '^%d%d%d?%/%d+-?[%d]*[%a]*-?[%d]*$' ) and
  not id:match( '^%d%d%d?/%d+%-%d+$' ) and
  not id:match( '^[%a]+%/[%w]*-?[%d]*$' ) then
  not id:match( '^[a-z]/[a-zA-Z][0-9A-Za-z]*$' ) and
  not id:match( '^[a-z]/[a-zA-Z][0-9A-Za-z]*%-%d+$' ) then
return false
return false
end
end
Line 270: Line 307:


function p.dibLink( id, label )
function p.dibLink( id, label )
--P6829's format regex: a\d{4}\d?(-[A-D])? (e.g. a1953)
--P6829's format regex: 0[01]\d{4}(\.[A-D])? (e.g. 001953)
if not id:match( '^a%d%d%d%d%d?%-?[A-D]?$' ) then
if not id:match( '^0[01]%d%d%d%d%.?[A-D]?$' ) then
return false
return false
end
end
Line 283: Line 320:
end
end
return '[http://www.uni-stuttgart.de/hi/gnt/dsi2/index.php?table_name=dsi&function=details&where_field=id&where_value='..id..' '..(label or 'Scientific illustrators')..']'..p.getCatForId( 'DSI' )
return '[http://www.uni-stuttgart.de/hi/gnt/dsi2/index.php?table_name=dsi&function=details&where_field=id&where_value='..id..' '..(label or 'Scientific illustrators')..']'..p.getCatForId( 'DSI' )
end
function p.dtbioLink( id, label )
--P7902's format regex: 1[0-9]{7,8}[0-9X] (e.g. 118554700)
if not id:match( '^1[0-9]%d%d%d%d%d%d%d?[0-9X]$' ) then
return false
end
return '[https://www.deutsche-biographie.de/pnd'..id..'.html?language=en '..(label or 'Germany')..']'..p.getCatForId( 'DTBIO' )
end
end


Line 310: Line 355:
return false
return false
end
end
return '[https://d-nb.info/gnd/'..id..' '..(label or 'Integrated Authority File (Germany)')..']'..p.getCatForId( 'GND' )
return '[https://d-nb.info/gnd/'..id..' '..(label or 'Germany')..']'..p.getCatForId( 'GND' )
end
 
function p.googleLink( id, label )
--P1960's format regex: [-_0-9A-Za-z]{12} (e.g. CUO0vDcAAAAJ)
if not id:match( '^[%-_%d%l%u][%-_%d%l%u][%-_%d%l%u][%-_%d%l%u][%-_%d%l%u][%-_%d%l%u][%-_%d%l%u][%-_%d%l%u][%-_%d%l%u][%-_%d%l%u][%-_%d%l%u][%-_%d%l%u]$' ) then
return false
end
return '[https://scholar.google.com/citations?user='..id..' '..(label or 'Google Scholar')..']'..p.getCatForId( 'Google Scholar' )
end
end


Line 328: Line 381:
return '[https://www.iaaf.org/athletes/_/'..id..' '..(label or 'World Athletics')..']'..p.getCatForId( 'IAAF' )
return '[https://www.iaaf.org/athletes/_/'..id..' '..(label or 'World Athletics')..']'..p.getCatForId( 'IAAF' )
end
end


function p.iccuLink( id, label )
function p.iccuLink( id, label )
--P396's format regex: IT\\ICCU\\(\d{10}|\D\D[\D\d]\D\\\d{6}) (e.g. IT\ICCU\CFIV\000163)
--P396's format regex: \D{2}[A-Z0-3]V\d{6} (e.g. CFIV000163)
if not id:match( '^IT\\ICCU\\%d%d%d%d%d%d%d%d%d%d$' ) and
if not id:match( '^%u%u[%u0-3]V%d%d%d%d%d%d$' ) then --legacy: %u used here instead of %D (but the faulty ID cat is empty, out of ~12k uses)
  not id:match( '^IT\\ICCU\\%u%u[%u%d]%u\\%d%d%d%d%d%d$' ) then --legacy: %u used here instead of %D (but the faulty ID cat is empty, out of ~12k uses)
return false
return false
end
end
return '[https://opac.sbn.it/opacsbn/opac/iccu/scheda_authority.jsp?bid='..id..' '..(label or 'Italy')..']'..p.getCatForId( 'ICCU' )
return '[https://opac.sbn.it/nome/'..id..' '..(label or 'Italy')..']'..p.getCatForId( 'ICCU' )
end
end
function p.iciaLink( id, label )
function p.iciaLink( id, label )
--P1736's format regex: \d+ (e.g. 1)
--P1736's format regex: \d+ (e.g. 1)
Line 360: Line 412:
end
end
return '[https://isni.org/isni/'..id..' '..(label or 'ISNI')..']'..p.getCatForId( 'ISNI' )
return '[https://isni.org/isni/'..id..' '..(label or 'ISNI')..']'..p.getCatForId( 'ISNI' )
end
function p.j9uLink( id, label )
--P8189's format regex: 9870(0|1)\d{8}05171 (e.g. 987007305652505171)
if not id:match( '^9870[0-1]%d%d%d%d%d%d%d%d05171$' ) then
return false
end
return '[http://uli.nli.org.il/F/?func=find-b&local_base=NLX10&find_code=UID&request='..id..' '..(label or 'Israel')..']'..p.getCatForId( 'J9U' )
end
end


Line 405: Line 465:
end
end


function p.leonoreLink( id, label )
function p.marinaMilitareLink( id, label )
--P640's format regex: LH//\d{1,4}/\d{1,3}|19800035/\d{1,4}/\d{1,5}(Bis|Ter)?|C/0/\d{1,2} (e.g. LH//2064/18)
--P3863's format regex: [1-9]\d* (e.g. 3856)
if not id:match( '^LH//%d%d?%d?%d?/%d%d?%d?$' ) and              --IDs from      LH//1/1 to        LH//2794/54 (legionaries)
if id:match( '^[1-9]%d*$' ) then
  not id:match( '^19800035/%d%d?%d?%d?/%d%d?%d?%d?%d?$' ) and    --IDs from 19800035/1/1 to 19800035/385/51670 (legionnaires who died 1954-1977 & some who died < 1954)
return '[http://www.marina.difesa.it/cosa-facciamo/per-la-difesa-sicurezza/fari/Pagine/'..id..'.aspx '..(label or 'Italy')..']'..p.getCatForId( 'Marina Militare' )
  not id:match( '^19800035/%d%d?%d?%d?/%d%d?%d?%d?%d?Bis$' ) and --IDs from ?
else
  not id:match( '^19800035/%d%d?%d?%d?/%d%d?%d?%d?%d?Ter$' ) and --IDs from ?
  not id:match( '^C/0/%d%d?$' ) then                            --IDs from        C/0/1 to            C/0/84 (84 famous legionaries)
return false
return false
end
end
return '[http://www.culture.gouv.fr/public/mistral/leonore_fr?ACTION=CHERCHER&FIELD_1=COTE&VALUE_1='..id..' '..(label or 'Léonore (France)')..']'..p.getCatForId( 'Léonore' ) --no https as of 9/2019
end
end


function p.maLink( id, label )
function p.mathsnLink( id, label )
--P6366's format regex: [1-9]\d{3,9} (e.g. 1498221862)
--P4955's format regex: [1-9]\d{4,6} (e.g. 175270)
if not id:match( '^[1-9]%d%d%d%d?%d?%d?%d?%d?%d?$' ) then
if not id:match( '^[1-9]%d%d%d%d%d?%d?$' ) then
return false
return false
end
end
return '[https://academic.microsoft.com/v2/detail/'..id..' '..(label or 'Microsoft Academic')..']'..p.getCatForId( 'MA' )
return '[https://mathscinet.ams.org/mathscinet/MRAuthorID/'..id..' '..(label or 'MathSciNet')..']'..p.getCatForId( 'MATHSN' )
end
end


Line 433: Line 490:
local cat = p.getCatForId( 'MusicBrainz' )--special cat name
local cat = p.getCatForId( 'MusicBrainz' )--special cat name
if label then
if label then
return '['..url..' '..label..']'..cat
return '['..url..' '..label..']'..cat
else
else
return '[[MBA (identifier)|MusicBrainz]] ['..url..' artist]'..cat
return '[[MBA (identifier)|MusicBrainz]] (['..url..' artist])'..cat
end
end
end
end
Line 447: Line 504:
local cat = p.getCatForId( 'MusicBrainz area' )--special cat name
local cat = p.getCatForId( 'MusicBrainz area' )--special cat name
if label then
if label then
return '['..url..' '..label..']'..cat
return '['..url..' '..label..']'..cat
else
else
return '[[MBAREA (identifier)|MusicBrainz]] ['..url..' area]'..cat
return '[[MBAREA (identifier)|MusicBrainz]] (['..url..' area])'..cat
end
end
end
end
Line 461: Line 518:
local cat = p.getCatForId( 'MusicBrainz instrument' )--special cat name
local cat = p.getCatForId( 'MusicBrainz instrument' )--special cat name
if label then
if label then
return '['..url..' '..label..']'..cat
return '['..url..' '..label..']'..cat
else
else
return '[[MBI (identifier)|MusicBrainz]] ['..url..' instrument]'..cat
return '[[MBI (identifier)|MusicBrainz]] (['..url..' instrument])'..cat
end
end
end
end
Line 475: Line 532:
local cat = p.getCatForId( 'MusicBrainz label' )--special cat name
local cat = p.getCatForId( 'MusicBrainz label' )--special cat name
if label then
if label then
return '['..url..' '..label..']'..cat
return '['..url..' '..label..']'..cat
else
else
return '[[MBL (identifier)|MusicBrainz]] ['..url..' label]'..cat
return '[[MBL (identifier)|MusicBrainz]] (['..url..' label])'..cat
end
end
end
end
Line 489: Line 546:
local cat = p.getCatForId( 'MusicBrainz place' )--special cat name
local cat = p.getCatForId( 'MusicBrainz place' )--special cat name
if label then
if label then
return '['..url..' '..label..']'..cat
return '['..url..' '..label..']'..cat
else
else
return '[[MBP (identifier)|MusicBrainz]] ['..url..' place]'..cat
return '[[MBP (identifier)|MusicBrainz]] (['..url..' place])'..cat
end
end
end
end
Line 503: Line 560:
local cat = p.getCatForId( 'MusicBrainz release group' )--special cat name
local cat = p.getCatForId( 'MusicBrainz release group' )--special cat name
if label then
if label then
return '['..url..' '..label..']'..cat
return '['..url..' '..label..']'..cat
else
else
return '[[MBRG (identifier)|MusicBrainz]] ['..url..' release group]'..cat
return '[[MBRG (identifier)|MusicBrainz]] (['..url..' release group])'..cat
end
end
end
end
Line 517: Line 574:
local cat = p.getCatForId( 'MusicBrainz series' )--special cat name
local cat = p.getCatForId( 'MusicBrainz series' )--special cat name
if label then
if label then
return '['..url..' '..label..']'..cat
return '['..url..' '..label..']'..cat
else
else
return '[[MBS (identifier)|MusicBrainz]] ['..url..' series]'..cat
return '[[MBS (identifier)|MusicBrainz]] (['..url..' series])'..cat
end
end
end
end
Line 528: Line 585:
return false
return false
end
end
 
local url = 'https://musicbrainz.org/work/'..id
local url = 'https://musicbrainz.org/work/'..id
local cat = p.getCatForId( 'MusicBrainz work' )--special cat name
local cat = p.getCatForId( 'MusicBrainz work' )--special cat name
if label then
if label then
return '['..url..' '..label..']'..cat
return '['..url..' '..label..']'..cat
else
else
return '[[MBW (identifier)|MusicBrainz]] ['..url..' work]'..cat
return '[[MBW (identifier)|MusicBrainz]] (['..url..' work])'..cat
end
end
end
end
Line 543: Line 600:
return false
return false
end
end
return '[https://genealogy.math.ndsu.nodak.edu/id.php?id='..id..' '..(label or 'Mathematics Genealogy Project')..']'..p.getCatForId( 'MGP' )
return '[https://www.mathgenealogy.org/id.php?id='..id..' '..(label or 'Mathematics Genealogy Project')..']'..p.getCatForId( 'MGP' )
end
 
function p.mtLink( id, label )
--P3601's format regex: \d{10} (e.g. 1000004707)
if id:match( '^%d%d%d%d%d%d%d%d%d%d$' ) then
return '[https://www.marinetraffic.com/en/ais/details/lights/'..id..' '..(label or 'MarineTraffic')..']'..p.getCatForId( 'MarineTraffic' )
else
return false
end
end
end


Line 563: Line 629:


function p.ndlLink( id, label )
function p.ndlLink( id, label )
--P349's format regex: 0?\d{8} (e.g. 012345678)
--P349's format regex: (a1|s)?[0-9]?\d{8} (e.g. a1100016921)
if not id:match( '^0?%d%d%d%d%d%d%d%d$' ) then
if not id:match( '^a1%d?%d%d%d%d%d%d%d%d' ) and
  not id:match( '^s?%d?%d%d%d%d%d%d%d%d' ) then
return false
return false
end
end
Line 572: Line 639:
function p.ngaLink(id,label)
function p.ngaLink(id,label)
--P3563's format rgex: 11[0-6]-\d+(\.\d+)? (e.g. 114-7721.2)
--P3563's format rgex: 11[0-6]-\d+(\.\d+)? (e.g. 114-7721.2)
if not id:match('^11[0-6]%-%d+%.?%d*$') then
if not id:match( '^11[0-6]%-%d+%.?%d*$' ) then
return false
return false
end
end
Line 608: Line 675:
end
end
return '[https://data.nlg.gr/resource/authority/record'..id..' '..(label or 'Greece')..']'..p.getCatForId( 'NLG' )
return '[https://data.nlg.gr/resource/authority/record'..id..' '..(label or 'Greece')..']'..p.getCatForId( 'NLG' )
end
function p.nliLink( id, label )
--P949's format regex: \d{9} (e.g. 123456789)
if not id:match( '^%d%d%d%d%d%d%d%d%d$' ) then
return false
end
return '[http://uli.nli.org.il/F/?func=direct&doc_number='..id..'&local_base=nlx10'..' '..(label or 'Israel')..']'..p.getCatForId( 'NLI' )
end
end


function p.nlkLink( id, label )
function p.nlkLink( id, label )
--P5034's format regex: KA.(19|20).{7} (e.g. KAC201501465)
--P5034's format regex: (KAB|KAC|KSH)([0-9]{4}|[0-9]{4}[a-zA-Z])[0-9]{4,6} (e.g. KAC201501465)
if not id:match( '^KA.19.......$' ) and
if not id:match( '^KAB%d%d%d%d%a?%d%d%d%d%d?%d?$' ) and
  not id:match( '^KA.20.......$' ) then
not id:match( '^KAC%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?$' ) then
return false
return false
end
end
return '[https://librarian.nl.go.kr/LI/contents/L20101000000.do?id='..id..' '..(label or 'Korea')..']'..p.getCatForId( 'NLK' )
return '[https://lod.nl.go.kr/resource/'..id..' '..(label or 'Korea')..']'..p.getCatForId( 'NLK' )
end
end


Line 742: Line 802:
end
end
return '[http://aleph.rsl.ru/F?func=find-b&find_code=SYS&adjacent=Y&local_base=RSL11&request='..id..'&CON_LNG=ENG '..(label or 'Russia')..']'..p.getCatForId( 'RSL' ) --no https as of 9/2019
return '[http://aleph.rsl.ru/F?func=find-b&find_code=SYS&adjacent=Y&local_base=RSL11&request='..id..'&CON_LNG=ENG '..(label or 'Russia')..']'..p.getCatForId( 'RSL' ) --no https as of 9/2019
end
function p.scopusLink( id, label )
--P1153's format regex: [1-9]\d{9,10} (e.g. 35247902700)
if not id:match( '^[1-9]%d%d%d%d%d%d%d%d%d%d?$' ) then
return false
end
return '[https://www.scopus.com/authid/detail.uri?authorId='..id..' '..(label or 'Scopus author')..']'..p.getCatForId( 'Scopus' )
end
end


Line 774: Line 842:
end
end
return '[https://www.idref.fr/'..id..' '..(label or 'SUDOC (France)')..']'..p.getCatForId( 'SUDOC' )
return '[https://www.idref.fr/'..id..' '..(label or 'SUDOC (France)')..']'..p.getCatForId( 'SUDOC' )
end
function p.s2authoridLink( id, label )
--P4012's format regex: [1-9]\d* (e.g. 1796130)
if not id:match( '^[1-9]%d*$' ) then
return false
end
return '[https://www.semanticscholar.org/author/'..id..' '..(label or 'Semantic Scholar')..']'..p.getCatForId( 'Semantic Scholar author' ) --special cat name
end
end


Line 794: Line 854:


function p.tdviaLink( id, label )
function p.tdviaLink( id, label )
--P7314's format regex: [a-z/-]+] (e.g. barkan-omer-lutfi)
--P7314's format regex: [0-9a-z/-]+] (e.g. barkan-omer-lutfi)
if not id:match( '^[a-z/-]+$' ) then
if not id:match( '^[%d%l/-]+$' ) then
return false
return false
end
end
return '[https://islamansiklopedisi.org.tr/'..id..' '..(label or 'Encyclopedia of Islam')..']'..p.getCatForId( 'TDVİA' )
return '[https://islamansiklopedisi.org.tr/'..id..' '..(label or 'İslâm Ansiklopedisi')..']'..p.getCatForId( 'TDVİA' )
end
end


function p.tepapaLink( id, label )
function p.tepapaLink( id, label )
Line 812: Line 871:
function p.tlsLink( id, label )
function p.tlsLink( id, label )
id = id:gsub(' +', '_')
id = id:gsub(' +', '_')
--P1362's format regex: \p{Lu}[\p{L}\d_',\.\-\(\)\*/–]{3,69} (e.g. Abcd)
--P1362's format regex: \p{Lu}[\p{L}\d_',\.\-\(\)\*\/–&]{3,89} (e.g. Abcd)
local class = "[%a%d_',%.%-%(%)%*/–]"
--Mediawiki page title partial URL so consider validation with mw.title or "[^#<>%[%] {|}]"
local idlen = #id
local class = "[%w_',%.%-%(%)%*%/–&]"
if idlen < 4 or idlen > 70 then
local idlen = mw.ustring.len (id)
if idlen < 4 or idlen > 90 then
return false
return false
end
end
Line 855: Line 915:
return false
return false
end
end
return id..p.getCatForId( 'USCG' )
return '[[USCG (identifier)|USCG]] ([https://www.navcen.uscg.gov/pdf/lightlists/LightList%20V'..mw.ustring.sub(id,1,1)..'.pdf '..id..'])'..p.getCatForId( 'USCG' )
end
end


Line 887: Line 947:


function p.worldcatidLink( id, label )
function p.worldcatidLink( id, label )
--P7859's format regex: viaf-\d+|lccn-n[a-z]?[0-9\-]+|n[pc]-.+ (e.g. viaf-100181709, lccn-n78-95332, np-verbeck,%20william$1861)
--P7859's format regex: viaf-\d+|lccn-n[a-z]?[0-9\-]+|n[cps]-.+ (e.g. viaf-100181709, lccn-n78-95332, np-verbeck,%20william$1861)
if not id:match( '^viaf%-%d+$' ) and
if not id:match( '^viaf%-%d+$' ) and
  not id:match( '^lccn%-n[a-z]?[0-9%-]+$' ) and
  not id:match( '^lccn%-n[a-z]?[0-9%-]+$' ) and
  not id:match( '^n[pc]%-.+$' ) then
  not id:match( '^n[cps]%-.+$' ) then
return false
return false
end
end
return '[https://www.worldcat.org/identities/'..mw.uri.encode(id, 'PATH')..'/ '..(label or 'WorldCat')..']'..p.getCatForId( 'WORLDCATID' )
return '[https://www.worldcat.org/identities/'..mw.uri.encode(id, 'PATH')..'/ '..(label or 'WorldCat')..']'..p.getCatForId( 'WORLDCATID' )
end
function p.zbmathLink( id, label )
--P1556's format regex: [a-z][a-z\-]*(\.[a-z][a-z\-]*)?(\.[0-9]*)? (e.g. turing.alan-m)
local ps = {'%l[%l%-]*', '%.%l[%l%-]*', '%.%d*'}
if not id:match( '^'..ps[1]..'$' ) and -- prefix with no capture options
  not id:match( '^'..ps[1]..ps[2]..'$' ) and -- prefix with first capture option
  not id:match( '^'..ps[1]..ps[3]..'$' ) and -- prefix with second capture option
  not id:match( '^'..ps[1]..ps[2]..ps[3]..'$' ) then -- prefix and both capture options
return false
end
return '[https://zbmath.org/authors/?q=ai:'..id..' '..(label or 'zbMATH')..']'..p.getCatForId( 'ZBMATH' )
end
end


Line 952: Line 1,024:
function p.getIdsFromWikidata( itemId, property )
function p.getIdsFromWikidata( itemId, property )
local ids = {}
local ids = {}
if not mw.wikibase then
return ids
end
local statements = mw.wikibase.getBestStatements( itemId, property )
local statements = mw.wikibase.getBestStatements( itemId, property )
if statements then
if statements then
Line 961: Line 1,036:
end
end
return ids
return ids
end
function p.checkcat( category,label )
local ret='[[:Category:'..category..'|'..label..']]'
if mw.title.new(category, 14).exists == false then
ret = ret..' <span class="plainlinks" style="font-size:85%;">&#91;['..tostring(mw.uri.fullUrl('Category:'..category,'action=edit&preload=Template:Authority_control/preload'))..' create]&#93;</span>'
end
return ret
end
end


-- Creates a human-readable standalone wikitable version of p.conf, and tracking categories with page counts, for use in the documentation
-- Creates a human-readable standalone wikitable version of p.conf, and tracking categories with page counts, for use in the documentation
function p.docConfTable( frame )
function p.docConfTable( frame )
local wikiTable = '{| class="wikitable sortable"\n'..
local wikiTable = '<table class="wikitable sortable">'..
  '! rowspan=2 | Parameter\n'..
  '<tr><th rowspan=2>Parameter</th>'..
  '! rowspan=2 | Section\n'..
  '<th rowspan=2>Section</th>'..
  '! rowspan=2 | Appears as\n'..
  '<th rowspan=2>Appears as</th>'..
  '! rowspan=2; data-sort-type=number | Wikidata property\n'..
  '<th rowspan=2 data-sort-type=number>Wikidata property</th>'..
  '! colspan=4 | Tracking categories and page counts\n'..
  '<th colspan=2>Tracking categories and page counts</th></tr>'..
  '|-\n'..
  '<tr><th>[[:Category:Articles with authority control information|Articles]]</th>'..
  '! [[:Category:Articles with authority control information|'..          'Articles]]\n'..
  '<th>[[:Category:Articles with faulty authority control information|Faulty IDs]]</th></tr>'
  '! [[:Category:User pages with authority control information|'..        'User pages]]\n'..
  '! [[:Category:Miscellaneous pages with authority control information|'..'Misc. pages]]\n'..
  '! [[:Category:Articles with faulty authority control information|'..    'Faulty IDs]]\n'..
  '|-\n'
local lang = mw.getContentLanguage()
local lang = mw.getContentLanguage()
local a, u, m, f, P = 0, 0, 0, 0, 0 --cumulative sums
local a, f, P = 0, 0, 0 --cumulative sums
for _, conf in pairs( p.conf ) do
for _, conf in pairs( p.conf ) do
local param, pid, section = conf[1], conf[2], conf[4]
local param, pid, section = conf[1], conf[2], conf[4]
Line 993: Line 1,072:
--cats
--cats
local articleCat = 'Articles with '..category..' identifiers'
local articleCat = 'Articles with '..category..' identifiers'
local userCat =    'User pages with '..category..' identifiers'
local miscCat =    'Miscellaneous pages with '..category..' identifiers'
local faultyCat =  'Articles with faulty '..category..' identifiers'
local faultyCat =  'Articles with faulty '..category..' identifiers'
--counts
--counts
local articleCount = lang:formatNum( mw.site.stats.pagesInCategory(articleCat, 'pages') )
local articleCount = lang:formatNum( mw.site.stats.pagesInCategory(articleCat, 'pages') )
local userCount =    lang:formatNum( mw.site.stats.pagesInCategory(userCat, 'pages') )
local miscCount =    lang:formatNum( mw.site.stats.pagesInCategory(miscCat, 'pages') )
local faultyCount =  lang:formatNum( mw.site.stats.pagesInCategory(faultyCat, 'pages') )
local faultyCount =  lang:formatNum( mw.site.stats.pagesInCategory(faultyCat, 'pages') )
--calcs
--calcs
P = P + 1 --property count
P = P + 1 --property count
a = a + lang:parseFormattedNumber(articleCount)
a = a + lang:parseFormattedNumber(articleCount)
u = u + lang:parseFormattedNumber(userCount)
m = m + lang:parseFormattedNumber(miscCount)
f = f + lang:parseFormattedNumber(faultyCount)
f = f + lang:parseFormattedNumber(faultyCount)
--concat
--concat
wikiTable = wikiTable..'\n'..
wikiTable = wikiTable..'<tr><td>[['..link..'|'..param..']]</td>'..
'|-\n'..
'<td>'..section..'</td>'..
'||[['..link..'|'..param..']]'..
'<td>'..appearsAs..'</td>'..
'||'..section..
'<td data-sort-value='..pid..'>'..wpl..'</td>'..
'||'..appearsAs..
'<td style="text-align: right;">'..p.checkcat(articleCat,articleCount)..'</td>'..
'||data-sort-value='..pid..'|'..wpl..
'<td style="text-align: right;">'..p.checkcat(faultyCat,faultyCount)..'</td></tr>'
'||style="text-align: right;"|[[:Category:'..articleCat..'|'..articleCount..']]'..
'||style="text-align: right;"|[[:Category:'..   userCat..'|'..  userCount..']]'..
'||style="text-align: right;"|[[:Category:'..  miscCat..'|'..  miscCount..']]'..
'||style="text-align: right;"|[[:Category:'.. faultyCat..'|'.. faultyCount..']]'
end
end
 
--append derivative WorldCat cats
--append derivative WorldCat cats
local wcd = { 'WorldCat-LCCN', 'WorldCat-VIAF' }
local wcd = { 'WorldCat-LCCN', 'WorldCat-VIAF' }
Line 1,025: Line 1,094:
local articleCat = 'Articles with '..w..' identifiers'
local articleCat = 'Articles with '..w..' identifiers'
local articleCount = lang:formatNum( mw.site.stats.pagesInCategory(articleCat, 'pages') )
local articleCount = lang:formatNum( mw.site.stats.pagesInCategory(articleCat, 'pages') )
local appearsAs  
local appearsAs
if w == 'WorldCat-LCCN' then
if w == 'WorldCat-LCCN' then
appearsAs = '[https://www.worldcat.org/identities/lccn-n79-113947 WorldCat (via Library of Congress)]'
appearsAs = '[https://www.worldcat.org/identities/lccn-n79-113947 WorldCat (via Library of Congress)]'
Line 1,032: Line 1,101:
end
end
a = a + lang:parseFormattedNumber(articleCount)
a = a + lang:parseFormattedNumber(articleCount)
wikiTable = wikiTable..'\n'..
wikiTable = wikiTable..'<tr><td>-</td>'..
'|-\n'..
'<td>General</td>'..
'||'..'—'..
'<td>'..appearsAs..'</td>'..
'||General'..
'<td data-sort-value='..w..'></td>'..
'||'..appearsAs..
'<td style="text-align: right;">[[:Category:'..articleCat..'|'..articleCount..']]</td>'..
'||data-sort-value='..w..'|'..'—'..
'<td style="text-align: right;"></td></tr>'
'||style="text-align: right;"|[[:Category:'..articleCat..'|'..articleCount..']]'..
'||style="text-align: right;"|—'..
'||style="text-align: right;"|—'..
'||style="text-align: right;"|—'
end
end
 
--append sums
--append sums
wikiTable = wikiTable..'\n'..
wikiTable = wikiTable..'<tr><th style="text-align: right;" colspan=3>Totals</th>'..
'|-\n'..
'<th style="text-align: right;">'..lang:formatNum(P)..'</th>'..
'! style="text-align: right;" colspan=3|Totals'..
'<th style="text-align: right;">'..lang:formatNum(a)..'</th>'..
'||style="text-align: right;"|'..lang:formatNum(P)..
'<th style="text-align: right;">'..lang:formatNum(f)..'</th></tr></table>'
'||style="text-align: right;"|'..lang:formatNum(a)..
 
'||style="text-align: right;"|'..lang:formatNum(u)..
return require('Module:Suppress categories').main(wikiTable)
'||style="text-align: right;"|'..lang:formatNum(m)..
'||style="text-align: right;"|'..lang:formatNum(f)
return require('Module:Suppress categories').main(wikiTable)..'\n|}'
end
end


Line 1,066: Line 1,127:


-- p.conf table basic format: { 'parameter name', propertyId # in Wikidata, formatting/validation function, section, example ID for documentation }
-- p.conf table basic format: { 'parameter name', propertyId # in Wikidata, formatting/validation function, section, example ID for documentation }
-- p.conf table optional named parameters:  
-- p.conf table optional named parameters:
--  link: to override the link in the documentation (defaults to "<parameter> (identifer)")
--  link: to override the link in the documentation (defaults to "<parameter> (identifer)")
--  category: to override the ID in category names (defaults to "... with <parameter> identifiers")
--  category: to override the ID in category names (defaults to "... with <parameter> identifiers")
Line 1,084: Line 1,145:
{ 'BNE', 950, p.bneLink, 'National libraries', 'XX1234567' },
{ 'BNE', 950, p.bneLink, 'National libraries', 'XX1234567' },
{ 'BNF', 268, p.bnfLink, 'National libraries', '123456789' },
{ 'BNF', 268, p.bnfLink, 'National libraries', '123456789' },
{ 'BNMM', 3788, p.bnmmLink, 'National libraries', '000024044' },
{ 'Botanist', 428, p.botanistLink , 'Scientific databases', 'L.' },
{ 'Botanist', 428, p.botanistLink , 'Scientific databases', 'L.' },
{ 'BPN', 651, p.bpnLink , 'Biographical dictionaries', '12345678' },
{ 'BPN', 651, p.bpnLink , 'Biographical dictionaries', '12345678' },
{ 'CANTIC', 1273, p.canticLink, 'National libraries', 'a12345678' },
{ 'CANTIC', 1273, p.canticLink, 'National libraries', 'a12345678' },
{ 'CANTICN', 9984, p.canticnLink, 'National libraries', '981058515460906706' },
{ 'CCG', 3920, p.ccgLink, 'Lighthouse identifiers', 'A1761', prefix='[[CCG (identifier)|CCG]]' },
{ 'CCG', 3920, p.ccgLink, 'Lighthouse identifiers', 'A1761', prefix='[[CCG (identifier)|CCG]]' },
{ 'CINII', 271, p.ciniiLink, 'Scientific databases', 'DA12345678', link = 'CiNii (identifier)' },
{ 'CINII', 271, p.ciniiLink, 'Scientific databases', 'DA12345678', link = 'CiNii (identifier)' },
{ 'CWGC', 1908, p.cwgcLink, 'Other', '1234567' },
{ 'CWGC', 1908, p.cwgcLink, 'Other', '1234567' },
{ 'DAAO', 1707, p.daaoLink, 'Art research institutes', 'rolf-harris' },
{ 'DAAO', 1707, p.daaoLink, 'Art research institutes', 'rolf-harris' },
{ 'DBI', 1986, p.dbiLink, 'Biographical dictionaries', 'dante-alighieri' },
{ 'DBLP', 2456, p.dblpLink, 'Scientific databases', '123/123' },
{ 'DBLP', 2456, p.dblpLink, 'Scientific databases', '123/123' },
{ 'DIB',  6829, p.dibLink, 'Biographical dictionaries', 'a1234' },
{ 'DIB',  6829, p.dibLink, 'Biographical dictionaries', '001953' },
{ 'DSI', 2349, p.dsiLink, 'Art research institutes', '1538' },
{ 'DSI', 2349, p.dsiLink, 'Art research institutes', '1538' },
{ 'DTBIO', 7902, p.dtbioLink, 'Biographical dictionaries', '118554700' },
{ 'EMU', 4613, p.emuLink, 'National libraries', '15409' },
{ 'EMU', 4613, p.emuLink, 'National libraries', '15409' },
{ 'FAST', 2163, p.fastLink, 'Other', '1' },
{ 'FAST', 2163, p.fastLink, 'Other', '1' },
{ 'FNZA', 6792, p.fnzaLink, 'Art research institutes', '12' },
{ 'FNZA', 6792, p.fnzaLink, 'Art research institutes', '12' },
{ 'GND', 227, p.gndLink, 'General', '4079154-3' },
{ 'GND', 227, p.gndLink, 'National libraries', '4079154-3' },
{ 'Google Scholar', 1960, p.googleLink, 'Scientific databases', 'QPdLuj8AAAAJ' },
{ 'HDS', 902, p.hdsLink, 'Other', '050123' },
{ 'HDS', 902, p.hdsLink, 'Other', '050123' },
{ 'IAAF', 1146, p.iaafLink, 'Other', '123' },
{ 'IAAF', 1146, p.iaafLink, 'Other', '123' },
{ 'ICCU', 396, p.iccuLink, 'National libraries', 'IT\\ICCU\\CFIV\\000163' }, --formerly SBN
{ 'ICCU', 396, p.iccuLink, 'National libraries', 'CFIV000163' }, --formerly SBN
{ 'ICIA', 1736, p.iciaLink, 'Art research institutes', '1' },
{ 'ICIA', 1736, p.iciaLink, 'Art research institutes', '1' },
{ 'IEU', 9070, p.ieuLink, 'Other', 'N\\A\\NationalAcademyofArtandArchitecture' },
{ 'IEU', 9070, p.ieuLink, 'Other', 'N\\A\\NationalAcademyofArtandArchitecture' },
{ 'ISNI', 213, p.isniLink, 'General', '0000-0000-6653-4145', prefix = '[[ISNI (identifier)|ISNI]]' },
{ 'ISNI', 213, p.isniLink, 'General', '0000-0000-6653-4145', prefix = '[[ISNI (identifier)|ISNI]]' },
{ 'J9U', 8189, p.j9uLink, 'National libraries', '987007305652505171' },
{ 'Joconde', 347, p.jocondeLink, 'Art research institutes', '12345678901' },
{ 'Joconde', 347, p.jocondeLink, 'Art research institutes', '12345678901' },
{ 'KULTURNAV', 1248, p.kulturnavLink, 'Art research institutes', '12345678-1234-1234-1234-1234567890AB', link = 'KulturNav (identifier)' },
{ 'KULTURNAV', 1248, p.kulturnavLink, 'Art research institutes', '12345678-1234-1234-1234-1234567890AB', link = 'KulturNav (identifier)' },
Line 1,109: Line 1,176:
{ 'LIR', 886, p.lirLink, 'Other', '1' },
{ 'LIR', 886, p.lirLink, 'Other', '1' },
{ 'LNB', 1368, p.lnbLink, 'National libraries', '123456789' },
{ 'LNB', 1368, p.lnbLink, 'National libraries', '123456789' },
{ 'Léonore', 640, p.leonoreLink, 'Other', 'LH//1/1', prefix = '[[Léonore (identifier)|Léonore (France)]]' },
{ 'Marina Militare', 3863, p.marinaMilitareLink, 'Lighthouse identifiers', '3856' },
{ 'MA', 6366, p.maLink, 'Other', '123456789' },
{ 'MarineTraffic', 3601, p.mtLink, 'Lighthouse identifiers', '1000004707' },
{ 'MATHSN', 4955, p.mathsnLink, 'Scientific databases', '175270' },
{ 'MBA', 434, p.mbaLink, 'Other', '12345678-1234-1234-1234-1234567890AB', category = 'MusicBrainz' }, --special cat name
{ 'MBA', 434, p.mbaLink, 'Other', '12345678-1234-1234-1234-1234567890AB', category = 'MusicBrainz' }, --special cat name
{ 'MBAREA', 982, p.mbareaLink, 'Other', '12345678-1234-1234-1234-1234567890AB', category = 'MusicBrainz area' }, --special cat name
{ 'MBAREA', 982, p.mbareaLink, 'Other', '12345678-1234-1234-1234-1234567890AB', category = 'MusicBrainz area' }, --special cat name
Line 1,128: Line 1,196:
{ 'NLA', 409, p.nlaLink, 'National libraries', '123456789012' },
{ 'NLA', 409, p.nlaLink, 'National libraries', '123456789012' },
{ 'NLG', 3348, p.nlgLink, 'National libraries', '12345678' },
{ 'NLG', 3348, p.nlgLink, 'National libraries', '12345678' },
{ 'NLI', 949, p.nliLink, 'National libraries', '123456789' },
{ 'NLK', 5034, p.nlkLink, 'National libraries', 'KAB197000000' },
{ 'NLK', 5034, p.nlkLink, 'National libraries', 'KAB197000000' },
{ 'NLP', 1695, p.nlpLink, 'National libraries', '9810123456789012345' },
{ 'NLP', 1695, p.nlpLink, 'National libraries', '9810123456789012345' },
Line 1,144: Line 1,211:
{ 'RKDID', 350, p.rkdidLink, 'Art research institutes', '123456' },
{ 'RKDID', 350, p.rkdidLink, 'Art research institutes', '123456' },
{ 'RSL', 947, p.rslLink, 'National libraries', '123456789' },
{ 'RSL', 947, p.rslLink, 'National libraries', '123456789' },
{ 'Scopus', 1153, p.scopusLink, 'Scientific databases', '7005487412' },
{ 'SELIBR', 906, p.selibrLink, 'National libraries', '123456' },
{ 'SELIBR', 906, p.selibrLink, 'National libraries', '123456' },
{ 'SIKART', 781, p.sikartLink, 'Art research institutes', '123456789' },
{ 'SIKART', 781, p.sikartLink, 'Art research institutes', '123456789' },
{ 'SNAC-ID', 3430, p.snacLink, 'Other', 'A' },
{ 'SNAC-ID', 3430, p.snacLink, 'Other', 'A' },
{ 'SUDOC', 269, p.sudocLink, 'Other', '026927608', prefix = '[[SUDOC (identifier)|SUDOC (France)]]' },
{ 'SUDOC', 269, p.sudocLink, 'Other', '026927608', prefix = '[[SUDOC (identifier)|SUDOC (France)]]' },
{ 'S2AuthorId', 4012, p.s2authoridLink, 'Scientific databases', '1796130', category = 'Semantic Scholar author' }, --special cat name
{ 'TA98', 1323, p.ta98Link, 'Scientific databases', 'A12.3.45.678' },
{ 'TA98', 1323, p.ta98Link, 'Scientific databases', 'A12.3.45.678' },
{ 'TDVİA', 7314, p.tdviaLink, 'Other', 'asim-b-behdele' },
{ 'TDVİA', 7314, p.tdviaLink, 'Other', 'asim-b-behdele' },
Line 1,156: Line 1,223:
{ 'UKPARL', 6213, p.ukparlLink, 'Other', 'AQUupyiR' },
{ 'UKPARL', 6213, p.ukparlLink, 'Other', 'AQUupyiR' },
{ 'ULAN', 245, p.ulanLink, 'Art research institutes', '500123456' },
{ 'ULAN', 245, p.ulanLink, 'Art research institutes', '500123456' },
{ 'USCG', 3723, p.uscgLink, 'Lighthouse identifiers', '6-0695', prefix='[[USCG (identifier)|USCG]]'},
{ 'USCG', 3723, p.uscgLink, 'Lighthouse identifiers', '6-0695'},
{ 'USCongress', 1157, p.uscongressLink, 'Other', 'A000123', link = 'US Congress (identifier)' },
{ 'USCongress', 1157, p.uscongressLink, 'Other', 'A000123', link = 'US Congress (identifier)' },
{ 'VcBA', 8034, p.vcbaLink, 'National libraries', '494/9793' },
{ 'VcBA', 8034, p.vcbaLink, 'National libraries', '494/9793' },
{ 'VIAF', 214, p.viafLink, 'General', '123456789', prefix = '[[VIAF (identifier)|VIAF]]' },
{ 'VIAF', 214, p.viafLink, 'General', '123456789', prefix = '[[VIAF (identifier)|VIAF]]' },
{ 'WORLDCATID', 7859, p.worldcatidLink, 'General', 'lccn-n78-95332', link = 'WorldCat Identities (identifier)' },
{ 'WORLDCATID', 7859, p.worldcatidLink, 'General', 'lccn-n78-95332', link = 'WorldCat Identities (identifier)' },
{ 'ZBMATH', 1556, p.zbmathLink, 'Scientific databases', 'turing.alan-m' },
}
}


Line 1,167: Line 1,235:
p.aliases = {
p.aliases = {
{ 'DNB', 'GND' }, --Deutsche Nationalbibliothek -> Gemeinsame Normdatei
{ 'DNB', 'GND' }, --Deutsche Nationalbibliothek -> Gemeinsame Normdatei
{ 'Leonore', 'Léonore' }, --alias name without diacritics
{ 'leonore', 'Léonore' }, --lowercase variant without diacritics
{ 'MusicBrainz', 'MBA' },
{ 'MusicBrainz', 'MBA' },
{ 'MusicBrainz artist', 'MBA' },
{ 'MusicBrainz artist', 'MBA' },
Line 1,207: Line 1,273:
local sameOnWDCat = ''
local sameOnWDCat = ''
local stateCat = ''
local stateCat = ''
 
--redirect aliases to proper parameter names
--redirect aliases to proper parameter names
for _, a in pairs( p.aliases ) do
for _, a in pairs( p.aliases ) do
Line 1,215: Line 1,281:
end
end
end
end
 
--redirect deprecated parameters to proper parameter names, and assign tracking cat
--redirect deprecated parameters to proper parameter names, and assign tracking cat
for _, d in pairs( p.deprecated ) do
for _, d in pairs( p.deprecated ) do
Line 1,226: Line 1,292:
end
end
end
end
 
--use QID= parameter for testing/example purposes only
--use QID= parameter for testing/example purposes only
local itemId = nil
local itemId = nil
Line 1,235: Line 1,301:
itemId = resolveEntity._id(itemId) --nil if unresolvable
itemId = resolveEntity._id(itemId) --nil if unresolvable
end
end
else
elseif mw.wikibase then
itemId = mw.wikibase.getEntityIdForCurrentPage()
itemId = mw.wikibase.getEntityIdForCurrentPage()
end
end
 
--Wikidata fallback if available
--Wikidata fallback if available
if itemId then
if itemId then
Line 1,282: Line 1,348:
end
end
end
end
 
--configure rows
--configure rows
local rct = 0
local rct = 0
Line 1,305: Line 1,371:
['Other'] = {}
['Other'] = {}
}
}
--don't show CANTIC if CANTICN is present, since they both go to the Library of Catalonia
--and the library has deprecated CANTIC IDs in favor of CANTICN IDs
if parentArgs.CANTICN or parentArgs.canticn then
parentArgs.CANTIC = ''
parentArgs.cantic = ''
end
--don't show NLP if PLWABN is present, since they both go to the National Library of Poland
--don't show NLP if PLWABN is present, since they both go to the National Library of Poland
--and the library has deprecated NLP IDs in favor of PLWABN IDs
--and the library has deprecated NLP IDs in favor of PLWABN IDs
Line 1,316: Line 1,388:
if val and val ~= '' and type(params[3]) == 'function' then
if val and val ~= '' and type(params[3]) == 'function' then
table.insert( tval, val )
table.insert( tval, val )
if params.prefix then  
if params.prefix then
table.insert( tlinks, params[3]( val, '1' ) )
table.insert( tlinks, params[3]( val, '1' ) )
else
else
Line 1,346: Line 1,418:
end
end
end
end
 
end
end
 
--WorldCat-VIAF & WorldCat-LCCN
--WorldCat-VIAF & WorldCat-LCCN
local worldcatId = parentArgs['worldcatid'] or parentArgs['WORLDCATID']
local worldcatId = parentArgs['worldcatid'] or parentArgs['WORLDCATID']
Line 1,356: Line 1,428:
if viafId and viafId ~= '' and p.viafLink( viafId ) then --VIAF must be present, unsuppressed, & validated
if viafId and viafId ~= '' and p.viafLink( viafId ) then --VIAF must be present, unsuppressed, & validated
table.insert( sections['General'], p.createRow( 'VIAF', viafId, '[https://www.worldcat.org/identities/containsVIAFID/'..viafId..' WorldCat (via VIAF)]', nil, false ) )
table.insert( sections['General'], p.createRow( 'VIAF', viafId, '[https://www.worldcat.org/identities/containsVIAFID/'..viafId..' WorldCat (via VIAF)]', nil, false ) )
if namespace == 0 then  
if namespace == 0 then
worldcatCat = '[[Category:Articles with WorldCat-VIAF identifiers]]'
worldcatCat = '[[Category:Articles with WorldCat-VIAF identifiers]]'
end
end
Line 1,372: Line 1,444:
end
end
end
end
 
--configure Navbox
--configure Navbox
local outString = ''
local outString = ''
Line 1,384: Line 1,456:
local sectionID = 1
local sectionID = 1
local args = { pid = 'identifiers' } -- #target the list of identifiers
local args = { pid = 'identifiers' } -- #target the list of identifiers
if testcases and itemId then args = { pid = 'identifiers', qid = itemId } end --expensive
if testcases and itemId then args.qid = itemId end --expensive
local pencil = frame:expandTemplate{ title = 'EditAtWikidata', args = args}
local pencil = require('Module:EditAtWikidata')._showMessage(args)
local navboxArgs = {
local navboxArgs = {
name  = 'Authority control',
name  = 'Authority control',
Line 1,417: Line 1,489:
-- since "general" is redundant and "other" is silly when there's nothing to contrast it with
-- since "general" is redundant and "other" is silly when there's nothing to contrast it with
navboxArgs.group1 = '[[Help:Authority control|Authority control]]'..pencil
navboxArgs.group1 = '[[Help:Authority control|Authority control]]'..pencil
else  
else
navboxArgs.group1 = '[[Help:Authority control|Authority control: '..sect..']] '..pencil
navboxArgs.group1 = '[[Help:Authority control|Authority control: '..sect..']] '..pencil
end
end
Line 1,423: Line 1,495:
outString = Navbox._navbox(navboxArgs)
outString = Navbox._navbox(navboxArgs)
end
end
 
--auxCats
--auxCats
if rct == 0 or rct >= 25 then
if rct == 0 or rct >= 25 then
Line 1,447: Line 1,519:
auxCats = mw.ustring.gsub(auxCats, '(%[%[)(Category)', '%1:%2') --for easier checking
auxCats = mw.ustring.gsub(auxCats, '(%[%[)(Category)', '%1:%2') --for easier checking
end
end
 
--out
--out
outString = outString..auxCats
outString = outString..auxCats
Line 1,453: Line 1,525:
outString = mw.ustring.gsub(outString, '(%[%[)(Category:Articles)', '%1:%2') --by definition
outString = mw.ustring.gsub(outString, '(%[%[)(Category:Articles)', '%1:%2') --by definition
end
end
 
return outString
return outString
end
end


return p
return p
Anonymous user