Модуль:Бібліяінфармацыя: розьніца паміж вэрсіямі

Змесціва выдалена Змесціва дададзена
д выпраўленьне на просьбу Удзельнік:W
крыніца — https://en.wikipedia.org/wiki/Module:Authority_control?oldid=1042541897
Радок 2:
 
local p = {}
local title = mw.title.getCurrentTitle()
local namespace = title.namespace
local testcases = (string.sub(title.subpageText,1,9) == 'testcases')
 
--[[==========================================================================]]
Радок 8 ⟶ 11:
 
function p.getCatForId( id )
local title = mw.title.getCurrentTitle()
local namespace = title.namespace
local catName = ''
if namespace == 0 then
Радок 23 ⟶ 24:
 
function p.redCatLink( catName ) -- уваходны парамэтар — назва катэгорыі без прасторы назваў
-- if catName and catName ~= '' and
-- mw.title.new(catName, 14).exists == false
-- then
-- return '[[Катэгорыя:Вікіпэдыя:Старонкі зь нястворанымі бібліяграфічнымі катэгорыямі]]'
-- end
return ''
end
 
function p.createRow( id, rawValues, link, links, withUid, specialCat, prefix)
local catName = 'Вікіпэдыя:Артыкулы з хібнымі ідэнтыфікатарамі '..(specialCat or id)
if links then -- all links[] use withUid = false; no check needed
local row = ''
if prefix then
row = row..'*'..prefix
end
for i, l in ipairs( links ) do
if i == 1 and not prefix then row = row..'*'
else row = row..'\n**' end
if l then
row = row..'<span class="uid">'..l..'</span>'
else
row = row..'<span class="error">The '..id..' id '..rawValues[i]..' is not valid.</span>[[Катэгорыя:'..catName..']]'..p.redCatLink(catName)
end
end
return row..'\n'
elseif link then -- All IDs that have a prefix support multiple identifiers, so prefix is not needed
if withUid then
return '*<span class="nowrap"><span class="uid">'..link..'</span></span>\n'
end
return '*<span class="nowrap">'..link..'</span>\n'
end
return '* <span class="error">The '..id..' id '..rawValues..' is not valid.</span>[[Катэгорыя:'..catName..']]'..p.redCatLink(catName)..'\n'
end
 
Радок 33 ⟶ 63:
--[[==========================================================================]]
 
-- Калі спасылка мае прыдатны запіс у глябальнай табліцы прэфіксаў інтэрвікаў у [[:m:Interwiki_map]],
function p.aagLink( id )
-- паразважайце, ці ня варта маршрутаваць праз гэты прэфікс замест URL у выглядзе вонкавай спасылкі.
-- У будучыні гэта спросьціць падтрымку, бо неабходныя абнаўленьні спасылак могуць быць зьмененыя
-- цэнтралізавана, не патрабуючы абнаўленьня гэтага модулю.
-- Для такіх элемэнтаў зьнікне іконка „вонкавая спасылка“.
 
function p.aagLink( id, label)
--фармат рэг. выразу P3372: \d+ (e.g. 1)
if not id:match( '^%d+$' ) then
return false
end
return '[https://www.aucklandartgallery.com/explore-art-and-ideas/artist/'..id..'/ '..id(label or 'Auckland')..']'..p.getCatForId( 'AAG' )
end
 
function p.acmLink( id, label )
--фармат рэг. выразу P864: \d{11} (e.g. 12345678901)
if not id:match( '^%d%d%d%d%d%d%d%d%d%d%d$' ) then
return false
end
return '[https://dl.acm.org/profile/'..id..' '..id(label or 'Association for Computing Machinery')..']'..p.getCatForId( 'ACM-DL' )
end
 
function p.adbLink( id, label )
--фармат рэг. выразу P1907: [a-z][-a-z]+-([1-23]\d|[1-9])\d{0,3} (напр. barton-sir-edmund-toby-71)
if not id:match( '^[a-z][-a-z]+-[1-23]%d%d?%d?%d?$' ) and
not id:match( '^[a-z][-a-z]+-[1-9]%d?%d?%d?$' ) then
return false
end
return '[http://adb.anu.edu.au/biography/'..id..' '..id(label or 'Australia')..']'..p.getCatForId( 'ADB' )
end
 
function p.agsaLink( id, label )
--фармат рэг. выразу P6804: [1-9]\d* (напр. 3625)
if not id:match( '^[1-9]%d*$' ) then
return false
end
return '[https://www.agsa.sa.gov.au/collection-publications/collection/creators/_/'..id..'/ '..id(label or 'South Australia')..']'..p.getCatForId( 'AGSA' )
end
 
function p.autoresuyLink( id, label )
--фармат рэг. выразу P2558: [1-9]\d{0,4} (напр. 12345)
if not id:match( '^[1-9]%d?%d?%d?%d?$' ) then
return false
end
return '[https://autores.uy/autor/'..id..' '..id(label or 'Uruguay')..']'..p.getCatForId( 'autores.uy' )
end
 
function p.awrLink( id, label )
--фармат рэг. выразу P4186: (([A-Z]{3}\d{4})|([A-Z]{2}\d{5}))[a-z] (напр. PR00768b)
if not id:match( '^[A-Z][A-Z][A-Z]%d%d%d%d[a-z]$' ) and
Радок 80 ⟶ 116:
return false
end
return '[http://www.womenaustralia.info/biogs/'..id..'.htm '..id(label or 'Australian Women\'s Register')..']'..p.getCatForId( 'AWR' )
end
 
function p.balatLink( id )
--фармат рэг. выразу P3293: \d+ (напр. 1)
if not id:match( '^%d+$' ) then
return false
end
return '[http://balat.kikirpa.be/object/104257'..id..' '..id..']'..p.getCatForId( 'BALaT' ) --no https as of 9/2019
end
 
function p.bibsysLink( id, label )
--фармат рэг. выразу P1015: [1-9]\d* or [1-9](\d{0,8}|\d{12}) (напр. 1234567890123)
--TODO: follow up @ [[d:Property talk:P1015#Discrepancy between the 2 regex constraints]] or escalate/investigate
Радок 98 ⟶ 126:
return false
end
return '[https://authority.bibsys.no/authority/rest/authorities/html/'..id..' '..id(label or 'Norway')..']'..p.getCatForId( 'BIBSYS' )
end
 
function p.bildLink( id, label )
--фармат рэг. выразу P2092: \d+ (напр. 1)
if not id:match( '^%d+$' ) then
return false
end
return '[https://www.bildindex.de/document/obj'..id..' '..id(label or 'Bildindex (Нямеччына)')..']'..p.getCatForId( 'Bildindex' )
end
 
function p.bncLink( id, label )
--фармат рэг. выразу P1890: \d{9} (напр. 123456789)
if not id:match( '^%d%d%d%d%d%d%d%d%d$' ) then
return false
end
return '[http://www.bncatalogo.cl/F?func=direct&local_base=red10&doc_number='..id..' '..id(label or 'Chile')..']'..p.getCatForId( 'BNC' )
end
 
function p.bneLink( id, label )
--фармат рэг. выразу P950: (XX|FF|a)\d{4,7}|(bima|bimo|bica|bis[eo]|bivi|Mise|Mimo|Mima)\d{10} (напр. XX1234567)
if not id:match( '^[XF][XF]%d%d%d%d%d?%d?%d?$' ) and
Радок 125 ⟶ 153:
return false
end
return '[http://catalogo.bne.es/uhtbin/authoritybrowse.cgi?action=display&authority_id='..id..' '..id(label or 'Spain')..']'..p.getCatForId( 'BNE' ) --no https as of 9/2019
end
 
function p.bnfLink( id, label )
--фармат рэг. выразу P268: \d{8}[0-9bcdfghjkmnpqrstvwxz] (напр. 123456789)
if not id:match( '^c?b?%d%d%d%d%d%d%d%d[0-9bcdfghjkmnpqrstvwxz]$' ) then
Радок 137 ⟶ 165:
id = 'cb'..id
end
return '[https://catalogue.bnf.fr/ark:/12148/'..id..' '..id(label or 'France')..'] [https://data.bnf.fr/ark:/12148/'..id..' (data)]'..p.getCatForId( 'BNF' )
end
 
function p.botanistLink( id, label )
--фармат рэг. выразу P428: ('t )?(d')?(de )?(la )?(van (der )?)?(Ma?c)?(De)?(Di)?\p{Lu}?C?['\p{Ll}]*([-'. ]*(van )?(y )?(d[ae][nr]?[- ])?(Ma?c)?[\p{Lu}bht]?C?['\p{Ll}]*)*\.? ?f?\.? (напр. L.)
--not easily/meaningfully implementable in Lua's regex since "(this)?" is not allowed...
Радок 146 ⟶ 174:
return false
end
local id2id = id:gsub(' +', '%%20')
return '[https://www.ipni.org/ipni/advAuthorSearch.do?find_abbreviation='..id2id..' '..id(label or 'International Plant Names Index')..']'..p.getCatForId( 'Botanist' )
end
 
function p.bpnLink( id, label )
--фармат рэг. выразу P651: \d{6,8} (напр. 00123456)
if not id:match( '^%d%d%d%d%d%d%d%d$' ) and --originalпачатковы formatфармат regexвыразаў, changedзьменены 8/2019 toна
not id:match( '^0?%d%d%d%d%d%d%d$' ) and --allow 1вэб-2 leading 0s,бачына allowedпрымае by1—2 theнулі websiteнаперадзе
not id:match( '^0?0?%d%d%d%d%d%d$' ) then
return false
end
return '[http://www.biografischportaal.nl/en/persoon/'..id..' '..id(label or 'Netherlands')..']'..p.getCatForId( 'BPN' ) --no https as of 9/2019
end
 
function p.canticLink( id, label )
--фармат рэг. выразу P1273: a\d{7}[0-9x] (напр. a10640745)
if not id:match( '^a%d%d%d%d%d%d%d[%dx]$' ) then
return false
end
return '[http://cantic.bnc.cat/registres/CUCId/'..id..' '..id(label or 'Catalonia')..']'..p.getCatForId( 'CANTIC' ) --no https as of 10/2019
end
 
function p.ciniiLink( id, label )
--фармат рэг. выразу P271: DA\d{7}[\dX] (напр. DA12345678)
if not id:match( '^DA%d%d%d%d%d%d%d[%dX]$' ) then
return false
end
return '[https://ci.nii.ac.jp/author/'..id..'?l=en '..id(label or 'CiNii (Japan)')..']'..p.getCatForId( 'CINII' )
end
 
function p.daaoLinkcwgcLink( id, label )
--фармат рэг. выразу P1908: [1-9]\d* (напр. 75228351)
if not id:match( '^[1-9]%d*$' ) then
return false
end
return '[https://www.cwgc.org/find-war-dead/casualty/'..id..'/ '..(label or 'Commonwealth War Graves Commission')..']'..p.getCatForId( 'CWGC' )
end
 
function p.daaoLink( id, label )
--фармат рэг. выразу P1707: [a-z\-]+\d* (напр. rolf-harris)
if not id:match( '^[a-z%-]+%d*$' ) then
return false
end
return '[https://www.daao.org.au/bio/'..id..' '..id(label or 'Australian Artists')..']'..p.getCatForId( 'DAAO' )
end
 
function p.dblpLink( id, label )
--фармат рэг. выразу P2456: \d{2,3} /\d+(-\d+)?|[a-z] /[a-zA-Z][0-9A-Za-z]*(-\d+)? (напр. 123/123)
if not id:match( '^%d%d%d?/%d+$' ) and
Радок 192 ⟶ 228:
return false
end
return '[https://dblp.org/pid/'..id..' '..id(label or 'DBLP (computer science)')..']'..p.getCatForId( 'DBLP' )
end
 
function p.dsiLinkdibLink( id, label )
--фармат рэг. выразу P6829: a\d{4}\d?(-[A-D])? (напр. a1953)
if not id:match( '^a%d%d%d%d%d?%-?[A-D]?$' ) then
return false
end
return '[https://dib.cambridge.org/viewReadPage.do?articleId='..id..' '..(label or 'Ireland')..']'..p.getCatForId( 'DIB' )
end
 
function p.dsiLink( id, label )
--фармат рэг. выразу P2349: [1-9]\d* (напр. 1538)
if not id:match( '^[1-9]%d*$' ) then
return false
end
return '[http://www.uni-stuttgart.de/hi/gnt/dsi2/index.php?table_name=dsi&function=details&where_field=id&where_value='..id..' '..id(label or 'Scientific illustrators')..']'..p.getCatForId( 'DSI' )
end
 
function p.fnzaLinkemuLink( id, label )
--фармат рэг. выразу P4613: \d{1,6} (напр. 15409 (або 015409))
if not id:match( '^%d%d?%d?%d?%d?%d?$' ) then
return false
end
return '[http://esu.com.ua/search_articles.php?id='..id..' '..(label or 'Ukraine')..']'..p.getCatForId( 'EMU' )
end
 
function p.fastLink( id, label )
--фармат рэг. выразу P2163: [1-9]\d{0,7} (напр. 1916996)
if not id:match( '^[1-9]%d?%d?%d?%d?%d?%d?%d?$' ) then
return false
end
return '[http://id.worldcat.org/fast/'..id..'/ '..(label or 'Faceted Application of Subject Terminology')..']'..p.getCatForId( 'FAST' )
end
 
function p.fnzaLink( id, label )
--фармат рэг. выразу P6792: [1-9]\d* (напр. 9785)
if not id:match( '^[1-9]%d*$' ) then
return false
end
return '[https://findnzartists.org.nz/artist/'..id..'/ '..id(label or 'New Zealand Artists')..']'..p.getCatForId( 'FNZA' )
end
 
function p.gndLink( id, label )
--фармат рэг. выразу P227: 1[012]?\d{7}[0-9X]|[47]\d{6}-\d|[1-9]\d{0,7}-[0-9X]|3\d{7}[0-9X] (напр. 4079154-3)
if not id:match( '^1[012]?%d%d%d%d%d%d%d[0-9X]$' ) and
Радок 219 ⟶ 279:
return false
end
return '[https://d-nb.info/gnd/'..id..' '..id(label or 'Integrated Authority File (Нямеччына)')..']'..p.getCatForId( 'GND' )
end
 
function p.hdsLink( id, label )
--фармат рэг. выразу P902: \d{6} (напр. 050123)
if not id:match( '^%d%d%d%d%d%d$' ) then
return false
end
return '[https://hls-dhs-dss.ch/fr/articles/'..id..' '..id(label or 'Historical Dictionary of Switzerland')..']'..p.getCatForId( 'HDS' )
end
 
function p.iaafLink( id, label )
--фармат рэг. выразу P1146: [0-9][0-9]* (напр. 123)
if not id:match( '^%d+$' ) then
return false
end
return '[https://www.iaaf.org/athletes/_/'..id..' '..id(label or 'World Athletics')..']'..p.getCatForId( 'IAAF' )
end
 
function p.iciaLinkiccuLink( id, label )
--фармат рэг. выразу P396: IT\\ICCU\\(\d{10}|\D\D[\D\d]\D\\\d{6}) (напр. IT\ICCU\CFIV\000163)
if not id:match( '^IT\\ICCU\\%d%d%d%d%d%d%d%d%d%d$' ) and
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
end
return '[https://opac.sbn.it/opacsbn/opac/iccu/scheda_authority.jsp?bid='..id..' '..(label or 'Italy')..']'..p.getCatForId( 'ICCU' )
end
 
function p.iciaLink( id, label )
--фармат рэг. выразу P1736: \d+ (e.g. 1)
if not id:match( '^%d+$' ) then
return false
end
return '[https://www.imj.org.il/artcenter/newsite/en/?artist='..id..' '..id(label or 'ICIA (Israel)')..']'..p.getCatForId( 'ICIA' )
end
 
function p.ieuLink( id, label )
--фармат рэг. выразу P9070: [A-Z]\\[A-Z]\\[A-Za-z0-9]+ (напр. K\Y\Kyiv)
if not id:match( '^[A-Z]\\[A-Z]\\%w+$' ) then
return false
end
return '[http://www.encyclopediaofukraine.com/display.asp?linkpath=pages\\'..id..' '..(label or 'Internet Encyclopedia of Ukraine')..']'..p.getCatForId( 'IEU' )
end
 
function p.isniLink( id, label )
id = p.validateIsni( id ) --e.g. 0000-0000-6653-4145
if not id then
return false
end
return '[httphttps://isni.org/isni/'..id..' '..id:sub(label 1,or 4 )..' ISNI'..id:sub( 5, 8 )..' '..id:sub( 9, 12 )..' '..id:sub( 13, 16 )..']'..p.getCatForId( 'ISNI' ) --no https as of 9/2019
end
 
function p.jocondeLink( id, label )
--фармат рэг. выразу P347: [\-0-9A-Za-z]{11} (e.g. 12345678901)
local regex = '^'..string.rep('[%-0-9A-Za-z]', 11)..'$'
Радок 260 ⟶ 337:
return false
end
return '[https://www.pop.culture.gouv.fr/notice/joconde/'..id..' '..id(label or 'Joconde (France)')..']'..p.getCatForId( 'Joconde' )
end
 
function p.kulturnavLink( id, label )
--фармат рэг. выразу P1248: [0-9a-f]{8}\-[0-9a-f]{4}\-[0-9a-f]{4}\-[0-9a-f]{4}\-[0-9a-f]{12} (напр. 12345678-1234-1234-1234-1234567890AB)
if not id:match( '^%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 '[http://kulturnav.org/'..id..' '..id(label or 'KulturNav (Norway)')..']'..p.getCatForId( 'KULTURNAV' ) --https пакуль няма (9.2019)
end
 
Радок 281 ⟶ 358:
end
 
function p.lirLink( id, label )
--фармат рэг. выразу P886: \d+ (e.g. 1)
if not id:match( '^%d+$' ) then
return false
end
return '[http://www.e-lir.ch/e-LIR___Lexicon.'..id..'.450.0.html '..id(label or 'Lexicon Istoric Retic (Switzerland)')..']'..p.getCatForId( 'LIR' ) --no https as of 9/2019
end
 
function p.lnbLink( id, label )
--фармат рэг. выразу P1368: \d{9} (e.g. 123456789)
if not id:match( '^%d%d%d%d%d%d%d%d%d$' ) then
return false
end
return '[https://kopkatalogs.lv/F?func=direct&local_base=lnc10&doc_number='..id..'&P_CON_LNG=ENG '..id(label or 'Latvia')..']'..p.getCatForId( 'LNB' )
end
 
function p.leonoreLink( id, label )
--фармат рэг. выразу P640: LH//\d{1,4}/\d{1,3}|19800035/\d{1,4}/\d{1,5}(Bis|Ter)?|C/0/\d{1,2} (напр. LH//2064/18)
if not id:match( '^LH//%d%d?%d?%d?/%d%d?%d?$' ) and --IDs from LH//1/1 to LH//2794/54 (legionaries)
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)
not id:match( '^C19800035/0%d%d?%d?%d?/%d%d?%d?%d?%d?Bis$' ) then and --IDs from C/0/1 to C/0/84 (84 famous legionaries)?
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
end
return '[http://www.culture.gouv.fr/public/mistral/leonore_fr?ACTION=CHERCHER&FIELD_1=COTE&VALUE_1='..id..' '..id(label or 'Léonore (France)')..']'..p.getCatForId( 'Léonore' ) --no https as of 9/2019
end
 
function p.mbaLinkmaLink( id, label )
--фармат рэг. выразу P434P6366: [01-9a-f9]\d{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{123,9} (e.gнапр. 12345678-1234-1234-1234-1234567890AB1498221862)
if not id:match( '^[1-9]%d%d%d%d?%d?%d?%d?%d?%d?$' ) then
return false
end
return '[https://academic.microsoft.com/v2/detail/'..id..' '..(label or 'Microsoft Academic')..']'..p.getCatForId( 'MA' )
end
 
function p.mbaLink( id, label )
--фармат рэг. выразу P434: [0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12} (напр. 12345678-1234-1234-1234-1234567890AB)
if not id:match( '^%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
returnlocal url = '[https://musicbrainz.org/artist/'..id..'
local cat = '..id..']'..p.getCatForId( 'MusicBrainz' ) --special categorycat name
if label then
return '['..url..' '..label..']'..cat
else
return '[[MBA (identifier)|MusicBrainz]] ['..url..' artist]'..cat
end
end
 
function p.mbareaLink( id, label )
--фармат рэг. выразу P982: [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 id:match( '^%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
returnlocal url = '[https://musicbrainz.org/area/'..id..'
local cat = '..id..']'..p.getCatForId( 'MusicBrainz area' ) --special categorycat name
if label then
return '['..url..' '..label..']'..cat
else
return '[[MBAREA (identifier)|MusicBrainz]] ['..url..' area]'..cat
end
end
 
function p.mbiLink( id, label )
--P1330'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 id:match( '^%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
returnlocal url = '[https://musicbrainz.org/instrument/'..id..'
local cat = '..id..']'..p.getCatForId( 'MusicBrainz instrument' ) --special categorycat name
if label then
return '['..url..' '..label..']'..cat
else
return '[[MBI (identifier)|MusicBrainz]] ['..url..' instrument]'..cat
end
end
 
function p.mblLink( id, label )
--фармат рэг. выразу P966: [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 id:match( '^%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
returnlocal url = '[https://musicbrainz.org/label/'..id..'
local cat = '..id..']'..p.getCatForId( 'MusicBrainz label' ) --special categorycat name
if label then
return '['..url..' '..label..']'..cat
else
return '[[MBL (identifier)|MusicBrainz]] ['..url..' label]'..cat
end
end
 
function p.mbpLink( id, label )
--фармат рэг. выразу P1004: [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 id:match( '^%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
returnlocal url = '[https://musicbrainz.org/place/'..id..'
local cat = '..id..']'..p.getCatForId( 'MusicBrainz place' ) --special categorycat name
if label then
return '['..url..' '..label..']'..cat
else
return '[[MBP (identifier)|MusicBrainz]] ['..url..' place]'..cat
end
end
 
function p.mbrgLink( id, label )
--фармат рэг. выразу P436: [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 id:match( '^%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
returnlocal url = '[https://musicbrainz.org/release-group/'..id..'
local cat = '..id..']'..p.getCatForId( 'MusicBrainz release group' ) --special categorycat name
if label then
return '['..url..' '..label..']'..cat
else
return '[[MBRG (identifier)|MusicBrainz]] ['..url..' release group]'..cat
end
end
 
function p.mbsLink( id, label )
--фармат рэг. выразу P1407: [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 id:match( '^%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
returnlocal url = '[https://musicbrainz.org/series/'..id..'
local cat = '..id..']'..p.getCatForId( 'MusicBrainz series' ) --special categorycat name
if label then
return '['..url..' '..label..']'..cat
else
return '[[MBS (identifier)|MusicBrainz]] ['..url..' series]'..cat
end
end
 
function p.mbwLink( id, label )
--фармат рэг. выразу P435: [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 id:match( '^%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://musicbrainz.org/work/'..id..' '..id..']'..p.getCatForId( 'MusicBrainz work' ) --special category name
local url = 'https://musicbrainz.org/work/'..id
local cat = p.getCatForId( 'MusicBrainz work' )--special cat name
if label then
return '['..url..' '..label..']'..cat
else
return '[[MBW (identifier)|MusicBrainz]] ['..url..' work]'..cat
end
end
 
function p.mgpLink( id, label )
--фармат рэг. выразу P549: \d{1,6} (напр. 123456)
if not id:match( '^%d%d?%d?%d?%d?%d?$' ) then
return false
end
return '[https://genealogy.math.ndsu.nodak.edu/id.php?id='..id..' '..id(label or 'Mathematics Genealogy Project')..']'..p.getCatForId( 'MGP' )
end
 
function p.naraLink( id, label )
--фармат рэг. выразу P1225: ^([1-9]\d{0,8})$ (напр. 123456789)
if not id:match( '^[1-9]%d?%d?%d?%d?%d?%d?%d?%d?$' ) then
return false
end
return '[https://catalog.archives.gov/id/'..id..' '..id(label or 'National Archives (US)')..']'..p.getCatForId( 'NARA' )
end
 
function p.nclLink( id, label )
--фармат рэг. выразу P1048: \d+ (e.g. 1081436)
if not id:match( '^%d+$' ) then
return false
end
return '[http://aleweb.ncl.edu.tw/F/?func=accref&acc_sequence='..id..'&CON_LNG=ENG '..id(label or 'Taiwan')..']'..p.getCatForId( 'NCL' ) --no https as of 9/2019
end
 
function p.ndlLink( id, label )
--фармат рэг. выразу P349: 0?\d{8} (e.g. 012345678)
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..' '..id(label or 'Japan')..']'..p.getCatForId( 'NDL' )
end
 
function p.ngvLink( id, label )
--фармат рэг. выразу P2041: \d+ (напр. 12354)
if not id:match( '^%d+$' ) then
return false
end
return '[https://www.ngv.vic.gov.au/explore/collection/artist/'..id..'/ '..id(label or 'Victoria')..']'..p.getCatForId( 'NGV' )
end
 
function p.nkcLink( id, label )
--фармат рэг. выразу P691: [a-z]{2,4}[0-9]{2,14} (e.g. abcd12345678901234)
if not id:match( '^[a-z][a-z][a-z]?[a-z]?%d%d%d?%d?%d?%d?%d?%d?%d?%d?%d?%d?%d?%d?$' ) then
return false
end
return '[https://aleph.nkp.cz/F/?func=find-c&local_base=aut&ccl_term=ica='..id..'&CON_LNG=ENG '..id(label or 'Czech Republic')..']'..p.getCatForId( 'NKC' )
end
 
function p.nlaLink( id, label )
--фармат рэг. выразу P409: [1-9][0-9]{0,11} (e.g. 123456789012)
if not id:match( '^[1-9]%d?%d?%d?%d?%d?%d?%d?%d?%d?%d?%d?$' ) then
return false
end
return '[https://nla.gov.au/anbd.aut-an'..id..' '..id(label or 'Australia')..']'..p.getCatForId( 'NLA' )
end
 
function p.nlbLink( id, label )
--фармат рэг. выразу P3390: [A-Z]{0,3}-[a-z]{2}[0-9]{2,14} (напр. NLB-ar2443646)
if not id:match( '^[A-Z]*-[a-z]*[0-9]%d?%d?%d?%d?%d?%d?%d?%d?%d?%d?%d?%d?%d?%d?$' ) then
return false
end
return '[http://unicat.nlb.by/opac/pls/dict.prn_ref?tu=r&tq=v0&name_view=va_all&a001=BY-'..id..'&strq=l_siz=20'..' '..id(label or 'Беларусь')..']'..p.getCatForId( 'NLB' )
end
 
function p.nlgLink( id, label )
--фармат рэг. выразу P3348: [1-9]\d* (e.g. 1)
if not id:match( '^[1-9]%d*$' ) then
return false
end
return '[https://data.nlg.gr/resource/authority/record'..id..' '..id(label or 'Greece')..']'..p.getCatForId( 'NLG' )
end
 
function p.nliLink( id, label )
--фармат рэг. выразу P949: \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'..' '..id(label or 'Israel')..']'..p.getCatForId( 'NLI' )
end
 
function p.nlkLink( id, label )
--фармат рэг. выразу P5034: KA.(19|20).{7} (e.g. KAC201501465)
if not id:match( '^KA.19.......$' ) and
Радок 457 ⟶ 593:
return false
end
return '[https://nl.go.kr/authorities/resource/'..id..' '..id(label or 'Korea')..']'..p.getCatForId( 'NLK' )
end
 
function p.nlpLink( id, label )
--фармат рэг. выразу P1695: 9810[0-9]\d* or A[0-9]{7}[0-9X] (e.g. 9810123456789012345 or A10414836)
if not id:match( '^9810%d+$' ) and
Радок 466 ⟶ 602:
return false
end
return '[https://tools.wmflabs.org/wikidata-externalid-url?p=1695&id='..id..' '..id(label or 'Poland')..']'..p.getCatForId( 'NLP' )
end
 
function p.nlrLink( id, label )
--фармат рэг. выразу P1003: \d{9} (e.g. 123456789)
if not id:match( '^%d%d%d%d%d%d%d%d%d$' ) then
return false
end
return '[http://alephnewaleph.bibnat.ro:8991/F/?func=find-bdirect&requestlocal_base=NLR10&doc_number='..id..'&find_code=SYS&adjacent=Y&local_base=NLR10 '..id(label or 'Romania')..']'..p.getCatForId( 'NLR' )
end
 
function p.nskLink( id, label )
--фармат рэг. выразу P1375: \d{9} (e.g. 123456789)
if not id:match( '^%d%d%d%d%d%d%d%d%d$' ) then
return false
end
return '[http://katalog.nsk.hr/F/?func=direct&doc_number='..id..'&local_base=nsk10 '..id(label or 'Croatia')..']'..p.getCatForId( 'NSK' ) --no https as of 9/2019
end
 
function p.ntaLink( id, label )
--фармат рэг. выразу P1006: \d{8}[\dX] (e.g. 12345678X)
if not id:match( '^%d%d%d%d%d%d%d%d[%dX]$' ) then
return false
end
return '[http://data.bibliotheken.nl/id/thes/p'..id..' '..id(label or 'Netherlands')..']'..p.getCatForId( 'NTA' )
end
 
function p.orcidLink( id, label )
id = p.validateIsni( id ) --e.gнапр. 0000-0002-7398-5483
if not id then
return false
end
id = id:sub( 1, 4 )..'-'..id:sub( 5, 8 )..'-'..id:sub( 9, 12 )..'-'..id:sub( 13, 16 )
return '[https://orcid.org/'..id..' '..id(label or 'ORCID')..']'..p.getCatForId( 'ORCID' )
end
 
function p.picLink( id, label )
--фармат рэг. выразу P2750: [1-9]\d* (e.g. 1)
if not id:match( '^[1-9]%d*$' ) then
return false
end
return '[https://pic.nypl.org/constituents/'..id..' '..id(label or 'Photographers\' Identities')..']'..p.getCatForId( 'PIC' )
end
 
function p.plwabnLink( id, label )
--фармат рэг. выразу P7293: 981[0-9]{8}05606 (напр. 9810696457305606)
if not id:match( '^981%d%d%d%d%d%d%d%d05606*$' ) then
return false
end
return '[http://mak.bn.org.pl/cgi-bin/KHW/makwww.exe?BM=1&NU=1&IM=4&WI='..id..' '..(label or 'Poland')..']'..p.getCatForId( 'PLWABN' )
end
 
function p.publonsLink( id, label )
--фармат рэг. выразу P3829: \d+ (напр. 654601)
if not id:match( '^%d+$' ) then
return false
end
return '[https://publons.com/author/'..id..'/ '..(label or 'Publons (researchers)')..']'..p.getCatForId( 'Publons' )
end
 
function p.reroLink( id, label )
--фармат рэг. выразу P3065: 0[1-2]-[A-Z0-9]{1,10} (напр. 02-A012345678)
if not id:match( '^0[1-2]%-[A-Z%d][A-Z%d]?[A-Z%d]?[A-Z%d]?[A-Z%d]?[A-Z%d]?[A-Z%d]?[A-Z%d]?[A-Z%d]?[A-Z%d]?$' ) then
return false
end
return '[http://data.rero.ch/'..id..' '..(label or 'RERO (Switzerland)')..']'..p.getCatForId( 'RERO' )
end
 
Радок 516 ⟶ 676:
return false
end
return '[https://www.researcherid.com/rid/'..id..' '..id(label or 'ResearcherID')..']'..p.getCatForId( 'RID' )
end
 
function p.reroLinkrismLink( id, label )
--фармат рэг. выразу P3065P5504: 0(pe|ks)?\[1-2]-[A-Z0-9]{1,10}d* (e.gнапр. 02-A012345678pe30006410)
if not id:match( '^0pe[1-29]%-[A-Z%d][A-Z%d]?[A-Z%d]?[A-Z%d]?[A-Z%d]?[A-Z%d]?[A-Z%d]?[A-Z%d]?[A-Z%d]?[A-Z%d]?*$' ) thenand --99% start with 'pe'
not id:match( '^ks[1-9]%d*$' ) and
not id:match( '^[1-9]%d*$' ) then
return false
end
return '[httphttps://dataopac.rerorism.chinfo/search?id='..id..' '..id(label or 'RISM (France)')..']'..p.getCatForId( 'RERORISM' )
end
 
function p.rkdartistsLink( id, label )
--фармат рэг. выразу P650: [1-9]\d{0,5} (e.gнапр. 123456)
if not id:match( '^[1-9]%d?%d?%d?%d?%d?$' ) then
return false
end
return '[https://rkd.nl/en/explore/artists/'..id..' '..id(label or 'RKD Artists (Netherlands)')..']'..p.getCatForId( 'RKDartists' )
end
 
function p.rkdidLink( id, label )
--фармат рэг. выразу P350: [1-9]\d{0,5} (e.g. 123456)
if not id:match( '^[1-9]%d?%d?%d?%d?%d?$' ) then
return false
end
return '[https://rkd.nl/nl/explore/images/'..id..' '..id(label or 'RKD ID (Netherlands)')..']'..p.getCatForId( 'RKDID' )
end
 
function p.rslLink( id, label )
--фармат рэг. выразу P947: \d{1,9} (напр. 123456789)
if not id:match( '^%d%d?%d?%d?%d?%d?%d?%d?%d?$' ) then
return false
end
return '[http://aleph.rsl.ru/F?func=find-b&find_code=SYS&adjacent=Y&local_base=RSL11&request='..id..'&CON_LNG=ENG '..id(label or 'Russia')..']'..p.getCatForId( 'RSL' ) --no https пакульas нямаof (9./2019)
end
 
function p.sbnLink( id )
--фармат рэг. выразу P396: IT\\ICCU\\(\d{10}|\D\D[\D\d]\D\\\d{6}) (напр. IT\ICCU\CFIV\000163)
if not id:match( '^IT\\ICCU\\%d%d%d%d%d%d%d%d%d%d$' ) and
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
end
return '[https://opac.sbn.it/opacsbn/opac/iccu/scheda_authority.jsp?bid='..id..' '..id..']'..p.getCatForId( 'SBN' )
end
 
function p.selibrLink( id, label )
--фармат рэг. выразу P906: [1-9]\d{4,5} (e.gнапр. 123456)
if not id:match( '^[1-9]%d%d%d%d%d?$' ) then
return false
end
return '[https://libris.kb.se/auth/'..id..' '..id(label or 'Sweden')..']'..p.getCatForId( 'SELIBR' )
end
 
function p.sikartLink( id, label )
--фармат рэг. выразу P781: \d{7,9} (напр. 123456789)
if not id:match( '^%d%d%d%d%d%d%d%d?%d?$' ) then
return false
end
return '[http://www.sikart.ch/KuenstlerInnen.aspx?id='..id..'&lng=en '..id(label or 'SIKART (Switzerland)')..']'..p.getCatForId( 'SIKART' ) --no https пакульas нямаof (9./2019)
end
 
function p.snacLink( id, label )
--фармат рэг. выразу P3430: \d*[A-Za-z][0-9A-Za-z]* (e.g. A)
if not id:match( '^%d*[A-Za-z][0-9A-Za-z]*$' ) then
return false
end
return '[https://snaccooperative.org/ark:/99166/'..id..' '..id(label or 'Social Networks and Archival Context')..']'..p.getCatForId( 'SNAC-ID' )
end
 
function p.sudocLink( id, label )
--фармат рэг. выразу P269: (\d{8}[\dX]|) (e.g. 026927608)
if not id:match( '^%d%d%d%d%d%d%d%d[%dxX]$' ) then --legacy: allow lowercase 'x'
return false
end
return '[https://www.idref.fr/'..id..' '..id(label or 'SUDOC (France)')..']'..p.getCatForId( 'SUDOC' )
end
 
function p.s2authoridLink( id, label )
--фармат рэг. выразу P4012: [1-9]\d* (e.g. 1796130)
if not id:match( '^[1-9]%d*$' ) then
return false
end
return '[https://www.semanticscholar.org/author/'..id..' '..id(label or 'Semantic Scholar')..']'..p.getCatForId( 'Semantic Scholar author' ) --specialназва categoryспэцыяльнай nameкатэгорыі
end
 
function p.ta98Link( id, label )
--фармат рэг. выразу P1323: A\d{2}\.\d\.\d{2}\.\d{3}[FM]? (e.gнапр. A12.3.45.678)
if not id:match( '^A%d%d%.%d%.%d%d%.%d%d%d[FM]?$' ) then
return false
end
returnlocal longurl = '[http://tools.wmflabs.org/wikidata-externalid-url/?p=1323&url_prefix=https:%2F%2Fwww.unifr.ch%2Fifaa%2FPublic%2FEntryPage%2FTA98%20Tree%2FEntity%20TA98%20EN%2F&url_suffix=%20Entity%20TA98%20EN.htm&id='
return longurl..id..' '..id(label or 'Terminologia Anatomica')..']'..p.getCatForId( 'TA98' )
end
 
function p.tdviaLink( id, label )
--фармат рэг. выразу P7314: [a-z/-]+] (e.g. barkan-omer-lutfi)
if not id:match( '^[a-z/-]+$' ) then
return false
end
return '[https://islamansiklopedisi.org.tr/'..id..' '..id(label or 'Encyclopedia of Islam')..']'..p.getCatForId( 'TDVİA' )
end
 
function p.teLinktepapaLink( id, label )
--фармат рэг. выразу P1693P3544: E[1-8]\.\d{1,2}\.\d{1,2}\.\d{1,2}\.\d{1}\.\d{1}\.\d{1,3}+ (e.gнапр. E1.23.45.67.8.9.01)
local e1, e2 = id:match( '^E([1-8])%.(%d%d?)%.%d%d?%.%d%d?%.%d%.%d%.%d%d?%d?$' )
if not e1 then
return false
end
local TEnum = 'TEe0'..e1 --no formatter URL in WD, probably due to this complexity
if e1 == '5' or e1 == '7' then
if #e2 == 1 then e2 = '0'..e2 end
TEnum = TEnum..e2
end
return '[http://www.unifr.ch/ifaa/Public/EntryPage/ViewTE/'..TEnum..'.html '..id..']'..p.getCatForId( 'TE' )
end
 
function p.tepapaLink( id )
--фармат рэг. выразу P3544: \d+ (e.g. 1)
if not id:match( '^%d+$' ) then
return false
end
return '[https://collections.tepapa.govt.nz/agent/'..id..' '..id(label or 'Te Papa (New Zealand)')..']'..p.getCatForId( 'TePapa' )
end
 
function p.thLinktlsLink( id, label )
--фармат рэг. выразу P1694: H\d\.\d{2}\.\d{2}\.\d\.\d{5} (e.g. H1.23.45.6.78901)
local h1, h2 = id:match( '^H(%d)%.(%d%d)%.%d%d%.%d%.%d%d%d%d%d$' )
if not h1 then
return false
end
local THnum = 'THh'..h1..h2 --no formatter URL in WD, probably due to this complexity
return '[http://www.unifr.ch/ifaa/Public/EntryPage/ViewTH/'..THnum..'.html '..id..']'..p.getCatForId( 'TH' )
end
 
function p.tlsLink( id )
local id2 = id:gsub(' +', '_')
--фармат рэг. выразу P1362: \p{Lu}[\p{L}\d_',\.\-\(\)\*/–]{3,59} (напр. Abcd)
local class = "[%a%d_',%.%-%(%)%*/–]"
local regex = "'^%u"'..string.rep(class, 3)..string.rep(class.."'?"', 56).."'$"'
if not mw.ustring.match( id2id, regex ) then
return false
end
return '[http://tls.theaterwissenschaft.ch/wiki/'..id2id..' '..id(label or 'Theaterlexikon (Switzerland)')..']'..p.getCatForId( 'TLS' ) --https пакуль няма (9.2019)
end
 
function p.troveLink( id, label )
--фармат рэг. выразу P1315: [1-9]\d{5,7} (e.g. 12345678)
if not id:match( '^[1-9]%d%d%d%d%d%d?%d?$' ) then
return false
end
return '[https://trove.nla.gov.au/people/'..id..' '..id(label or 'Trove (Australia)')..']'..p.getCatForId( 'Trove' )
end
 
function p.ulanLinkukparlLink( id, label )
--фармат рэг. выразу P6213: [a-zA-Z\d]{8} (напр. 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..' '..(label or 'UK Parliament')..']'..p.getCatForId( 'UKPARL' )
end
 
function p.ulanLink( id, label )
--фармат рэг. выразу P245: 500\d{6} (e.g. 500123456)
if not id:match( '^500%d%d%d%d%d%d$' ) then
return false
end
return '[https://www.getty.edu/vow/ULANFullDisplay?find=&role=&nation=&subjectid='..id..' '..id(label or 'Artist Names (Getty)')..']'..p.getCatForId( 'ULAN' )
end
 
function p.uscongressLink( id, label )
--фармат рэг. выразу P1157: [A-Z]00[01]\d{3} (напр. A000123)
if not id:match( '^[A-Z]00[01]%d%d%d$' ) then
return false
end
return '[http://bioguide.congress.gov/scripts/biodisplay.pl?index='..id..' '..id(label or 'US Congress')..']'..p.getCatForId( 'USCongress' ) --https пакуль няма (9/2019)
end
 
function p.vcbaLink( id, label )
--фармат рэг. выразу P8034: \d{3}\/[1-9]\d{0,5} (напр. 494/9793)
if not id:match( '^%d%d%d\/[1-9]%d?%d?%d?%d?%d?$' ) then
return false
end
id = id:gsub('\/', '_')
return '[https://opac.vatlib.it/auth/detail/'..id..' '..(label or 'Vatican')..']'..p.getCatForId( 'VcBA' )
end
 
function p.viafLink( id, label )
--фармат рэг. выразу P214: [1-9]\d(\d{0,7}|\d{17,20}) (напр. 123456789, 1234567890123456789012)
if not id:match( '^[1-9]%d%d?%d?%d?%d?%d?%d?%d?$' ) and
Радок 689 ⟶ 836:
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),
return '[https://viaf.org/viaf/'..id..' '..id..']'..p.getCatForId( 'VIAF' )
-- then the code below could change from '[https://viaf.org/viaf/'..id..' '..id..']' to '[[:VIAF:'..id..'|'..id..']]'.
return '[https://viaf.org/viaf/'..id..' '..(label or 'VIAF')..']'..p.getCatForId( 'VIAF' )
end
 
Радок 696 ⟶ 845:
function p.append(str, c, length)
while str:len() < length do
str = c .. str
end
return str
Радок 711 ⟶ 860:
local result = (12 - remainder) % 11
if result == 10 then
return "'X"'
end
return tostring( result )
Радок 743 ⟶ 892:
 
--[[==========================================================================]]
--[[ Функцыі ВікіЗьвестак, навігацыйных шаблёнаў Функцыі ВікіЗьвестак і дакумэнтацыі ]]
--[[==========================================================================]]
 
Радок 757 ⟶ 906:
end
return ids
end
 
function p.matchesWikidataRequirements( itemId, reqs )
for _, group in ipairs( reqs ) do
local property = 'P' .. group[1]
local qid = group[2]
local statements = mw.wikibase.getBestStatements( itemId, property )
if statements then
for _, statement in ipairs( statements ) do
if statement.mainsnak.datavalue then
if statement.mainsnak.datavalue.value['numeric-id'] == qid then
return true
end end end end end
return false
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 = 'Вікіпэдыя:Артыкулы з хібнымі ідэнтыфікатарамі '..(specialCat or id)
return '* <span class="error">'..id..' id '..rawValue..' няслушны.</span>[[Катэгорыя:'..catName..']]'..p.redCatLink(catName)..'\n'
end
 
Радок 789 ⟶ 912:
local wikiTable = '{| class="wikitable sortable"\n' ..
'! rowspan=2 | Парамэтар\n' ..
'! rowspan=2 | МеткаСэкцыя\n' ..
'! rowspan=2 | Выглядае як\n'..
'! rowspan=2; data-sort-type=number | Уласьцівасьць ВікіЗьвестак\n' ..
'! colspan=4 | Катэгорыі адсочваньня і падлік старонак\n' ..
Радок 798 ⟶ 922:
'! Хібныя ID\n' ..
'|-\n'
 
local lang = mw.getContentLanguage()
for _, conf in pairs( p.conf ) do
local param, linkpid, pidsection = conf[1], conf[2], conf[34]
local appearsAs
if param == 'WORLDCATID' then
-- WorldCat is special
appearsAs = '[https://www.worldcat.org/identities/lccn-n78039510 WorldCat]'
elseif conf.prefix then
appearsAs = conf.prefix
else
appearsAs = conf[3](conf[5])
end
local link = conf.link or param..' (identifier)'
local category = conf.category or param
local args = { id = 'f', pid }
local wpl = frame:expandTemplate{ title = 'Спасылка на ўласьцівасьць ВікіЗьвестак', args = args }
--катэгорыі
--cats
local articleCat = 'Вікіпэдыя:Артыкулы з ідэнтыфікатарамі '..category
local userCat = 'Вікіпэдыя:Старонкі ўдзельнікаў з ідэнтыфікатарамі '..category
local miscCat = 'Вікіпэдыя:Старонкі з ідэнтыфікатарамі '..category
local faultyCat = 'Вікіпэдыя:Артыкулы з хібнымі ідэнтыфікатарамі '..category
--лічыльнікі
--counts
local articleCount = lang:formatNum( mw.site.stats.pagesInCategory(articleCat, 'старонак') )
local userCount = lang:formatNum( mw.site.stats.pagesInCategory(userCat, 'старонак') )
local miscCount = lang:formatNum( mw.site.stats.pagesInCategory(miscCat, 'старонак') )
local faultyCount = lang:formatNum( mw.site.stats.pagesInCategory(faultyCat, 'старонак') )
--разьлікі
--concat
P = P + 1 --падлік уласьцівасьцяў
a = a + lang:parseFormattedNumber(articleCount)
u = u + lang:parseFormattedNumber(userCount)
m = m + lang:parseFormattedNumber(miscCount)
f = f + lang:parseFormattedNumber(faultyCount)
--зьяднаць
wikiTable = wikiTable..'\n'..
'|-\n'..
'||[['..link..'|'..param..']]'..
'||'..linksection..
'||'..appearsAs..
'||data-sort-value='..pid..'|'..wpl..
'||style="text-align: right;"|[[:Катэгорыя:'..articleCat..'|'..articleCount..']]'..
Радок 826 ⟶ 967:
'||style="text-align: right;"|[[:Катэгорыя:'.. faultyCat..'|'.. faultyCount..']]'
end
 
return wikiTable .. '\n|}'
--дадаць падкатэгорыі WorldCat
local wcd = { 'WorldCat-LCCN', 'WorldCat-VIAF' }
for _, w in pairs(wcd) do
local articleCat = 'Вікіпэдыя:Артыкулы з ідэнтыфікатарамі '..w
local articleCount = lang:formatNum( mw.site.stats.pagesInCategory(articleCat, 'старонкі') )
local appearsAs
if w == 'WorldCat-LCCN' then
appearsAs = '[https://www.worldcat.org/identities/lccn-n79-113947 WorldCat (празь Бібліятэку Кангрэсу)]'
else
appearsAs = '[https://www.worldcat.org/identities/containsVIAFID/12345789 WorldCat (празь VIAF)]'
end
a = a + lang:parseFormattedNumber(articleCount)
wikiTable = wikiTable..'\n'..
'|-\n'..
'||'..'—'..
'||Агульныя'..
'||'..appearsAs..
'||data-sort-value='..w..'|'..'—'..
'||style="text-align: right;"|[[:Катэгорыя:'..articleCat..'|'..articleCount..']]'..
'||style="text-align: right;"|—'..
'||style="text-align: right;"|—'..
'||style="text-align: right;"|—'
end
--дадаць сумы
wikiTable = wikiTable..'\n'..
'|-\n'..
'! style="text-align: right;" colspan=3|Агулам'..
'||style="text-align: right;"|'..lang:formatNum(P)..
'||style="text-align: right;"|'..lang:formatNum(a)..
'||style="text-align: right;"|'..lang:formatNum(u)..
'||style="text-align: right;"|'..lang:formatNum(m)..
'||style="text-align: right;"|'..lang:formatNum(f)
return require('Модуль:Глушэньне катэгорыяў').main(wikiTable)..'\n|}'
end
 
Радок 833 ⟶ 1009:
--[[==========================================================================]]
 
-- IfPlease a specificuse "<parameter> (identifier) redirect" existsredirects forrather anthan identifier,linking directly to the pleasetarget routepage.
-- This reduces clutter in "What links here" on both the redirect and the target,
-- through this particular redirect rather than linking directly to the target page.
-- and improves reverse lookup of articles where a manifestation of each identifier is used.
-- 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
local reqs = {}
 
-- Фарматбазавы парамэтраўфармат табліцы p.conf: { 'назва парамэтру', 'метка', № уласьцівасьці ў ВікіЗьвестках, функцыя фарматаваньня/спраўджваньня, сэкцыя, прыклад ID для дакумэнтацыі }
-- неабавязковыя іменаваныя парамэтры табліцы p.conf:
-- спасылка: каб замяніць спасылку ў дакумэнтацыі (дапомна — "<парамэтар> (ідэнтыфікатар)")
-- катэгорыя: каб замяніць ID у назьве катэгорыі (дапомна — "... з ідэнтыфікатарамі <парамэтар>")
-- прэфікс: каб дадаць прэфікс (звычайна вікіспасылка з тлумачэньне, што азначае ідэнтыфікатар) перад самой вонкавай спасылкай
p.conf = {
{ 'AAG', 3372, p.aagLink, 'Мастацкія галерэі і музэі', '1' },
{ 'AAG', '[[Оклэндзкая мастацкая галерэя|AAG]]', 3372, p.aagLink },
{ 'ACM-DL', 864, p.acmLink, 'Навуковыя базы зьвестак', '12345678901', link = 'Лічбавая бібліятэка' },
{ 'ACM-DL', '[[Лічбавая бібліятэка|ACM ЛБ]]', 864, p.acmLink },
{ 'ADB', 1907, p.adbLink, 'Біяграфічныя слоўнікі', 'barton-sir-edmund-toby-71' },
{ 'ADB', '[[Аўстралійскі біяграфічны слоўнік|ADB]]', 1907, p.adbLink },
{ 'AGSA', 6804, p.agsaLink, 'Мастацкія галерэі і музэі', '3625' },
{ 'AGSA', '[[Мастацкая галерэя Паўднёвай Аўстраліі|AGSA]]', 6804, p.agsaLink },
{ 'autores.uy', '[[autores.uy]]', 2558, p.autoresuyLink, 'Біяграфічныя слоўнікі', '12345' },
{ 'AWR', 4186, p.awrLink, 'Біяграфічныя слоўнікі', 'PR00768b' },
{ 'AWR', '[[Рэестар аўстралійскіх жанчынаў|AWR]]', 4186, p.awrLink },
{ 'BIBSYS', 1015, p.bibsysLink, 'Нацыянальныя бібліятэкі', '1234567890123' },
{ 'BALaT', '[[:d:Q2876688|BALaT]]', 3293, p.balatLink },
{ 'Bildindex', 2092, p.bildLink, 'Мастацкія дасьледчыя інстытуты', '1' },
{ 'BIBSYS', '[[Bibsys|BIBSYS]]', 1015, p.bibsysLink },
{ 'BNC', 1890, p.bncLink, 'Нацыянальныя бібліятэкі', '123456789' },
{ 'Bildindex', '[[Марбурскі каталёг выяваў|Bildindex]]', 2092, p.bildLink },
{ 'BNE', 950, p.bneLink, 'Нацыянальныя бібліятэкі', 'XX1234567' },
{ 'BNC', '[[Нацыянальная бібліятэка Чылі|BNC]]', 1890, p.bncLink },
{ 'BNF', 268, p.bnfLink, 'Нацыянальныя бібліятэкі', '123456789' },
{ 'BNE', '[[Нацыянальная бібліятэка Гішпаніі|BNE]]', 950, p.bneLink },
{ 'Botanist', 428, p.botanistLink , 'Навуковыя базы зьвестак', 'L.' },
{ 'BNF', '[[Нацыянальная бібліятэка Францыі|BNF]]', 268, p.bnfLink },
{ 'BPN', 651, p.bpnLink , 'Біяграфічныя слоўнікі', '12345678' },
{ 'Botanist', '[[Аўтарская назва (батаніка)|Botanist]]', 428, p.botanistLink },
{ 'CANTIC', 1273, p.canticLink, 'Нацыянальныя бібліятэкі', 'a12345678' },
{ 'BPN', '[[Нідэрляндзкі біяграфічны партал|BPN]]', 651, p.bpnLink },
{ 'CINII', 271, p.ciniiLink, 'Навуковыя базы зьвестак', 'DA12345678', link = 'CiNii' },
{ 'CANTIC', '[[Бібліяграфічны каталёг назваў і загалоўкаў Каталёніі|CANTIC]]', 1273, p.canticLink },
{ 'CINIICWGC', '[[CiNii]]', 2711908, p.ciniiLinkcwgcLink, 'Іншыя', '1234567' },
{ 'DAAO', 1707, p.daaoLink, 'Мастацкія дасьледчыя інстытуты', 'rolf-harris' },
{ 'DAAO', '[[Слоўнік аўстралійскіх творцаў|DAAO]]', 1707, p.daaoLink },
{ 'DBLP', '[[DBLP]]', 2456, p.dblpLink, 'Навуковыя базы зьвестак', '123/123' },
{ 'DIB', 6829, p.dibLink, 'Біяграфічныя слоўнікі', 'a1234' },
{ 'DSI', '[[Штутгарцкая база зьвестак навуковых ілюстрацыяў|DSI]]', 2349, p.dsiLink },
{ 'DSI', 2349, p.dsiLink, 'Мастацкія дасьледчыя інстытуты', '1538' },
{ 'FNZA', '[[:d:Property:P6792|FNZA]]', 6792, p.fnzaLink },
{ 'EMU', 4613, p.emuLink, 'Нацыянальныя бібліятэкі', '15409' },
{ 'GND', '[[Gemeinsame Normdatei|GND]]', 227, p.gndLink },
{ 'FAST', 2163, p.fastLink, 'Іншыя', '1' },
{ 'HDS', '[[Гістарычны слоўнік Швайцарыі|HDS]]', 902, p.hdsLink },
{ 'FNZA', 6792, p.fnzaLink, 'Мастацкія дасьледчыя інстытуты', '12' },
{ 'IAAF', '[[Сусьветная лёгкая атлетыка|СЛА]]', 1146, p.iaafLink },
{ 'GND', 227, p.gndLink, 'Агульныя', '4079154-3' },
{ 'ICIA', '[[Інфармацыйны цэнтар ізраільскага мастацтва|ICIA]]', 1736, p.iciaLink },
{ 'HDS', 902, p.hdsLink, 'Іншыя', '050123' },
{ 'ISNI', '[[Міжнародны стандартны ідэнтыфікатар імёнаў|ISNI]]', 213, p.isniLink },
{ 'IAAF', 1146, p.iaafLink, 'Іншыя', '123' },
{ 'Joconde', '[[Джаконда (каталёг)|Joconde]]' , 347, p.jocondeLink },
{ 'ICCU', 396, p.iccuLink, 'Нацыянальныя бібліятэкі', 'IT\\ICCU\\CFIV\\000163' }, --былы SBN
{ 'KULTURNAV', '[[KulturNav]]', 1248, p.kulturnavLink },
{ 'ICIA', 1736, p.iciaLink, 'Мастацкія дасьледчыя інстытуты', '1' },
{ 'LCCN', '[[Кантрольны нумар Бібліятэкі Кангрэсу|LCCN]]', 244, p.lccnLink },
{ 'IEU', 9070, p.ieuLink, 'Іншыя', 'N\\A\\NationalAcademyofArtandArchitecture' },
{ 'LIR', '[[Гістарычны слоўнік Швайцарыі#Lexicon_Istoric_Retic|LIR]]', 886, p.lirLink },
{ 'ISNI', 213, p.isniLink, 'Агульныя', '0000-0000-6653-4145', prefix = '[[Міжнародны стандартны ідэнтыфікатар імёнаў|ISNI]]' },
{ 'LNB', '[[Нацыянальная бібліятэка Латвіі|LNB]]', 1368, p.lnbLink },
{ 'Joconde', 347, p.jocondeLink, 'Мастацкія дасьледчыя інстытуты', '12345678901' },
{ 'Léonore', '[[Леанора (каталёг)|Léonore]]', 640, p.leonoreLink },
{ 'KULTURNAV', 1248, p.kulturnavLink, 'Мастацкія дасьледчыя інстытуты', '12345678-1234-1234-1234-1234567890AB', link = 'KulturNav' },
{ 'MBA', '[[MusicBrainz]]', 434, p.mbaLink, category = 'MusicBrainz' },
{ 'LCCN', 244, p.lccnLink, 'Нацыянальныя бібліятэкі', 'n78039510' },
{ 'MBAREA', '[[MusicBrainz]]', 982, p.mbareaLink, category = 'MusicBrainz area' },
{ 'MBILIR', '[[MusicBrainz]]', 1330886, p.mbiLinklirLink, category ='Іншыя', 'MusicBrainz instrument1' },
{ 'LNB', 1368, p.lnbLink, 'Нацыянальныя бібліятэкі', '123456789' },
{ 'MBL', '[[MusicBrainz]]', 966, p.mblLink, category = 'MusicBrainz label' },
{ 'Léonore', 640, p.leonoreLink, 'Іншыя', 'LH//1/1', prefix = '[[Леанора (каталёг)|Léonore (Францыя)]]' },
{ 'MBP', '[[MusicBrainz]]', 1004, p.mbpLink, category = 'MusicBrainz place' },
{ 'MA', 6366, p.maLink, 'Іншыя', '123456789' },
{ 'MBRG', 'групавы выпуск [[MusicBrainz]]', 436, p.mbrgLink, category = 'MusicBrainz release group' },
{ 'MBSMBA', '[[MusicBrainz]]', 1407434, p.mbsLinkmbaLink, 'Іншыя', '12345678-1234-1234-1234-1234567890AB', category = 'MusicBrainz series' }, --special cat name
{ 'MBWMBAREA', 'твор982, [[MusicBrainz]]'p.mbareaLink, 435'Іншыя', p.mbwLink'12345678-1234-1234-1234-1234567890AB', category = 'MusicBrainz work' }, --special cat name
{ 'MBI', 1330, p.mbiLink, 'Іншыя', '12345678-1234-1234-1234-1234567890AB', category = 'MusicBrainz' }, --special cat name
{ 'MGP', '[[Матэматычная генэалёгія|MGP]]', 549, p.mgpLink },
{ 'MBL', 966, p.mblLink, 'Іншыя', '12345678-1234-1234-1234-1234567890AB', category = 'MusicBrainz' }, --special cat name
{ 'NARA', '[[Нацыянальная адміністрацыя архіваў і дакумэнтаў|NARA]]', 1225, p.naraLink },
{ 'MBP', 1004, p.mbpLink, 'Іншыя', '12345678-1234-1234-1234-1234567890AB', category = 'MusicBrainz' }, --special cat name
{ 'NCL', '[[Нацыянальная цэнтральная бібліятэка (Тайвань)|NCL]]', 1048, p.nclLink },
{ 'MBRG', 436, p.mbrgLink, 'Іншыя', '12345678-1234-1234-1234-1234567890AB', category = 'MusicBrainz' }, --special cat name
{ 'NDL', '[[Нацыянальная парлямэнцкая бібліятэка (Японія)|NDL]]', 349, p.ndlLink },
{ 'MBS', 1407, p.mbsLink, 'Іншыя', '12345678-1234-1234-1234-1234567890AB', category = 'MusicBrainz' }, --special cat name
{ 'NGV', '[[Нацыянальная галерэя Вікторыі|NGV]]', 2041, p.ngvLink },
{ 'MBW', 435, p.mbwLink, 'Іншыя', '12345678-1234-1234-1234-1234567890AB', category = 'MusicBrainz' }, --special cat name
{ 'NKC', '[[Нацыянальная бібліятэка Чэхіі|NKČ]]', 691, p.nkcLink },
{ 'MGP', 549, p.mgpLink, 'Навуковыя базы зьвестак', '123456' },
{ 'NLA', '[[Нацыянальная бібліятэка Аўстраліі|NLA]]', 409, p.nlaLink },
{ 'NARA', 1225, p.naraLink, 'Іншыя', '12345678' },
{ 'NLB', '[[Зводны электронны каталёг бібліятэк Беларусі|NLB]]', 3390, p.nlbLink },
{ 'NCL', 1048, p.nclLink, 'Нацыянальныя бібліятэкі', '1081436' },
{ 'NLG', '[[Нацыянальная бібліятэка Грэцыі|NLG]]', 3348, p.nlgLink },
{ 'NDL', 349, p.ndlLink, 'Нацыянальныя бібліятэкі', '012345678' },
{ 'NLI', '[[Нацыянальная бібліятэка Ізраілю|NLI]]', 949, p.nliLink },
{ 'NGV', 2041, p.ngvLink, 'Мастацкія галерэі і музэі', '12354' },
{ 'NLK', '[[Нацыянальная бібліятэка Карэі|NLK]]', 5034, p.nlkLink },
{ 'NKC', 691, p.nkcLink, 'Нацыянальныя бібліятэкі', 'abcd12345678901234' },
{ 'NLP', '[[Нацыянальная бібліятэка Польшчы|NLP]]', 1695, p.nlpLink },
{ 'NLA', 409, p.nlaLink, 'Нацыянальныя бібліятэкі', '123456789012' },
{ 'NLR', '[[Нацыянальная бібліятэка Румыніі|NLR]]', 1003, p.nlrLink },
{ 'NLB', 3390, p.nlbLink, 'Нацыянальныя бібліятэкі', 'NLB-ar2443646' },
{ 'NSK', '[[Нацыянальная і ўнівэрсытэцкая бібліятэка Заграбу|NSK]]', 1375, p.nskLink },
{ 'NLG', 3348, p.nlgLink, 'Нацыянальныя бібліятэкі', '12345678' },
{ 'NTA', '[[Каралеўская бібліятэка Нідэрляндаў|NTA]]', 1006, p.ntaLink },
{ 'NLI', 949, p.nliLink, 'Нацыянальныя бібліятэкі', '123456789' },
{ 'ORCID', '[[ORCID]]', 496, p.orcidLink },
{ 'NLK', 5034, p.nlkLink, 'Нацыянальныя бібліятэкі', 'KAB197000000' },
{ 'PIC', '[[:d:Q23892012|PIC]]', 2750, p.picLink },
{ 'NLP', 1695, p.nlpLink, 'Нацыянальныя бібліятэкі', '9810123456789012345' },
{ 'RID', '[[ResearcherID]]', 1053, p.ridLink },
{ 'NLR', 1003, p.nlrLink, 'Нацыянальныя бібліятэкі', '123456789' },
{ 'RERO', '[[Бібліятэчная сетка Заходняй Швайцарыі|RERO]]', 3065, p.reroLink },
{ 'NSK', 1375, p.nskLink, 'Нацыянальныя бібліятэкі', '123456789' },
{ 'RKDartists', '[[Нідэрляндзкі інстытут гісторыі мастацтва|RKD]]', 650, p.rkdartistsLink },
{ 'NTA', 1006, p.ntaLink, 'Нацыянальныя бібліятэкі', '12345678X' },
{ 'RKDID', '[[:d:Q17299580|RKDimages ID]]', 350, p.rkdidLink },
{ 'ORCID', 496, p.orcidLink, 'Агульныя', '0000-0002-7398-5483', prefix = '[[ORCID]]' },
{ 'RSL', '[[Расейская дзяржаўная бібліятэка|RSL]]', 947, p.rslLink },
{ 'PIC', 2750, p.picLink, 'Мастацкія дасьледчыя інстытуты', '1' },
{ 'SBN', '[[Цэнтральны інстытут зводнага каталёгу бібліятэкаў Італіі|ICCU]]', 396, p.sbnLink },
{ 'PLWABN', 7293, p.plwabnLink, 'Нацыянальныя бібліятэкі', '9812345678905606' },
{ 'SELIBR', '[[LIBRIS|SELIBR]]', 906, p.selibrLink },
{ 'Publons', 3829, p.publonsLink, 'Навуковыя базы зьвестак', '2776255' },
{ 'SIKART', '[[SIKART]]', 781, p.sikartLink },
{ 'RERO', 3065, p.reroLink, 'Іншыя', '02-A012345678', prefix = '[[RERO (identifier)|RERO (Switzerland)]]' },
{ 'SNAC-ID', '[[SNAC]]', 3430, p.snacLink },
{ 'RID', 1053, p.ridLink, 'Навуковыя базы зьвестак', 'A-1234-1934' },
{ 'SUDOC', '[[Унівэрсытэцкая сыстэма дакумэнтацыі (Францыя)|SUDOC]]', 269, p.sudocLink },
{ 'RISM', 5504, p.rismLink, 'Іншыя', 'pe1', prefix = '[[RISM (identifier)|RISM (France)]]' },
{ 'S2AuthorId', '[[Semantic Scholar|S2AuthorId]]', 4012, p.s2authoridLink, category = 'аўтар Semantic Scholar' },
{ 'RKDartists', 650, p.rkdartistsLink, 'Мастацкія дасьледчыя інстытуты', '123456' },
{ 'TA98', '[[Terminologia Anatomica|TA98]]', 1323, p.ta98Link },
{ 'RKDID', 350, p.rkdidLink, 'Мастацкія дасьледчыя інстытуты', '123456' },
{ 'TDVİA', '[[:d:Q21527102|TDVİA]]', 7314, p.tdviaLink },
{ 'RSL', 947, p.rslLink, 'Нацыянальныя бібліятэкі', '123456789' },
{ 'TE', '[[Terminologia Embryologica|TE]]', 1693, p.teLink },
{ 'SELIBR', 906, p.selibrLink, 'Нацыянальныя бібліятэкі', '123456' },
{ 'TePapa', '[[Музэй Новай Зэляндыі Тэ Папа Тангарэва|TePapa]]', 3544, p.tepapaLink },
{ 'SIKART', 781, p.sikartLink, 'Мастацкія дасьледчыя інстытуты', '123456789' },
{ 'TH', '[[Terminologia Histologica|TH]]', 1694, p.thLink },
{ 'SNAC-ID', 3430, p.snacLink, 'Іншыя', 'A' },
{ 'TLS', '[[Тэатральны слоўнік Швайцарыі|TLS]]', 1362, p.tlsLink },
{ 'SUDOC', 269, p.sudocLink, 'Іншыя', '026927608', prefix = '[[Унівэрсытэцкая сыстэма дакумэнтацыі (Францыя)|SUDOC (Францыя)]]' },
{ 'Trove', '[[Trove]]', 1315, p.troveLink }, --formerly NLA-person
{ 'S2AuthorId', 4012, p.s2authoridLink, 'Навуковыя базы зьвестак', '1796130', category = 'аўтар Semantic Scholar' }, --special cat name
{ 'ULAN', '[[Зводны сьпіс імёнаў мастацкіх дзеячоў|ULAN]]', 245, p.ulanLink },
{ 'TA98', 1323, p.ta98Link, 'Навуковыя базы зьвестак', 'A12.3.45.678' },
{ 'USCongress', '[[Біяграфічны каталёг Кангрэсу ЗША|US Congress]]', 1157, p.uscongressLink },
{ 'TDVİA', 7314, p.tdviaLink, 'Іншыя', 'asim-b-behdele' },
{ 'VIAF', '[[Virtual International Authority File|VIAF]]', 214, p.viafLink },
{ 'TePapa', 3544, p.tepapaLink, 'Мастацкія галерэі і музэі', '1' },
{ 'WORLDCATID', '[[WorldCat|WorldCat Identities]]', 7859, nil },
{ 'TLS', 1362, p.tlsLink, 'Іншыя', 'Abcd' },
{ 'Trove', 1315, p.troveLink, 'Іншыя', '12345678', prefix = '[[Trove|Trove (Аўстралія)]]' }, --былы NLA-асоба
{ 'UKPARL', 6213, p.ukparlLink, 'Іншыя', 'AQUupyiR' },
{ 'ULAN', 245, p.ulanLink, 'Мастацкія дасьледчыя інстытуты', '500123456' },
{ 'USCongress', 1157, p.uscongressLink, 'Іншыя', 'A000123', link = 'Біяграфічны каталёг Кангрэсу ЗША' },
{ 'VcBA', 8034, p.vcbaLink, 'Нацыянальныя бібліятэкі', '494/9793' },
{ 'VIAF', 214, p.viafLink, 'Агульныя', '123456789', prefix = '[[Virtual International Authority File|VIAF]]' },
{ 'WORLDCATID', 7859, nil, 'Агульныя', nil, link = 'WorldCat' },
}
 
Радок 926 ⟶ 1110:
-- Format: { 'alias', 'parameter name in p.conf' }
p.aliases = {
{ 'DNB', 'GND' }, --Deutsche Nationalbibliothek -> Gemeinsame Normdatei
{ 'RLS', 'RSL' },
{ 'Leonore', 'Léonore' }, --alias name without diacritics
{ 'leonore', 'Léonore' }, --lowercase variant without diacritics
{ 'MusicBrainz', 'MBA' },
{ 'MusicBrainz artist', 'MBA' },
Радок 932 ⟶ 1118:
{ 'MusicBrainz release group', 'MBRG' },
{ 'MusicBrainz work', 'MBW' },
{ 'SBN', 'ICCU' }, --SBN alias to be deprecated at a later stage
{ 'Leonore', 'Léonore' },
{ 'TDVIA', 'TDVİA' }, --alias name without diacritics
{ 'tdvia', 'TDVİA' }, --lowercase variant without diacritics
}
 
-- Нерэкамэндаваныя сынонімы ў p.conf; адсочваюцца ў [[Катэгорыя:Вікіпэдыя:Артыкулы зь нерэкамэндаванымі бібліяграфічнымі ідэнтыфікатарамі]]
-- Deprecated aliases to p.conf; tracked in [[Category:Wikipedia articles with deprecated authority control identifiers]]
-- Фармат: { 'назва нерэкамэндаванага парамэтру', 'назва парамэтру-заменьніка ў p.conf' }
-- Format: { 'deprecated parameter name', 'replacement parameter name in p.conf' }
p.deprecated = {
{ 'GKD', 'GND' },
{ 'PND', 'GND' },
{ 'SWD', 'GND' },
{ 'NARA-organization', 'NARA' },
{ 'NARA-person', 'NARA' },
{ 'PND', 'GND' },
{ 'RLS', 'RSL' },
{ 'SWD', 'GND' },
}
 
Радок 950 ⟶ 1139:
 
function p.authorityControl( frame )
local resolveEntity = require( "'Модуль:ПошукЗапісуВікізьвестак"' )
local parentArgs = frame:getParent().args --WD IDs added here later
local title = mw.title.getCurrentTitle()
local iParentArgs = 0 --count original/manual parent args only later
local namespace = title.namespace
local testcases = (string.sub(title.subpageText,1,9) == 'testcases')
local parentArgs = frame:getParent().args
local elements = {} --create/insert rows later
local worldcatCat = ''
local elementsCat = ''
local multipleIdCat = ''
local suppressedIdCat = ''
local suppressedIdCatArts = ''
local deprecatedIdCat = ''
local differentOnWDCat = ''
 
local sameOnWDCat = ''
local stateCat = ''
--Redirectredirect aliases to proper parameter names
for _, a in pairs( p.aliases ) do
local alias, param = a[1], a[2]
Радок 969 ⟶ 1160:
end
--Redirectredirect deprecated parameters to proper parameter names, and assign tracking cat
for _, d in pairs( p.deprecated ) do
local dep, param = d[1], d[2]
Радок 980 ⟶ 1171:
end
--Useuse QID= parameter for testing/example purposes only
local itemId = nil
if namespace ~= 0 then
Радок 992 ⟶ 1183:
end
--Wikidata fallback if requestedavailable
if itemId then
local suppressedIdCount = 0
local iMatches = 0
for _, params in ipairs( p.conf ) do
if params[32] > 0 then
local val = parentArgs[mw.ustring.lower(params[1])] or parentArgs[params[1]]
if val == nil or val == '' then
local wikidataIds = p.getIdsFromWikidata( itemId, 'P'..params[2] )
local canUseWikidata = nil
if reqs[paramswikidataIds[1]] then
if val == '' and (namespace == 0 or testcases) then
canUseWikidata = p.matchesWikidataRequirements( itemId, reqs[params[1]] )
suppressedIdCount = suppressedIdCount + 1
else
suppressedIdCat = '[[Катэгорыя:Вікіпэдыя:Артыкулы з заглушанымі бібліяграфічнымі ідэнтыфікатарамі|'..params[1]..']]'
canUseWikidata = true
else
parentArgs[params[1]] = wikidataIds[1] --add ID from WD
end
end
else
if canUseWikidata then
iParentArgs = iParentArgs + 1
local wikidataIds = p.getIdsFromWikidata( itemId, 'P' .. params[32] )
if wikidataIds[1] and differentOnWDCat == '' then
local bMatch = false
if val == '' and (namespace == 0 or testcases) then
for _, wd in pairs( wikidataIds ) do
suppressedIdCat = '[[Катэгорыя:Вікіпэдыя:Артыкулы з заглушанымі бібліяграфічнымі ідэнтыфікатарамі|'..params[1]..']]'
elseif val == wd then
parentArgs[params[1]]iMatches = wikidataIds[iMatches + 1]
bMatch = true
end end end end end end end
end
end
if bMatch == false then
differentOnWDCat = '[[Катэгорыя:Вікіпэдыя:Старонкі з нарматыўным кантролем, парамэтры якіх адрозьніваюцца ад Вікізьвестак|'..params[1]..']]'
end end end end end
if iMatches > 0 and iMatches == iParentArgs then
sameOnWDCat = '[[Катэгорыя:Вікіпэдыя:Старонкі з нарматыўным кантролем, парамэтры якіх ідэнтычныя Вікізьвесткам]]'
end
if parentArgs['arts'] == 'arts' and suppressedIdCount > 0 then
if namespace == 0 or testcases then
local s = 's'
if suppressedIdCount == 1 then s = '' end
local sCat = 'ACArt with '..suppressedIdCount..' suppressed element'..s
suppressedIdCatArts = '[[Катэгорыя:'..sCat..']]'..p.redCatLink(sCat)
end
end
end
--Сканфігураваныяканфігуруем шэрагі
local rct = 0
local sectionOrder = {'Агульныя', 'Нацыянальныя бібліятэкі', 'Мастацкія галерэі і музэі',
'Мастацкія дасьледчыя інстытуты', 'Біяграфічныя слоўнікі', 'Навуковыя базы зьвестак',
'Іншыя'}
local sections = {
['Агульныя'] = {},
['Нацыянальныя бібліятэкі'] = {},
['Мастацкія галерэі і музэі'] = {},
['Мастацкія дасьледчыя інстытуты'] = {},
['Біяграфічныя слоўнікі'] = {},
['Навуковыя базы зьвестак'] = {},
['Іншыя'] = {}
}
--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
if parentArgs.PLWABN or parentArgs.plwabn then
parentArgs.NLP = ''
parentArgs.nlp = ''
end
for _, params in ipairs( p.conf ) do
local val = parentArgs[mw.ustring.lower(params[1])] or parentArgs[params[1]]
local tval, tlinks = {}, {} --init tables
if val and val ~= '' and type(params[4]) == 'function' then
if val and val ~= '' and type(params[3]) == 'function' then
table.insert( elements, p.createRow( params[1], params[2]..':', val, params[4]( val ), true, params.category ) )
table.insert( tval, val )
if params.prefix then
table.insert( tlinks, params[3]( val, '1' ) )
else
table.insert( tlinks, params[3]( val ) )
end
end
--зьбіраем іншыя ўнікальныя значэньні (ID) зь Вікізьвестак, калі ёсьць
if itemId and tval[1] then
local nextIdVal = 2
local wikidataIds = p.getIdsFromWikidata( itemId, 'P'..params[2] )
for _, v in pairs( wikidataIds ) do
local bnew = true
for _, w in pairs( tval ) do
if v == w then bnew = false end
end
if bnew then
table.insert( tval, v )
table.insert( tlinks, params[3]( v, tostring(nextIdVal) ) )
nextIdVal = nextIdVal + 1
end
end
end
--assemble
if tval[1] then
table.insert( sections[params[4]], p.createRow( params[1], tval, nil, tlinks, true, params.category, params.prefix) )
rct = rct + 1
if tval[2] then
multipleIdCat = p.getCatForId( 'multiple' )
end
end
end
--WorldCat
local worldcatId = parentArgs['worldcatid'] or parentArgs['WORLDCATID']
if worldcatId and worldcatId ~= '' then --калі WORLDCATID ёсьцьпрысутны &і не заглушанынезаглушаны
table.insert( elementssections['Агульныя'], p.createRow( 'WORLDCATID', '', worldcatId, '[[WorldCat Identities]]: [https://www.worldcat.org/identities/'..mw.uri.encode(worldcatId, 'PATH')..' '..worldcatId..'WorldCat]', nil, false ) ) --спраўджаньнеValidation?
worldcatCat = p.getCatForId( 'WORLDCATID' )
--worldcatCat = '[[Катэгорыя:Вікіпэдыя:Артыкулы з ідэнтыфікатарамі WorldCat]]'
rct = rct + 1
elseif worldcatId == nil then --калі WORLDCATID адсутнічае & не заглушаны
elseif worldcatId == nil then --калі WORLDCATID адсутны, але незаглушаны
local viafId = parentArgs['VIAF']
local lccnIdviafId = parentArgs['LCCNviaf'] or parentArgs['VIAF']
local lccnId = parentArgs['lccn'] or parentArgs['LCCN']
if viafId and viafId ~= '' and p.viafLink( viafId ) then --VIAF мусіць быць, незаглушаны & пацьверджаны
if viafId and viafId ~= '' and p.viafLink( viafId ) then --VIAF мусіць прысутнічаць, быць незаглушаным і спраўджаным
table.insert( elements, p.createRow( 'VIAF', '', viafId, '[[WorldCat]] (праз VIAF): [https://www.worldcat.org/identities/containsVIAFID/'..viafId..' '..viafId..']', false ) )
table.insert( sections['Агульныя'], p.createRow( 'VIAF', viafId, '[https://www.worldcat.org/identities/containsVIAFID/'..viafId..' WorldCat (празь VIAF)]', nil, false ) )
elseif lccnId and lccnId ~= '' and p.lccnLink( lccnId ) then --LCCN мусіць быць, незаглушаны & пацьверджаны
if namespace == 0 then
worldcatCat = '[[Катэгорыя:Вікіпэдыя:Артыкулы з ідэнтыфікатарамі WorldCat-VIAF]]'
end
rct = rct + 1
elseif lccnId and lccnId ~= '' and p.lccnLink( lccnId ) then --LCCN мусіць прысутнічаць, быць незаглушаным і спраўджаным
local lccnParts = p.splitLccn( lccnId )
if lccnParts and lccnParts[1] ~= 'sh' then
local lccnIdFmtd = lccnParts[1]..lccnParts[2]..'-'..lccnParts[3]
table.insert( elementssections['Агульныя'], p.createRow( 'LCCN', '', lccnId, '[[WorldCat]] (праз LCCN): [https://www.worldcat.org/identities/lccn-'..lccnIdFmtd..' '..lccnIdFmtd..'WorldCat (празь Бібліятэку Кангрэсу)]', nil, false ) )
if namespace == 0 then
worldcatCat = '[[Катэгорыя:Вікіпэдыя:Артыкулы з ідэнтыфікатарамі WorldCat-LCCN]]'
end
end
rct = rct + 1
end
elseif worldcatId == '' then --калі WORLDCATID заглушаны
suppressedIdCat = '[[Катэгорыя:Вікіпэдыя:Артыкулы з заглушанымі бібліяграфічнымі ідэнтыфікатарамі|WORLDCATID]]'
end
local Navbox = require('Модуль:Навігацыйная табліца')
local elementsCat = ''
if rct >= 25 then
local eCat = 'Вікіпэдыя:Бібліяінфармацыя з ' .. rct .. ' элемэнтамі'
-- elementsCat = '[[Катэгорыя:' .. eCat .. ']]' .. p.redCatLink(eCat)
end
 
--канфігуруем навігацыйную табліцу
local outString = ''
if #elementsrct > 0 then
local Navbox = require('Модуль:Навігацыйная табліца')
local args = {}
local sectionID = 1
if testcases and itemId then args = { qid = itemId } end --ёмкі
local args = { pid = 'identifiers' } -- #target the list of identifiers
if testcases and itemId then args = { pid = 'identifiers', qid = itemId } end --ёмкі
local pencil = frame:expandTemplate{ title = 'Рэдагаваць у Вікізьвестках', args = args}
local navboxArgs = {
outString = Navbox._navbox( {
['назва_шаблёну']name = 'Бібліяінфармацыя',
['кляса_шаблёну']navboxclass = 'authority-control',
['кляса_карткі']bodyclass = 'hlist',
state = parentArgs.state or 'autocollapse',
['група_інфармацыі1'] = '[[Дапамога:Нарматыўны кантроль|Нарматыўны кантроль]]' .. pencil,
navbar = 'off'
['сьпіс1'] = table.concat( elements )
} )
for _, sectName in ipairs(sectionOrder) do
local auxCats = worldcatCat .. elementsCat .. suppressedIdCat .. deprecatedIdCat
if testcases#sections[sectName] ~= 0 then
navboxArgs['group'..sectionID] = sectName
auxCats = mw.ustring.gsub(auxCats, '(%[%[)(Катэгорыя)', '%1:%2') --прасьцейшая праверка
navboxArgs['list'..sectionID] = table.concat(sections[sectName])
sectionID = sectionID + 1
end
end
if navboxArgs.group2 then
outString = outString .. auxCats
navboxArgs.title = '[[Дапамога:Нарматыўны кантроль|Нарматыўны кантроль]]'..pencil
if namespace ~= 0 then
else
outString = mw.ustring.gsub(outString, '(%[%[)(Катэгорыя:Артыкулы)', '%1:%2') --паводле азначэньня
local sect = navboxArgs.group1
if sect == 'Агульныя' or sect == 'Іншыя' then
-- калі ёсьць толькі агульныя ці толькі іншыя ID, то выводзім толькі „Бібліяінфармацыя“ бязь метак
-- паколькі „агульныя“ — залішне, а „іншыя“ — сьмешна, калі няма іншых „іншых“
navboxArgs.group1 = '[[Дапамога:Нарматыўны кантроль|Нарматыўны кантроль]]'..pencil
else
navboxArgs.group1 = '[[Дапамога:Нарматыўны кантроль|Нарматыўны кантроль: '..sect..']] '..pencil
end
end
outString = Navbox._navbox(navboxArgs)
end
 
--auxCats
if rct == 0 or rct >= 25 then
if namespace == 0 or testcases then
local eCat = 'AC з '..rct..' элемэнтамі'
elementsCat = '[[Катэгорыя:'..eCat..']]'..p.redCatLink(eCat)
end
end
if parentArgs.state then
if namespace == 0 or testcases then
local sCat
if parentArgs.state == 'collapsed' then sCat = 'AC using state parameter: collapsed'
elseif parentArgs.state == 'expanded' then sCat = 'AC using state parameter: expanded'
elseif parentArgs.state == 'autocollapse' then sCat = 'AC using state parameter: autocollapse'
else sCat = 'AC using state parameter: other'
end
stateCat = '[[Катэгорыя:'..sCat..']]'..p.redCatLink(sCat)
end
end
local auxCats = worldcatCat..elementsCat..multipleIdCat..suppressedIdCat..suppressedIdCatArts..
deprecatedIdCat..differentOnWDCat..sameOnWDCat..stateCat
if testcases then
auxCats = mw.ustring.gsub(auxCats, '(%[%[)(Катэгорыя)', '%1:%2') --дзеля прасьцейшай праверкі
end
 
--вывад
outString = outString..auxCats
if namespace ~= 0 then
outString = mw.ustring.gsub(outString, '(%[%[)(Катэгорыя:Вікіпэдыя:Артыкулы)', '%1:%2') --паводле азначэньня
end