پودمان:Authority control
ظاهر
توضیحات این پودمان میتواند در پودمان:Authority control/توضیحات قرار گیرد.
require('strict')
local p = {}
local getArgs = require('Module:Arguments').getArgs
local navbox = require('Module:Navbox')._navbox
local warning = require('Module:Warning')
local function check_parameters(args)
local knownArgs = {}
for k, v in pairs(args.knownArgs) do
knownArgs[v] = true
end
local parentArgs = args.parentArgs
local unknownParentArgs = {}
local knownParentArgs = {}
for k, v in pairs(parentArgs) do
if knownArgs[k] then
table.insert(knownParentArgs, k)
else
table.insert(unknownParentArgs, k)
end
end
local rv = ''
if #unknownParentArgs > 0 then
warning('پارامترهای ناشناخته: ' .. table.concat(unknownParentArgs, '، '))
rv = rv .. '[[رده:' .. args.unknown .. '|'
.. table.concat(unknownParentArgs, '$' .. args.namespace .. ':' .. args.pagename .. ']][[رده:' .. args.unknown .. '|')
.. '$' .. args.namespace .. ':' .. args.pagename .. ']]'
end
if #knownParentArgs > 0 then
rv = rv .. '[[رده:' .. args.known .. '|'
.. table.concat(knownParentArgs, '$' .. args.namespace .. ':' .. args.pagename .. ']][[رده:' .. args.known .. '|')
.. '$' .. args.namespace .. ':' .. args.pagename .. ']]'
end
return rv
end
local function getCatForId( id )
local title = mw.title.getCurrentTitle()
-- در حال حاضر ردهبندی بر پایهٔ «شناسه» فقط برای صفحههای ریشهٔ فضای نام کاربر انجام میشود
if title.namespace == 2 and not title.isSubpage then
return '[[رده:صفحههای کاربری دارای شناسههای ' .. id .. ']]'
end
return ''
end
-- ** کنترلهای استنادی مرتبط با پدیدآورنده در ادامه میآیند **
local function viafLink( id )
if not string.match( id, '^%d+$' ) then
return false
end
return '[https://viaf.org/viaf/' .. id .. ' ' .. id .. ']'
end
local function nkcLink( id )
return '[https://aleph.nkp.cz/F/?func=find-c&local_base=aut&ccl_term=ica=' .. id .. '&CON_LNG=ENG ' .. id .. ']'
end
local function nclLink( id )
if not string.match( id, '^%d+$' ) then
return false
end
return '[https://aleweb.ncl.edu.tw/F/?func=accref&acc_sequence=' .. id .. '&CON_LNG=ENG ' .. id .. ']'
end
local function ndlLink( id )
return '[https://id.ndl.go.jp/auth/ndlna/' .. id .. ' ' .. id .. ']'
end
local function idrefLink( id )
if not string.match( id, '^%d%d%d%d%d%d%d%d[%dxX]$' ) then
return false
end
return '[https://www.idref.fr/' .. id .. ' ' .. id .. ']'
end
local function hlsLink( id )
if not string.match( id, '^%d+$' ) then
return false
end
return '[https://www.hls-dhs-dss.ch/textes/f/F' .. id .. '.php ' .. id .. ']'
end
local function lirLink( id )
if not string.match( id, '^%d+$' ) then
return false
end
return '[http://www.e-lir.ch/e-LIR___Lexicon.' .. id .. '.450.0.html ' .. id .. ']'
end
local function lcauthSplit( id )
if id:match( '^%l%l?%l?%d%d%d%d%d%d%d%d%d?%d?$' ) then
id = id:gsub( '^(%l+)(%d+)(%d%d%d%d%d%d)$', '%1/%2/%3' )
end
if id:match( '^%l%l?%l?/%d%d%d?%d?/%d+$' ) then
return mw.text.split( id, '/' )
end
return false
end
local function append(str, c, length)
return c:rep(length - str:len()) .. str
end
local function lcauthLink( id )
local parts = lcauthSplit( id )
if not parts then
return false
end
id = parts[1] .. parts[2] .. append( parts[3], '0', 6 )
return '[https://id.loc.gov/authorities/' .. id .. ' ' .. id .. ']'
end
local function fastLink( id )
if not string.match( id, '^%d+$' ) then
return false
end
return '[https://id.worldcat.org/fast/' .. id .. ' ' .. id .. ']'
end
--رقم کنترلی ISNI را برمیگرداند. isni باید رشتهای باشد که ۱۵ عنصر نخست آن رقم باشند
local function getIsniCheckDigit( isni )
local total = 0
for i = 1, 15 do
local digit = isni:byte( i ) - 48 --مقدار عدد صحیح را بهدست میآورد
total = (total + digit) * 2
end
local remainder = total % 11
local result = (12 - remainder) % 11
if result == 10 then
return "X"
end
return tostring( result )
end
--ISNI (و ORCID) را اعتبارسنجی میکند و آن را بهصورت رشتهای ۱۶ نویسهای برمیگرداند؛ در صورت نامعتبر بودن، false برمیگرداند
--نک: https://support.orcid.org/knowledgebase/articles/116780-structure-of-the-orcid-identifier
local function validateIsni( id )
id = id:gsub( '[ %-]', '' ):upper()
if not id:match( '^%d%d%d%d%d%d%d%d%d%d%d%d%d%d%d[%dX]$' ) then
return false
end
if getIsniCheckDigit( id ) ~= string.char( id:byte( 16 ) ) then
return false
end
return id
end
local function isniLink( id )
id = validateIsni( id )
if not id then
return false
end
return '[https://isni.org/isni/' .. id .. ' ' .. id:sub( 1, 4 ) .. ' ' .. id:sub( 5, 8 ) .. ' ' .. id:sub( 9, 12 ) .. ' ' .. id:sub( 13, 16 ) .. ']'
end
local function orcidLink( id )
id = 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 .. ' ' .. id .. ']'
end
local function gndLink( id )
return '[https://d-nb.info/gnd/' .. id .. ' ' .. id .. ']'
end
local function BanglapediaEnglishLink( id )
return '[https://en.banglapedia.org/index.php?title=' .. id .. ' ' .. id .. ']'
end
local function WBPLNauthorID( id )
return '[http://dspace.wbpublibnet.gov.in:8080/jspui/browse?type=author&order=ASC&rpp=20&value=' .. id .. ' ' .. id .. ']'
end
local function BHLcreatorID( id )
return '[https://www.biodiversitylibrary.org/creator/' .. id .. ' ' .. id .. ']'
end
local function MunksRollLink( id )
return '[https://history.rcplondon.ac.uk/inspiring-physicians/' .. id .. ' ' .. id .. ']'
end
local function selibrLink( id )
if not string.match( id, '^%d+$' ) then
return false
end
return '[https://libris.kb.se/auth/' .. id .. ' ' .. id .. ']'
end
-- NCDA: الگوریتم رقم کنترلی NOID؛ نک: [[wikipedia:Check digit#NCDA]]
local ncda -- این را بهصورت local نگه دارید چون NCDA میان شناسههای ARK رایج است و ممکن است بعداً برای اعتبارسنجی شناسههای دیگر هم بهکار آید
do -- این ثابتها فقط یکبار مقداردهی اولیه میشوند، اما در یک بلوک محدودهبندی شدهاند تا فضای نام local شلوغ نشود
local r29s = [[0123456789bcdfghjkmnpqrstvwxz]] -- رشتهٔ ارقام «بتاعددی» با مبنای ۲۹
local r29n = r29s:len()
local r29v2d, r29d2v = {}, {}
for i = 1, r29n do
local v, d = i-1, r29s:sub(i, i)
r29v2d[v], r29d2v[d] = d, v
end
function ncda(sid)
local n, sum = sid:len(), 0
for i = 1, n do
sum = sum + i * (r29d2v[sid:sub(i, i)] or 0)
end
return r29v2d[sum % r29n]
end
end
local function bnfLink( id )
id = id:match('^cb(.+)$') or id --در صورت وجود، پیشوند «shoulder» یعنی 'cb' را پیش از اعتبارسنجی حذف کن
local FRBNF, check = id:match('^(%d%d%d%d%d%d%d%d)(.)$') --هشت رقم دهدهی بههمراه رقم کنترلی NCDA
return nil ~= FRBNF and ncda('cb'..FRBNF) == check and '[https://catalogue.bnf.fr/ark:/12148/cb' .. id .. ' ' .. FRBNF
.. '] ([https://data.bnf.fr/ark:/12148/cb' .. id .. ' data])'
end
local function bpnLink( id )
if not string.match( id, '^%d+$' ) then
return false
end
return '[http://www.biografischportaal.nl/persoon/' .. id .. ' ' .. id .. ']'
end
local function ridLink( id )
return '[http://www.researcherid.com/rid/' .. id .. ' ' .. id .. ']'
end
local function bibsysLink( id )
return '[http://ask.bibsys.no/ask/action/result?cmd=&kilde=biblio&cql=bs.autid+%3D+' .. id .. '&feltselect=bs.autid ' .. id .. ']'
end
local function ulanLink( id )
return '[https://www.getty.edu/vow/ULANFullDisplay?find=&role=&nation=&subjectid=' .. id .. ' ' .. id .. ']'
end
local function nlaLink( id )
return '[https://librariesaustralia.nla.gov.au/search/display?dbid=auth&id=' .. id .. ' ' .. id .. ']'
end
local function mbLink( id )
-- TODO افزودن یک عبارت باقاعده (regex) برای بررسی درستی شناسه
return '[https://musicbrainz.org/artist/' .. id .. ' ' .. id .. ']'
end
local function calisLink( id )
return '[http://opac.calis.edu.cn/aopac/ajsp/detail.jsp?actionfrom=1&actl=CAL++' .. id .. ' ' .. id .. ']'
end
local function nacsis_authorLink( id )
return '[https://ci.nii.ac.jp/author/' .. id .. ' ' .. id .. ']'
end
local function sbnLink( id )
return '[https://opac.sbn.it/risultati-autori/-/opac-autori/detail/' .. id .. '?core=autoriall ' .. id .. ']'
end
local function cbdbLink( id )
return '[http://db1.ihp.sinica.edu.tw/cbdbc/cbdbkmeng?~~AAA' .. id .. ' ' .. id .. ']'
end
local function leonoreLink( id )
return '[https://www.culture.gouv.fr/public/mistral/leonore_fr?ACTION=CHERCHER&FIELD_1=COTE&VALUE_1=' .. id .. ' ' .. id .. ']'
end
local function dbnlLink( id )
return '[https://www.dbnl.org/auteurs/auteur.php?id=' .. id .. ' ' .. id .. ']'
end
local function rslLink( id )
return '[http://aleph.rsl.ru/F?func=find-b&find_code=SYS&adjacent=Y&local_base=RSL11&request=' .. id .. ' ' .. id .. ']'
end
local function ptbnpLink( id )
return '[https://id.bnportugal.gov.pt/aut/catbnp/' .. id .. ' ' .. id .. ']'
end
local function ntaLink( id )
-- تزاروس ملی نام پدیدآورندگان هلند (Nationale Thesaurus Auteursnamen)، کتابخانهٔ سلطنتی هلند
return '[https://data.bibliotheken.nl/id/thes/p' .. id .. ' ' .. id .. ']'
end
local function vcbaLink( id )
return '[https://wikidata-externalid-url.toolforge.org/?p=8034&url_prefix=https://opac.vatlib.it/auth/detail/&id=' .. id .. ' ' .. id .. ']'
end
local function nliLink( id )
return '[http://a20.libnet.ac.il/F?func=find-b&REQUEST=' .. id .. '&find_code=SYS&local_base=NNL10 ' .. id .. ']'
end
local function nlcLink( id )
return '[http://opac.nlc.cn/F/?func=accref&acc_sequence=' .. id .. ' ' .. id .. ']'
end
local function nukatLink( id )
return id -- قالب پیوند در حال حاضر در ویکیداده موجود نیست و مورد مناسبی هم در http://www.nukat.edu.pl/ یافت نشد
end
local function botanistLink( id )
local id2 = mw.ustring.gsub(id, '%s', function(s) return mw.uri.encode(s, 'PATH') end)
return '[https://www.ipni.org/ipni/advAuthorSearch.do?find_abbreviation=' .. id2 .. ' ' .. id .. ']'
end
local function naraIdLink( id )
return '[https://research.archives.gov/person/' .. id .. ' ' .. id .. ']'
end
local function ibdbLink( id )
return '[https://www.ibdb.com/person.php?id=' .. id .. ' ' .. id .. ']'
end
local function isfdbIdLink( id )
return '[https://www.isfdb.org/cgi-bin/ea.cgi?' .. id .. ' ' .. id .. ']'
end
local function findGraveLink( id )
return '[https://www.findagrave.com/memorial/' .. id .. ' ' .. id .. ']'
end
local function familySearchLink( id )
return '[https://ancestors.familysearch.org/en/' .. id .. ' ' .. id .. ']'
end
local function mgpLink( id )
return '[https://genealogy.math.ndsu.nodak.edu/id.php?id=' .. id .. ' ' .. id .. ']'
end
local function rkdLink( id )
return '[http://explore.rkd.nl/nl/artists/' .. id .. ' ' .. id .. ']'
end
local function bneLink( id )
return '[http://catalogo.bne.es/uhtbin/authoritybrowse.cgi?action=display&authority_id=' .. id .. ' ' .. id .. ']'
end
local function nlrLink( id )
return '[http://alephnew.bibnat.ro:8991/F?func=find-b&request=' .. id .. '&find_code=SYS&adjacent=Y&local_base=NLR10 ' .. id .. ']'
end
local function chLink( id )
-- سلسلهمراتب کلیسای کاتولیک (پایگاه دادهٔ اسقفها)
return '[https://www.catholic-hierarchy.org/bishop/b' .. id .. '.html ' .. id .. ']'
end
local function sycomoreLink( id )
return '[https://www.assemblee-nationale.fr/sycomore/fiche.asp?num_dept=' .. id .. ' ' .. id .. ']'
end
local function uscongressLink( id )
return '[https://bioguide.congress.gov/scripts/biodisplay.pl?index=' .. id .. ' ' .. id .. ']'
end
local function kulturnavLink( id )
return '[https://kulturnav.org/language/en/' .. id .. ' ' .. id .. ']'
end
local function sikartLink( id )
return '[https://www.sikart.ch/KuenstlerInnen.aspx?id=' .. id .. '&lng=en ' .. id .. ']'
end
local function tlsLink( id )
local id2 = mw.ustring.gsub(id, '%s', function(s) return mw.uri.encode(s, 'WIKI') end)
return '[http://tls.theaterwissenschaft.ch/wiki/' .. id2 .. ' ' .. id .. ']'
end
local function PrdlLink( id )
return '[https://prdl.org/author_view.php?a_id=' .. id .. ' ' .. id .. ']'
end
local function NupillALink( id )
return '[https://www.literaturabrasileira.ufsc.br/autores/?id=' .. id .. ' ' .. id .. ']'
end
local function MacTutorBLink( id )
return '[https://www-history.mcs.st-andrews.ac.uk/Biographies/' .. id .. '.html ' .. id .. ']'
end
local function AtclLink( id )
return '[https://www.victorianresearch.org/atcl/show_author.php?aid=' .. id .. ' ' .. id .. ']'
end
local function ElemLink( id )
return '[http://www.elem.mx/autor/datos/' .. id .. ' ' .. id .. ']'
end
local function ImslpLink( id )
local id2 = mw.ustring.gsub(id, '%s', function(s) return mw.uri.encode(s, 'WIKI') end)
return '[https://imslp.org/wiki/' .. id2 .. ' ' .. id .. ']'
end
local function OdnbLink( id )
return '[https://doi.org/10.1093/ref:odnb/' .. id .. ' ' .. id .. ']'
end
local function GecLink( id )
return '[https://www.enciclopedia.cat/enciclop%C3%A8dies/gran-enciclop%C3%A8dia-catalana/EC-GEC-' .. id .. '.xml ' .. id .. ']'
end
-- ** کنترلهای استنادی مرتبط با موضوع یا عمومی در ادامه میآیند **
local function imdbLink( id )
return '[https://wikidata-externalid-url.toolforge.org/?p=345&url_prefix=https://www.imdb.com/&id=' .. id .. ' ' .. id .. ']'
end
local function freebaseLink( id )
return '[https://freebase.toolforge.org/' .. id .. ' ' .. id .. ']'
end
local function googleKnowledgeGraphLink( id )
return '[https://www.google.com/search?kgmid=' .. id .. ' ' .. id .. ']'
end
local function naraOrgLink( id )
return '[https://research.archives.gov/organization/' .. id .. ' ' .. id .. ']'
end
local function naraGeoLink( id )
return '[https://research.archives.gov/geographic-reference/' .. id .. ' ' .. id .. ']'
end
local function naraSubLink( id )
return '[https://research.archives.gov/topical-subject/' .. id .. ' ' .. id .. ']'
end
local function naraTypeLink( id )
return '[https://research.archives.gov/specific-records-type/' .. id .. ' ' .. id .. ']'
end
local function isfdbPubLink( id )
return '[https://www.isfdb.org/cgi-bin/publisher.cgi?' .. id .. ' ' .. id .. ']'
end
local function isfdbConLink( id )
return '[https://www.isfdb.org/cgi-bin/pl.cgi?' .. id .. ' ' .. id .. ']'
end
local function lembpLink( id )
--Lista de Encabezamientos de materia para las Bibliotecas Públicas = فهرست سرعنوانهای موضوعی برای کتابخانههای عمومی (اسپانیایی)
return '[http://id.sgcb.mcu.es/lem/ver/Autoridades/' .. id .. '/concept ' .. id .. ']'
end
local function ddcLink( id )
return '[http://dewey.info/class/' .. id .. '/about ' .. id .. ']'
end
local function libriVoxAuthorLink( id )
return '[https://librivox.org/author/' .. id .. ' ' .. id .. ']'
end
local function GutenbergLink( id )
return '[https://www.gutenberg.org/ebooks/author/' .. id .. ' ' .. id .. ']'
end
local function syrBiographicalLink( id )
return '[https://syriaca.org/person/' .. id .. ' ' .. id .. ']'
end
-- ** کنترلهای استنادی مرتبط با کتاب و اثر در ادامه میآیند **
local function isbnLink( id )
return '[[Special:BookSources/' .. id .. '|' .. id .. ']]'
-- در حال حاضر فقط شمارهٔ شابک-۱۳ از ویکیداده خوانده میشود و شابک-۱۰ نادیده گرفته میشود
end
local function worldcatOCLCLink( id )
return '[https://search.worldcat.org/en/title/' .. id .. ' ' .. id .. ']'
end
local function openLibLink( id )
return '[https://openlibrary.org/books/' .. id .. ' ' .. id .. ']'
end
local function libraryThingLink( id )
return '[https://www.librarything.com/work/' .. id .. ' ' .. id .. ']'
end
local function archiveLink( id )
return '[https://www.archive.org/details/' .. id .. ' ' .. id .. ']'
end
local function gutenbergebookLink( id )
return '[https://www.gutenberg.org/ebooks/' .. id .. ' ' .. id .. ']'
end
local function europeanaLink( id )
return '[https://www.europeana.eu/portal/record/' .. id .. '.html ' .. id .. ']'
end
local function lcitemLink( id )
return '[https://www.loc.gov/item/' .. id .. ' ' .. id .. ']'
end
local function googleBooksLink( id )
return '[https://books.google.com/books?id=' .. id .. ' ' .. id .. ']'
end
local function ndlBibliographicLink( id )
return '[https://iss.ndl.go.jp/books?op_id=1&any=' .. id .. ' ' .. id .. ']'
end
local function issnLink( id )
return '[https://search.worldcat.org/en/issn/' .. id .. ' ' .. id .. ']'
end
local function issnLLink( id )
return '[https://portal.issn.org/resource/ISSN-L/' .. id .. ' ' .. id .. ']'
end
local function doiLink( id )
return '[https://doi.org/' .. id .. ' ' .. id .. ']'
end
local function eraLink( id )
return '[http://lamp.infosys.deakin.edu.au/era/?page=jnamedet12f&eraid=' .. id .. ' ' .. id .. ']'
end
local function ismnLink( id )
return id -- در حال حاضر هیچ پیوندی برای ISMN در ویکیداده یا جای دیگر یافت نشد
end
local function isfdbBookLink( id )
return '[https://www.isfdb.org/cgi-bin/title.cgi?' .. id .. ' ' .. id .. ']'
end
local function isfdbSerLink( id )
return '[https://www.isfdb.org/cgi-bin/pe.cgi?' .. id .. ' ' .. id .. ']'
end
local function sudocBibliographicLink( id )
return '[http://www.sudoc.fr/' .. id .. ' ' .. id .. ']'
end
local function swbLink( id )
-- شبکهٔ کتابخانهای جنوبغرب آلمان
return '[https://swb.bsz-bw.de/DB=2.1/PPNSET?PPN=' .. id .. '&INDEXSET=1 ' .. id .. ']'
end
local function zdbLink( id )
-- Zeitschriftendatenbank (پایگاه دادهٔ نشریات ادواری آلمان)
return '[http://dispatch.opac.d-nb.de/DB=1.1/CMD?ACT=SRCHA&IKT=8506&TRM=' .. id .. ' ' .. id .. ']'
end
local function nlmLink( id )
return '[http://locatorplus.gov/cgi-bin/Pwebrecon.cgi?DB=local&v1=1&ti=1,1&Search_Arg=' .. id .. '&Search_Code=0359&CNT=20&SID=1 ' ..id .. ']'
end
local function selibrBibliographicLink( id )
return '[https://libris.kb.se/bib/' .. id .. ' ' .. id .. ']'
end
local function dliLink( id )
return '[http://dli.gov.in/cgi-bin/DBscripts/allmetainfo.cgi?barcode=' .. id .. ' ' .. id .. ']'
end
local function hathitrustLink( id )
return '[https://catalog.hathitrust.org/Record/' .. id .. ' ' .. id .. ']'
end
local function blSysnumLink( id )
return '[http://explore.bl.uk/BLVU1:LSCOP-ALL:BLL01' .. id .. ' ' .. id .. ']'
end
local function BNBRLink( id )
return '[http://acervo.bn.br/sophia_web/autoridade/detalhe/' .. id .. ' ' .. id .. ']'
end
local function onlineBooksLink( id )
return '[https://onlinebooks.library.upenn.edu/webbin/cinfo/' .. id .. ' ' .. id .. ']'
end
local function newspapersComLink( id )
if not string.match( id, '^%d+$' ) then
return false
end
return '[https://www.newspapers.com/paper/' .. id .. ' ' .. id .. ']'
end
local function worldcatEntitiesLink( id )
return '[https://id.oclc.org/worldcat/entity/' .. id .. ' ' .. id ..
'] ([https://search.worldcat.org/search?q=ua=%22https://id.oclc.org/worldcat/entity/' .. id ..
'%22 author] • [https://search.worldcat.org/search?q=us=%22https://id.oclc.org/worldcat/entity/' .. id ..
'%22 about])'
end
local function worldcatIdentitiesLink( id )
local id2 = mw.ustring.gsub(id, '%s', function(s) return mw.uri.encode(s, 'PATH') end)
return '[https://www.worldcat.org/identities/' .. id2 .. ' ' .. id .. ']'
end
-- مدخلی برای آیتم ویکیداده که 'QID' را بهعنوان شناسهٔ استنادی به کار میبرد.
local function wikidataQIDLink( id )
if not mw.wikibase.entityExists(id) then
return false
end
return '[[d:Special:EntityPage/' .. id .. '|' .. id .. ']]'
end
-- مدخلی برای ویکینبشته که 'wgArticleID' را بهعنوان شناسهٔ استنادی به کار میبرد. همیشه باید آخرین مورد باشد
local function mwPageIDLink( id )
if not tonumber(id) then
return false
end
return '[[Special:Redirect/page/' .. id .. '|' .. id .. ']]'
end
-- پایان توابع قالببندی پیوند برای دادههای کتابخانهای
local function getIdsFromWikidata( item, property )
local ids = {}
if not item.claims[property] then
return ids
end
for _, statement in pairs( item:getBestStatements( property ) ) do
if statement.mainsnak.datavalue then
table.insert( ids, statement.mainsnak.datavalue.value )
end
end
return ids
end
local function matchesWikidataRequirements( item, reqs )
for _, group in pairs( reqs ) do
local property = 'p' .. group[1]
local qid = group[2]
if item.claims[property] ~= nil then
for _, statement in pairs ( item.claims[property] ) do
if statement.mainsnak.datavalue ~= nil then
if statement.mainsnak.datavalue.value['numeric-id'] == qid then
return true
end
end
end
end
end
return false
end
local function createRow( id, label, rawValue, link, withUid )
if link then
if withUid then
return '* ' .. label .. ' <span class="uid plainlinks">' .. link .. getCatForId( id ) .. '</span>\n'
else
return '* ' .. label .. ' <span class="plainlinks">' .. link .. getCatForId( id ) .. '</span>\n'
end
else
return '* <span class="error">شناسهٔ ' .. id .. ' با مقدار ' .. rawValue .. ' نامعتبر است.</span>[[رده:صفحههای استفادهکننده از دادههای کتابخانهای با پارامترهای شناسهٔ نادرست]]\n'
end
end
-- *** فهرست شناسههای نمایش دادهشدهٔ دادههای کتابخانهای ***
-- کنترلهای استنادی به همان ترتیب فهرست زیر نمایش داده میشوند
--به این ترتیب: { نام پارامتر، برچسب، شناسهٔ ویژگی در ویکیداده، تابع قالببندی }،
local conf = {
{ 'VIAF', '[[w:برگهدان مستند مجازی بینالمللی|VIAF]]', 214, viafLink },
{ 'LCCN', '[[w:en:LC Authorities|LC Auth]]', 244, lcauthLink },
{ 'FAST', '[[w:en:Faceted Application of Subject Terminology|FAST]]', 2163, fastLink },
{ 'ISNI', '[[w:استاندارد بینالمللی شناسه نام|ISNI]]', 213, isniLink },
{ 'ORCID', '[[w:شناسه آزاد پژوهشگران و نویسندگان|ORCID]]', 496, orcidLink },
{ 'GND', '[[w:برگهدان مستند فراگیر|GND]]', 227, gndLink },
{ 'Banglapedia', '[[w:en:Banglapedia|Banglapedia]]', 4255, BanglapediaEnglishLink },
{ 'WBPLN', 'WBPLN', 4343, WBPLNauthorID },
{ 'BHL', '[[w:کتابخانه میراث تنوع زیستی|BHL]]', 4081, BHLcreatorID },
{ 'Munks Roll', "[[w:en:Munk%27s_Roll|Munk's Roll]]", 2941, MunksRollLink },
{ 'SELIBR', '[[w:سامانه اطلاعات کتابخانهای سوئد|SELIBR]]', 906, selibrLink },
{ 'SUDOC', '[[w:سامانه مستندات دانشگاهی فرانسه|IdRef]]', 269, idrefLink },
{ 'BNF', '[[w:کتابخانه ملی فرانسه|BNF]]', 268, bnfLink },
{ 'BPN', '[[w:درگاه زندگینامه (هلند)|BPN]]', 651, bpnLink },
{ 'RID', '[[w:ریسرچر آیدی|ResearcherID]]', 1053, ridLink },
{ 'BIBSYS', '[[w:بیبسیس|BIBSYS]]', 1015, bibsysLink },
{ 'BL', '[[w:کتابخانه بریتانیا|BL]]', 5199, blSysnumLink },
{ 'ULAN', '[[w:اتحادیه فهرست نام هنرمندان|ULAN]]', 245, ulanLink },
{ 'HDS', '[[w:فرهنگ تاریخی سوئیس|HDS]]', 902, hlsLink },
{ 'LIR', '[[w:فرهنگ تاریخی سوئیس|LIR]]', 886, lirLink },
{ 'MBA', '[[w:موزیکبرینز|MusicBrainz]]', 434, mbLink },
{ 'NLA', '[[w:کتابخانه ملی استرالیا|NLA]]', 409, nlaLink },
{ 'NDL', '[[w:کتابخانه شورای ملی ژاپن|NDL]]', 349, ndlLink },
{ 'NCL', '[[w:en:National Central Library|NCL]]', 1048, nclLink },
{ 'NKC', '[[w:کتابخانه ملی جمهوری چک|NKC]]', 691, nkcLink },
{ 'CALIS', 'CALIS', 270, calisLink },
{ 'CiNii', '[[w:ساینی|NACSIS author]]', 271, nacsis_authorLink },
{ 'SBN', '[[w:en:National Library Service of Italy|SBN]]', 396, sbnLink },
{ 'CBDB', 'CBDB', 497, cbdbLink },
{ 'Leonore', '[[w:لژیون دونور|Léonore]]', 640, leonoreLink },
{ 'DBNL', '[[w:en:Digital Library for Dutch Literature|DBNL]]', 723, dbnlLink },
{ 'RSL', '[[w:کتابخانه دولتی روسیه|RSL]]', 947, rslLink },
{ 'PTBNP', '[[w:کتابخانه ملی پرتغال|PTBNP]]', 1005, ptbnpLink },
{ 'NTA', '[[w:کتابخانه ملی هلند|NTA]]', 1006, ntaLink },
{ 'VcBA', '[[w:کتابخانه واتیکان|VcBA]]', 8034, vcbaLink },
{ 'NLI', '[[w:کتابخانه ملی اسرائیل|NLI]]', 949, nliLink },
{ 'NLC', '[[w:کتابخانه ملی چین|NLC]]', 1213, nlcLink },
{ 'NUKAT', 'NUKAT', 1207, nukatLink },
{ 'Botanist', '[[w:فهرست نامهای بینالمللی گیاهان|گیاهشناس]]', 428, botanistLink },
{ 'NARAid', '[[w:دفتر ملی بایگانی و مدارک آمریکا|NARA]]', 1222, naraIdLink },
{ 'IBDB', '[[w:بانک اطلاعات اینترنتی برادوی|IBDB]]', 1220, ibdbLink },
{ 'ISFDB', '[[w:en:Internet Speculative Fiction Database|ISFDB]]', 1233, isfdbIdLink },
{ 'LibriVoxAuth', '[[w:لیبریواکس|LibriVox]]', 1899, libriVoxAuthorLink },
{ 'Gutenberg', '[[w:پروژه گوتنبرگ|Project Gutenberg]]', 1938, GutenbergLink },
{ 'SBD', '[[w:en:Syriac Biographical Dictionary|SBD]]', 6934, syrBiographicalLink },
{ 'Grave', '[[w:قبریاب|Find a Grave]]', 535, findGraveLink },
{ 'FamilySearch', '[[w:فمیلیسرچ|FamilySearch]]', 2889, familySearchLink },
{ 'MGP', '[[w:پروژه تبارشناسی ریاضیات|MGP]]', 549, mgpLink },
{ 'RKD', '[[w:مؤسسه تاریخ هنر هلند|RKD]]', 650, rkdLink },
{ 'BNE', '[[w:کتابخانه ملی اسپانیا|BNE]]', 950, bneLink },
{ 'NLR', '[[w:کتابخانه ملی رومانی|NLR]]', 1003, nlrLink },
{ 'Sycomore', '[[w:مجمع ملی (فرانسه)|Sycomore]]', 1045, sycomoreLink },
{ 'CH', '[[w:en:Hierarchy of the Catholic Church|CH]]', 1047, chLink },
{ 'USCongress', '[[w:دایرکتوری زندگینامهای کنگره ایالات متحده|US Congress]]', 1157, uscongressLink },
{ 'TLS', '[[w:فرهنگ تئاتر سوئیس|TLS]]', 1362, tlsLink },
{ 'SIKART', '[[w:SIKART|SIKART]]', 781, sikartLink },
{ 'KULTURNAV', 'KulturNav', 1248, kulturnavLink },
{ 'LCCNbook', '[[w:کتابخانه کنگره|LCCN]]', 1144, lcitemLink },
{ 'OCLC', '[[w:مرکز کتابخانه رایانهای پیوسته|WorldCat OCLC]]', 243, worldcatOCLCLink },
{ 'ISBN', '[[w:شماره استاندارد بینالمللی کتاب|شابک]]', 212, isbnLink },
{ 'NDLbook', '[[w:کتابخانه شورای ملی ژاپن|NDL]]', 1054, ndlBibliographicLink },
{ 'ISSN', '[[w:شماره استاندارد بینالمللی پیایند|شاپا]]', 236, issnLink },
{ 'ISSN-L', '[[w:شماره استاندارد بینالمللی پیایند|ISSN-L]]', 7363, issnLLink },
{ 'DOI', '[[w:شناساگر اشیاء دیجیتال|DOI]]', 356, doiLink },
{ 'ERA', 'ERA', 1058, eraLink },
{ 'ISMN', '[[w:شماره استاندارد بینالمللی موسیقی|ISMN]]', 1208, ismnLink },
{ 'SUDOCbook', '[[w:سامانه مستندات دانشگاهی فرانسه|SUDOC]]', 1025, sudocBibliographicLink },
{ 'ZDB', 'ZDB', 1042, zdbLink },
{ 'SWB', 'SWB', 1044, swbLink },
{ 'NLM', '[[w:کتابخانه ملی پزشکی ایالات متحده آمریکا|NLM]]', 1055, nlmLink },
{ 'SELIBRbook', '[[w:سامانه اطلاعات کتابخانهای سوئد|SELIBR]]', 1182, selibrBibliographicLink },
{ 'ISFDBser', '[[w:en:Internet Speculative Fiction Database|ISFDB]]', 1235, isfdbSerLink },
{ 'ISFDBcon', '[[w:en:Internet Speculative Fiction Database|ISFDB]]', 1234, isfdbConLink },
{ 'OL', '[[w:کتابخانه باز|Open Library]]', 648, openLibLink },
{ 'ARCHIVE', '[[w:بایگانی اینترنت|Internet Archive]]', 724, archiveLink },
{ 'Gutenbergebook', '[[w:پروژه گوتنبرگ|Project Gutenberg]]', 2034, gutenbergebookLink },
{ 'DLI', '[[w:en:Digital Library of India|Digital Library of India]]', 2185, dliLink },
{ 'HathiTrust', '[[w:HathiTrust|HathiTrust]]', 1844, hathitrustLink },
{ 'Google', '[[w:گوگل بوکس|Google]]', 675, googleBooksLink },
{ 'Europeana', '[[w:یوروپیانا|Europeana]]', 727, europeanaLink },
{ 'LT', '[[w:لایبرری تینگ|LibraryThing]]', 1085, libraryThingLink },
{ 'Dewey', '[[w:ردهبندی دهدهی دیوئی|Dewey]]', 1036, ddcLink },
{ 'NARAorg', '[[w:دفتر ملی بایگانی و مدارک آمریکا|NARA]]', 1223, naraOrgLink },
{ 'NARAgeo', '[[w:دفتر ملی بایگانی و مدارک آمریکا|NARA]]', 1224, naraGeoLink },
{ 'NARAsub', '[[w:دفتر ملی بایگانی و مدارک آمریکا|NARA]]', 1225, naraSubLink },
{ 'NARAtype', '[[w:دفتر ملی بایگانی و مدارک آمریکا|NARA]]', 1226, naraTypeLink },
{ 'ISFDBpub', '[[w:en:Internet Speculative Fiction Database|ISFDB]]', 1239, isfdbPubLink },
{ 'LEMBP', 'LEMBP', 920, lembpLink },
{ 'IMDB', '[[w:بانک اطلاعات اینترنتی فیلمها|IMDB]]', 345, imdbLink },
{ 'Freebase', '[[w:فریبیس|Freebase]]', 646, freebaseLink },
{ 'KGMID', '[[w:گراف دانش گوگل|KGMID]]', 2671, googleKnowledgeGraphLink },
{ 'PRDL', '[[w:en:Post-Reformation Digital Library|PRDL]]', 1463, PrdlLink },
{ 'NUPILL-A', 'NUPILL', 1473, NupillALink },
{ 'MacTutorB', '[[w:بایگانی تاریخچه ریاضیات مکتیوتر|MacTutor]]', 1563, MacTutorBLink },
{ 'ATCL', '[[w:d:Special:EntityPage/Q18228305|ATCL]]', 1564, AtclLink },
{ 'ELeM', 'ELeM', 1565, ElemLink },
{ 'Imslp', '[[w:پروژه بینالمللی کتابخانه نتهای موسیقی|IMSLP]]', 839, ImslpLink },
{ 'Odnb', '[[w:فرهنگ زندگینامه ملی|ODNB]]', 1415, OdnbLink },
{ 'Gec', '[[w:en:Gran Enciclopèdia Catalana|GEC]]', 1296, GecLink },
{ 'BN.br', '[[w:کتابخانه ملی برزیل|BN.br]]', 4619, BNBRLink },
{ 'OnlineBooks', '[[w:en:Online Books Page|Online Books Page]]', 5396, onlineBooksLink },
{ 'Newspapers.com', '[[w:انسستری|Newspapers.com]]', 7259, newspapersComLink },
{ 'WCEntities', '[[w:ورلدکت|WorldCat Entities]]', 10832, worldcatEntitiesLink },
{ 'WORLDCATID', '[[w:ورلدکت|WorldCat Identities]]', 7859, worldcatIdentitiesLink },
{ 'WDQID', '[[w:d:Help:Items|آیتم ویکیداده]]', false, wikidataQIDLink },
{ 'MWPID', '[[w:mw:Manual:Page ID|ویکینبشتهٔ فارسی]]', false, mwPageIDLink },
}
-- پیش از افزودن، بررسی میشود که آیتم ویکیداده این ویژگی-->مقدار را داشته باشد
local reqs = {}
reqs['MBA'] = {
{ 106, 177220 }, -- شغل -> خواننده
{ 31, 177220 }, -- نمونهای از -> خواننده
{ 106, 13385019 }, -- شغل -> رپر
{ 31, 13385019 }, -- نمونهای از -> رپر
{ 106, 639669 }, -- شغل -> موسیقیدان
{ 31, 639669 }, -- نمونهای از -> موسیقیدان
{ 106, 36834 }, -- شغل -> آهنگساز
{ 31, 36834 }, -- نمونهای از -> آهنگساز
{ 106, 488205 }, -- شغل -> خوانندهترانهسرا
{ 31, 488205 }, -- نمونهای از -> خوانندهترانهسرا
{ 106, 183945 }, -- شغل -> تهیهکنندهٔ موسیقی
{ 31, 183945 }, -- نمونهای از -> تهیهکنندهٔ موسیقی
{ 106, 10816969 }, -- شغل -> دیجی باشگاهی
{ 31, 10816969 }, -- نمونهای از -> دیجی باشگاهی
{ 106, 130857 }, -- شغل -> دیجی
{ 31, 130857 }, -- نمونهای از -> دیجی
{ 106, 158852 }, -- شغل -> رهبر ارکستر
{ 31, 158852 }, -- نمونهای از -> رهبر ارکستر
{ 31, 215380 }, -- نمونهای از -> گروه موسیقی
}
function p._authorityControl(parentArgs)
local knownArgs = {}
for k, v in pairs(conf) do
table.insert(knownArgs, v[1])
end
for k, v in pairs(knownArgs) do
if parentArgs[v] == '' then
parentArgs[v] = nil
end
end
--ایجاد ردیفها
local elements = {}
parentArgs.MWPID = parentArgs.MWPID or mw.title.getCurrentTitle().id
parentArgs.WDQID = parentArgs.WDQID or mw.wikibase.getEntityIdForCurrentPage()
--تغییرمسیر PND به GND
if parentArgs.GND == nil then
parentArgs.GND = parentArgs.PND
parentArgs.PND = nil
end
--سازگاری با نگارشهای پیشین ویکینبشته
--تغییرمسیر LCCNid به LCCN
if parentArgs.LCCN == nil then
parentArgs.LCCN = parentArgs.LCCNid
parentArgs.LCCNid = nil
end
--استفادهٔ جایگزین از ویکیداده در صورت درخواست
local item = mw.wikibase.getEntity(parentArgs.WDQID) -- TODO: این بخش باید بهگونهای اصلاح شود که حتی زمانی که آیتم از نوع رده و مانند آن است، آیتم درست ویکیداده را پیدا کند.
if item ~= nil and item.claims ~= nil then
for _, params in pairs( conf ) do
if params[3] then
local val = parentArgs[params[1]]
if val == nil then
local canUseWikidata = nil
if reqs[params[1]] ~= nil then
canUseWikidata = matchesWikidataRequirements(item, reqs[params[1]])
else
canUseWikidata = true
end
if canUseWikidata then
local wikidataIds = getIdsFromWikidata(item, 'P' .. params[3])
if wikidataIds[1] then
parentArgs[params[1]] = wikidataIds[1]
end
end
end
end
end
end
--جایگزین برای «WORLDCATID» یعنی WorldCat Identities، فقط زمانی که «WCEntities» یعنی WorldCat Entities موجود نباشد
if parentArgs['WCEntities'] == nil and parentArgs['WORLDCATID'] == nil then
local lcauthParts = lcauthSplit(parentArgs['LCCN'] or '')
if type(lcauthParts) == 'table' and lcauthParts[1]:sub(1, 1) == 'n' then
parentArgs['WORLDCATID'] = 'lccn-' .. lcauthParts[1] .. lcauthParts[2] .. append(lcauthParts[3], '0', 6)
elseif parentArgs['VIAF'] ~= nil then
parentArgs['WORLDCATID'] = 'viaf-' .. parentArgs['VIAF']
end
end
--ردیفهای پیکربندیشده
local rct = 0
for k, params in pairs( conf ) do
local val = parentArgs[params[1]]
if val ~= nil then
table.insert(elements, createRow(params[1], params[2] .. ':', val, params[4](val), true))
rct = rct + 1
end
end
local elementscats
local title = mw.title.getCurrentTitle()
local namespace, pagename = title.namespace, title.text
if namespace == 0 then
elementscats = '[[رده:صفحههای اصلی دارای دادههای کتابخانهای]]'
elseif namespace == 2 and not title.isSubpage then
elementscats = '' -- صفحههای ریشهٔ فضای نام کاربر با استفاده از «شناسه» در تابع getCatForId() ردهبندی میشوند
elseif namespace == 100 and not title.isSubpage then
elementscats = '[[رده:صفحههای درگاه دارای دادههای کتابخانهای]]'
elseif namespace == 102 and not title.isSubpage then
elementscats = '[[رده:صفحههای پدیدآورنده دارای دادههای کتابخانهای]]'
else
elementscats = '[[رده:صفحههای گوناگون دارای دادههای کتابخانهای]]'
end
local authority_navbox = navbox({
name = 'Authority control',
listclass = 'hlist',
navboxclass = 'wst-authority-control acContainer ws-noexport dynlayout-exempt',
group1 = '[[w:کنترل از طریق مرجع|دادههای کتابخانهای]]' .. elementscats,
list1 = table.concat( elements )
})
-- XXX: ترفندی برای دور زدن نوشتن مجدد در parentArgs که در بالا انجام شد
local wci = parentArgs['WORLDCATID'] -- XXX: کمی راه میانبر، چون قرار است این بخش بههرحال بازنشسته شود
parentArgs = getArgs(mw.getCurrentFrame(), {removeBlanks = false})
parentArgs['WORLDCATID'] = wci -- XXX: وانمود میکنیم مقدار تولیدشدهٔ WorldCat Identities توسط کاربر وارد شده است
local unknown_param_check = check_parameters({
namespace = namespace,
pagename = pagename,
knownArgs = knownArgs,
parentArgs = parentArgs,
unknown = 'صفحههای استفادهکننده از دادههای کتابخانهای با پارامترهای ناشناخته',
known = 'صفحههای استفادهکننده از دادههای کتابخانهای با پارامترها'
})
return authority_navbox .. unknown_param_check
end
function p.authorityControl(frame)
return p._authorityControl(getArgs(frame, {removeBlanks = false}))
end
return p