Модуль:Бібліяінфармацыя: розьніца паміж вэрсіямі
Змесціва выдалена Змесціва дададзена
д выпраўленьне на просьбу Удзельнік: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 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]],
-- паразважайце, ці ня варта маршрутаваць праз гэты прэфікс замест 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..'/ '..
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..' '..
end
function p.adbLink( id, label )
--фармат рэг. выразу P1907: [a-z][-a-z]+-([1-
if not id:match( '^[a-z][-a-z]+-[1-
not id:match( '^[a-z][-a-z]+-[1-9]%d?%d?%d?$' ) then
return false
end
return '[http://adb.anu.edu.au/biography/'..id..' '..
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..'/ '..
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..' '..
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 '..
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..' '..
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..' '..
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..' '..
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..' '..
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..' '..
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
return '[https://www.ipni.org/ipni/advAuthorSearch.do?find_abbreviation='..
end
function p.bpnLink( id, label )
--фармат рэг. выразу P651: \d{6,8} (напр. 00123456)
if not id:match( '^%d%d%d%d%d%d%d%d$' ) and --
not id:match( '^0?%d%d%d%d%d%d%d$' ) and --
not id:match( '^0?0?%d%d%d%d%d%d$' ) then
return false
end
return '[http://www.biografischportaal.nl/en/persoon/'..id..' '..
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..' '..
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 '..
end
function p.
--фармат рэг. выразу 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..' '..
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..' '..
end
function p.
--фармат рэг. выразу 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..' '..
end
function p.
--фармат рэг. выразу 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..'/ '..
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..' '..
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..' '..
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..' '..
end
function p.
--фармат рэг. выразу 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..' '..
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 '[
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..' '..
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..' '..
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 '..
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 '..
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
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( '^
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..' '..
end
function p.
--фармат рэг. выразу
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
local cat = 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
local cat = 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
local cat = 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
local cat = 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
local cat = 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
local cat = 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
local cat = 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
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..' '..
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..' '..
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 '..
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..' '..
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..'/ '..
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 '..
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..' '..
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'..' '..
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..' '..
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'..' '..
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..' '..
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..' '..
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://
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 '..
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..' '..
end
function p.orcidLink( id, label )
id = p.validateIsni( id ) --
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..' '..
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..' '..
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..' '..
end
function p.
--фармат рэг. выразу
if not id:match( '^
not id:match( '^ks[1-9]%d*$' ) and
not id:match( '^[1-9]%d*$' ) then
return false
end
return '[
end
function p.rkdartistsLink( id, label )
--фармат рэг. выразу P650: [1-9]\d{0,5} (
if not id:match( '^[1-9]%d?%d?%d?%d?%d?$' ) then
return false
end
return '[https://rkd.nl/en/explore/artists/'..id..' '..
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..' '..
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 '..
end
function p.selibrLink( id, label )
--фармат рэг. выразу P906: [1-9]\d{4,5} (
if not id:match( '^[1-9]%d%d%d%d%d?$' ) then
return false
end
return '[https://libris.kb.se/auth/'..id..' '..
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 '..
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..' '..
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..' '..
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..' '..
end
function p.ta98Link( id, label )
--фармат рэг. выразу P1323: A\d{2}\.\d\.\d{2}\.\d{3}[FM]? (
if not id:match( '^A%d%d%.%d%.%d%d%.%d%d%d[FM]?$' ) then
return false
end
return longurl..id..' '.. 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..' '..
end
function p.
--фармат рэг. выразу
if not id:match( '^%d+$' ) then
return false
end
return '[https://collections.tepapa.govt.nz/agent/'..id..' '..
end
function p.
local id2 = id:gsub(' +', '_')
--фармат рэг. выразу P1362: \p{Lu}[\p{L}\d_',\.\-\(\)\*/–]{3,59} (напр. Abcd)
local class = "[%a%d_',%.%-%(%)%*/–]"
local regex =
if not mw.ustring.match(
return false
end
return '[http://tls.theaterwissenschaft.ch/wiki/'..
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..' '..
end
function p.
--фармат рэг. выразу 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..' '..
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..' '..
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),
-- 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
end
return str
Радок 711 ⟶ 860:
local result = (12 - remainder) % 11
if result == 10 then
return
end
return tostring( result )
Радок 743 ⟶ 892:
--[[==========================================================================]]
--[[
--[[==========================================================================]]
Радок 757 ⟶ 906:
end
return ids
end
Радок 789 ⟶ 912:
local wikiTable = '{| class="wikitable sortable"\n' ..
'! rowspan=2 | Парамэтар\n' ..
'! rowspan=2 |
'! 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,
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 }
--катэгорыі
local articleCat = 'Вікіпэдыя:Артыкулы з ідэнтыфікатарамі '..category
local userCat = 'Вікіпэдыя:Старонкі ўдзельнікаў з ідэнтыфікатарамі '..category
local miscCat = 'Вікіпэдыя:Старонкі з ідэнтыфікатарамі '..category
local faultyCat = 'Вікіпэдыя:Артыкулы з хібнымі ідэнтыфікатарамі '..category
--лічыльнікі
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, 'старонак') )
--разьлікі
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..']]'..
'||'..
'||'..appearsAs..
'||data-sort-value='..pid..'|'..wpl..
'||style="text-align: right;"|[[:Катэгорыя:'..articleCat..'|'..articleCount..']]'..
Радок 826 ⟶ 967:
'||style="text-align: right;"|[[:Катэгорыя:'.. faultyCat..'|'.. faultyCount..']]'
end
--дадаць падкатэгорыі 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:
--[[==========================================================================]]
--
-- This reduces clutter in "What links here" on both the redirect and the target,
-- and improves reverse lookup of articles where a manifestation of each identifier is used.
--
-- неабавязковыя іменаваныя парамэтры табліцы p.conf:
-- спасылка: каб замяніць спасылку ў дакумэнтацыі (дапомна — "<парамэтар> (ідэнтыфікатар)")
-- катэгорыя: каб замяніць ID у назьве катэгорыі (дапомна — "... з ідэнтыфікатарамі <парамэтар>")
-- прэфікс: каб дадаць прэфікс (звычайна вікіспасылка з тлумачэньне, што азначае ідэнтыфікатар) перад самой вонкавай спасылкай
p.conf = {
{ 'AAG', 3372, p.aagLink, 'Мастацкія галерэі і музэі', '1' },
{ 'ACM-DL', 864, p.acmLink, 'Навуковыя базы зьвестак', '12345678901', link = 'Лічбавая бібліятэка' },
{ 'ADB', 1907, p.adbLink, 'Біяграфічныя слоўнікі', 'barton-sir-edmund-toby-71' },
{ 'AGSA', 6804, p.agsaLink, 'Мастацкія галерэі і музэі', '3625' },
{ 'autores.uy
{ 'AWR', 4186, p.awrLink, 'Біяграфічныя слоўнікі', 'PR00768b' },
{ 'BIBSYS', 1015, p.bibsysLink, 'Нацыянальныя бібліятэкі', '1234567890123' },
{ 'Bildindex', 2092, p.bildLink, 'Мастацкія дасьледчыя інстытуты', '1' },
{ 'BNC', 1890, p.bncLink, 'Нацыянальныя бібліятэкі', '123456789' },
{ 'BNE', 950, p.bneLink, 'Нацыянальныя бібліятэкі', 'XX1234567' },
{ 'BNF', 268, p.bnfLink, 'Нацыянальныя бібліятэкі', '123456789' },
{ 'Botanist', 428, p.botanistLink , 'Навуковыя базы зьвестак', 'L.' },
{ 'BPN', 651, p.bpnLink , 'Біяграфічныя слоўнікі', '12345678' },
{ 'CANTIC', 1273, p.canticLink, 'Нацыянальныя бібліятэкі', 'a12345678' },
{ 'CINII', 271, p.ciniiLink, 'Навуковыя базы зьвестак', 'DA12345678', link = 'CiNii' },
{ '
{ 'DAAO', 1707, p.daaoLink, 'Мастацкія дасьледчыя інстытуты', 'rolf-harris' },
{ 'DBLP
{ 'DIB', 6829, p.dibLink, 'Біяграфічныя слоўнікі', 'a1234' },
{ 'DSI', 2349, p.dsiLink, 'Мастацкія дасьледчыя інстытуты', '1538' },
{ 'EMU', 4613, p.emuLink, 'Нацыянальныя бібліятэкі', '15409' },
{ 'FAST', 2163, p.fastLink, 'Іншыя', '1' },
{ 'FNZA', 6792, p.fnzaLink, 'Мастацкія дасьледчыя інстытуты', '12' },
{ 'GND', 227, p.gndLink, 'Агульныя', '4079154-3' },
{ 'HDS', 902, p.hdsLink, 'Іншыя', '050123' },
{ 'IAAF', 1146, p.iaafLink, 'Іншыя', '123' },
{ 'ICCU', 396, p.iccuLink, 'Нацыянальныя бібліятэкі', 'IT\\ICCU\\CFIV\\000163' }, --былы SBN
{ 'ICIA', 1736, p.iciaLink, 'Мастацкія дасьледчыя інстытуты', '1' },
{ 'IEU', 9070, p.ieuLink, 'Іншыя', 'N\\A\\NationalAcademyofArtandArchitecture' },
{ 'ISNI', 213, p.isniLink, 'Агульныя', '0000-0000-6653-4145', prefix = '[[Міжнародны стандартны ідэнтыфікатар імёнаў|ISNI]]' },
{ 'Joconde', 347, p.jocondeLink, 'Мастацкія дасьледчыя інстытуты', '12345678901' },
{ 'KULTURNAV', 1248, p.kulturnavLink, 'Мастацкія дасьледчыя інстытуты', '12345678-1234-1234-1234-1234567890AB', link = 'KulturNav' },
{ 'LCCN', 244, p.lccnLink, 'Нацыянальныя бібліятэкі', 'n78039510' },
{ '
{ 'LNB', 1368, p.lnbLink, 'Нацыянальныя бібліятэкі', '123456789' },
{ 'Léonore', 640, p.leonoreLink, 'Іншыя', 'LH//1/1', prefix = '[[Леанора (каталёг)|Léonore (Францыя)]]' },
{ 'MA', 6366, p.maLink, 'Іншыя', '123456789' },
{ '
{ '
{ 'MBI', 1330, p.mbiLink, 'Іншыя', '12345678-1234-1234-1234-1234567890AB', category = 'MusicBrainz' }, --special cat name
{ 'MBL', 966, p.mblLink, 'Іншыя', '12345678-1234-1234-1234-1234567890AB', category = 'MusicBrainz' }, --special cat name
{ 'MBP', 1004, p.mbpLink, 'Іншыя', '12345678-1234-1234-1234-1234567890AB', category = 'MusicBrainz' }, --special cat name
{ 'MBRG', 436, p.mbrgLink, 'Іншыя', '12345678-1234-1234-1234-1234567890AB', category = 'MusicBrainz' }, --special cat name
{ 'MBS', 1407, p.mbsLink, 'Іншыя', '12345678-1234-1234-1234-1234567890AB', category = 'MusicBrainz' }, --special cat name
{ 'MBW', 435, p.mbwLink, 'Іншыя', '12345678-1234-1234-1234-1234567890AB', category = 'MusicBrainz' }, --special cat name
{ 'MGP', 549, p.mgpLink, 'Навуковыя базы зьвестак', '123456' },
{ 'NARA', 1225, p.naraLink, 'Іншыя', '12345678' },
{ 'NCL', 1048, p.nclLink, 'Нацыянальныя бібліятэкі', '1081436' },
{ 'NDL', 349, p.ndlLink, 'Нацыянальныя бібліятэкі', '012345678' },
{ 'NGV', 2041, p.ngvLink, 'Мастацкія галерэі і музэі', '12354' },
{ 'NKC', 691, p.nkcLink, 'Нацыянальныя бібліятэкі', 'abcd12345678901234' },
{ 'NLA', 409, p.nlaLink, 'Нацыянальныя бібліятэкі', '123456789012' },
{ 'NLB', 3390, p.nlbLink, 'Нацыянальныя бібліятэкі', 'NLB-ar2443646' },
{ 'NLG', 3348, p.nlgLink, 'Нацыянальныя бібліятэкі', '12345678' },
{ 'NLI', 949, p.nliLink, 'Нацыянальныя бібліятэкі', '123456789' },
{ 'NLK', 5034, p.nlkLink, 'Нацыянальныя бібліятэкі', 'KAB197000000' },
{ 'NLP', 1695, p.nlpLink, 'Нацыянальныя бібліятэкі', '9810123456789012345' },
{ 'NLR', 1003, p.nlrLink, 'Нацыянальныя бібліятэкі', '123456789' },
{ 'NSK', 1375, p.nskLink, 'Нацыянальныя бібліятэкі', '123456789' },
{ 'NTA', 1006, p.ntaLink, 'Нацыянальныя бібліятэкі', '12345678X' },
{ 'ORCID', 496, p.orcidLink, 'Агульныя', '0000-0002-7398-5483', prefix = '[[ORCID]]' },
{ 'PIC', 2750, p.picLink, 'Мастацкія дасьледчыя інстытуты', '1' },
{ 'PLWABN', 7293, p.plwabnLink, 'Нацыянальныя бібліятэкі', '9812345678905606' },
{ 'Publons', 3829, p.publonsLink, 'Навуковыя базы зьвестак', '2776255' },
{ 'RERO', 3065, p.reroLink, 'Іншыя', '02-A012345678', prefix = '[[RERO (identifier)|RERO (Switzerland)]]' },
{ 'RID', 1053, p.ridLink, 'Навуковыя базы зьвестак', 'A-1234-1934' },
{ 'RISM', 5504, p.rismLink, 'Іншыя', 'pe1', prefix = '[[RISM (identifier)|RISM (France)]]' },
{ 'RKDartists', 650, p.rkdartistsLink, 'Мастацкія дасьледчыя інстытуты', '123456' },
{ 'RKDID', 350, p.rkdidLink, 'Мастацкія дасьледчыя інстытуты', '123456' },
{ 'RSL', 947, p.rslLink, 'Нацыянальныя бібліятэкі', '123456789' },
{ 'SELIBR', 906, p.selibrLink, 'Нацыянальныя бібліятэкі', '123456' },
{ 'SIKART', 781, p.sikartLink, 'Мастацкія дасьледчыя інстытуты', '123456789' },
{ 'SNAC-ID', 3430, p.snacLink, 'Іншыя', 'A' },
{ 'SUDOC', 269, p.sudocLink, 'Іншыя', '026927608', prefix = '[[Унівэрсытэцкая сыстэма дакумэнтацыі (Францыя)|SUDOC (Францыя)]]' },
{ 'S2AuthorId', 4012, p.s2authoridLink, 'Навуковыя базы зьвестак', '1796130', category = 'аўтар Semantic Scholar' }, --special cat name
{ 'TA98', 1323, p.ta98Link, 'Навуковыя базы зьвестак', 'A12.3.45.678' },
{ 'TDVİA', 7314, p.tdviaLink, 'Іншыя', 'asim-b-behdele' },
{ 'TePapa', 3544, p.tepapaLink, 'Мастацкія галерэі і музэі', '1' },
{ '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
{ '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
{ 'TDVIA', 'TDVİA' }, --alias name without diacritics
{ 'tdvia', 'TDVİA' }, --lowercase variant without diacritics
}
-- Нерэкамэндаваныя сынонімы ў p.conf; адсочваюцца ў [[Катэгорыя:Вікіпэдыя:Артыкулы зь нерэкамэндаванымі бібліяграфічнымі ідэнтыфікатарамі]]
-- Фармат: { 'назва нерэкамэндаванага парамэтру', 'назва парамэтру-заменьніка ў p.conf' }
p.deprecated = {
{ 'GKD', '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 iParentArgs = 0 --count original/manual parent args only later
local worldcatCat = ''
local elementsCat = ''
local multipleIdCat = ''
local suppressedIdCat = ''
local suppressedIdCatArts = ''
local deprecatedIdCat = ''
local differentOnWDCat = ''
local sameOnWDCat = ''
local stateCat = ''
--
for _, a in pairs( p.aliases ) do
local alias, param = a[1], a[2]
Радок 969 ⟶ 1160:
end
--
for _, d in pairs( p.deprecated ) do
local dep, param = d[1], d[2]
Радок 980 ⟶ 1171:
end
--
local itemId = nil
if namespace ~= 0 then
Радок 992 ⟶ 1183:
end
--Wikidata fallback if
if itemId then
local suppressedIdCount = 0
local iMatches = 0
for _, params in ipairs( p.conf ) do
if params[
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] )
if
if val == '' and (namespace == 0 or testcases) then
suppressedIdCount = suppressedIdCount + 1
suppressedIdCat = '[[Катэгорыя:Вікіпэдыя:Артыкулы з заглушанымі бібліяграфічнымі ідэнтыфікатарамі|'..params[1]..']]'
else
parentArgs[params[1]] = wikidataIds[1] --add ID from WD
end
end
else
iParentArgs = iParentArgs + 1
local wikidataIds = p.getIdsFromWikidata( itemId, 'P' local bMatch = false
for _, wd in pairs( wikidataIds ) do
bMatch = true
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[3]) == 'function' then
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(
worldcatCat = p.getCatForId( 'WORLDCATID' )
rct = rct + 1
elseif worldcatId == nil then --калі WORLDCATID адсутны, але незаглушаны
local
local lccnId = parentArgs['lccn'] or parentArgs['LCCN']
if viafId and viafId ~= '' and p.viafLink( viafId ) then --VIAF мусіць прысутнічаць, быць незаглушаным і спраўджаным
table.insert( sections['Агульныя'], p.createRow( 'VIAF', viafId, '[https://www.worldcat.org/identities/containsVIAFID/'..viafId..' WorldCat (празь VIAF)]', nil, false ) )
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(
if namespace == 0 then
worldcatCat = '[[Катэгорыя:Вікіпэдыя:Артыкулы з ідэнтыфікатарамі WorldCat-LCCN]]'
end
end
rct = rct + 1
end
elseif worldcatId == '' then --калі WORLDCATID заглушаны
suppressedIdCat = '[[Катэгорыя:Вікіпэдыя:Артыкулы з заглушанымі бібліяграфічнымі ідэнтыфікатарамі|WORLDCATID]]'
end
--канфігуруем навігацыйную табліцу
local outString = ''
if
local Navbox = require('Модуль:Навігацыйная табліца')
local sectionID = 1
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 = {
state = parentArgs.state or 'autocollapse',
navbar = 'off'
for _, sectName in ipairs(sectionOrder) do
if
navboxArgs['group'..sectionID] = sectName
navboxArgs['list'..sectionID] = table.concat(sections[sectName])
sectionID = sectionID + 1
end
end
if navboxArgs.group2 then
navboxArgs.title = '[[Дапамога:Нарматыўны кантроль|Нарматыўны кантроль]]'..pencil
else
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
|