Modul:Authority control/bakpasir: Perbedaan antara revisi
Konten dihapus Konten ditambahkan
Hidayatsrf (bicara | kontrib) Tidak ada ringkasan suntingan |
|||
(14 revisi perantara oleh satu pengguna lainnya tidak ditampilkan) | |||
Baris 1:
require('
local p = {}
Baris 33:
function p.createRow( id, rawValues, link, links, withUid, specialCat, prefix)
local catName = 'Artikel Wikipedia dengan kesalahan penanda '..(specialCat or id)..' identifiers'
if links then -- all links[] use withUid = false; no check needed
local row = ''
if prefix then
row = row
end
for i, l in ipairs( links ) do
Baris 63:
--[[==========================================================================]]
-- If a link has a suitable entry in the global inter-wiki prefix table at [[:m:Interwiki_map]],
-- please consider routing through this prefix rather than as external link URL. -- This will ease future maintenance as necessary updates to the link can be centrally carried out there rather than by updating this module. -- The "external link" icon would disappear for such entries. function p.aagLink( id, label)
Baris 82 ⟶ 85:
function p.adbLink( id, label )
--P1907's format regex: [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
Baris 113 ⟶ 116:
end
return '[http://www.womenaustralia.info/biogs/'..id..'.htm '..(label or 'Australian Women\'s Register')..']'..p.getCatForId( 'AWR' )
end
Baris 130 ⟶ 125:
return false
end
return '[https://authority.bibsys.no/authority/rest/authorities/html/'..id..' '..(label or '
end
Baris 169 ⟶ 164:
id = 'cb'..id
end
return '[https://catalogue.bnf.fr/ark:/12148/'..id..' '
end
Baris 197 ⟶ 192:
return false
end
return '[http://cantic.bnc.cat/registres/CUCId/'..id..' '..(label or '
end
Baris 214 ⟶ 209:
end
return '[https://www.cwgc.org/find-war-dead/casualty/'..id..'/ '..(label or 'Commonwealth War Graves Commission')..']'..p.getCatForId( 'CWGC' )
end
function p.emuLink( id, label )
--P4613's format regex: \d{1,6} (e.g. 15409 (or 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 'Ukraina')..']'..p.getCatForId( 'EMU' )
end
Baris 276 ⟶ 279:
return false
end
return '[https://d-nb.info/gnd/'..id..' '..(label or 'Integrated Authority File (Jerman)')..']'..p.getCatForId( 'GND' )
end
Baris 284 ⟶ 287:
return false
end
return '[https://hls-dhs-dss.ch/fr/articles/'..id..' '..(label or 'Historical Dictionary of
end
Baris 342 ⟶ 345:
return false
end
return '[http://kulturnav.org/'..id..' '..(label or 'KulturNav (
end
Baris 372 ⟶ 375:
function p.leonoreLink( id, label )
--P640's format regex: LH//\d{1,4}/\d{1,3}|19800035/\d{1,4}/\d{1,5}(Bis|Ter)?|C/0/\d{1,2} (e.g. LH//2064/18)
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
Baris 382 ⟶ 387:
function p.maLink( id, label )
--P6366's format regex: [1-9]\d{
if not id:match( '^[1-9]%d%d%d%d?%d?%d?%d?%d?%d?$' ) then
return false
end
Baris 399 ⟶ 404:
return '['..url..' '..label..']'..cat
else
return '[[MBA (identifier)|MusicBrainz]] ['
end
end
Baris 413 ⟶ 418:
return '['..url..' '..label..']'..cat
else
return '[[MBAREA (identifier)|MusicBrainz]] ['
end
end
Baris 427 ⟶ 432:
return '['..url..' '..label..']'..cat
else
return '[[MBI (identifier)|MusicBrainz]] ['
end
end
Baris 441 ⟶ 446:
return '['..url..' '..label..']'..cat
else
return '[[MBL (identifier)|MusicBrainz]] ['
end
end
Baris 455 ⟶ 460:
return '['..url..' '..label..']'..cat
else
return '[[MBP (identifier)|MusicBrainz]] ['
end
end
Baris 469 ⟶ 474:
return '['..url..' '..label..']'..cat
else
return '[[MBRG (identifier)|MusicBrainz]] ['
end
end
Baris 483 ⟶ 488:
return '['..url..' '..label..']'..cat
else
return '[[MBS (identifier)|MusicBrainz]] ['
end
end
Baris 498 ⟶ 503:
return '['..url..' '..label..']'..cat
else
return '[[MBW (identifier)|MusicBrainz]] ['
end
end
Baris 697 ⟶ 702:
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 '..(label or '
end
Baris 745 ⟶ 750:
return false
end
return longurl..id..' '..(label or 'Terminologia Anatomica')..']'..p.getCatForId( 'TA98' ) end
Baris 756 ⟶ 762:
end
function p.tepapaLink( id, label )
Baris 776 ⟶ 769:
end
return '[https://collections.tepapa.govt.nz/agent/'..id..' '..(label or 'Te Papa (Selandia Baru)')..']'..p.getCatForId( 'TePapa' )
end
Baris 792 ⟶ 775:
--P1362's format regex: \p{Lu}[\p{L}\d_',\.\-\(\)\*/–]{3,59} (e.g. Abcd)
local class = "[%a%d_',%.%-%(%)%*/–]"
local regex =
if not mw.ustring.match( id, regex ) then
return false
Baris 812 ⟶ 795:
return false
end
return '[https://id.parliament.uk/'..id..' '..(label or '
end
Baris 828 ⟶ 811:
return false
end
return '[http://bioguide.congress.gov/scripts/biodisplay.pl?index='..id..' '..(label or '
end
Baris 846 ⟶ 829:
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
Baris 854 ⟶ 838:
function p.append(str, c, length)
while str:len() < length do
str = c
end
return str
Baris 869 ⟶ 853:
local result = (12 - remainder) % 11
if result == 10 then
return
end
return tostring( result )
Baris 922 ⟶ 906:
'! rowspan=2 | Parameter\n'..
'! rowspan=2 | Bagian\n'..
'! rowspan=2 |
'! rowspan=2; data-sort-type=number |
'! colspan=4 | Kategori pelacak dan jumlah halaman\n'..
'|-\n'..
'! [[:Kategori:Artikel Wikipedia dengan informasi pengawasan otoritas|'.. 'Artikel]]\n'..
'! [[:Kategori:Halaman pengguna dengan informasi pengawasan otoritas|'..
'! [[:Kategori:Halaman dengan informasi pengawasan otoritas|'..
'! [[:Kategori:Artikel Wikipedia dengan informasi pengawasan otoritas bermasalah|'.. 'ID bermasalah]]\n'..
'|-\n'
local lang = mw.getContentLanguage()
local a, u, m, f, P = 0, 0, 0, 0, 0 --cumulative sums
for _, conf in pairs( p.conf ) do
local param, pid, section = conf[1], conf[2], conf[4]
local appearsAs
if param ==
-- WorldCat is special
appearsAs =
elseif conf.prefix then
appearsAs = conf.prefix
Baris 943 ⟶ 928:
appearsAs = conf[3](conf[5])
end
local link = conf.link or param
local category = conf.category or param
local args = { id = 'f', pid }
local wpl = frame:expandTemplate{ title = 'Wikidata property link', args = args }
--cats
local articleCat = 'Artikel Wikipedia dengan penanda '..category..'
local userCat = 'Halaman pengguna dengan penanda '..category..'
local miscCat = 'Halaman dengan penanda '..category..'
local faultyCat = 'Artikel Wikipedia dengan dengan penanda '..category..' bermasalah'
--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, '
--calcs
P = P + 1 --property count
a = a + lang:parseFormattedNumber(articleCount)
u = u + lang:parseFormattedNumber(userCount)
m = m + lang:parseFormattedNumber(miscCount)
f = f + lang:parseFormattedNumber(faultyCount)
--concat
wikiTable = wikiTable..'\n'..
Baris 974 ⟶ 964:
local wcd = { 'WorldCat-LCCN', 'WorldCat-VIAF' }
for _, w in pairs(wcd) do
local articleCat = '
local articleCount = lang:formatNum( mw.site.stats.pagesInCategory(articleCat, '
local appearsAs
if w ==
appearsAs =
else
appearsAs =
end
a = a + lang:parseFormattedNumber(articleCount)
wikiTable = wikiTable..'\n'..
'|-\n'..
Baris 988 ⟶ 979:
'||'..appearsAs..
'||data-sort-value='..w..'|'..'—'..
'||style="text-align: right;"|[[:Kategori
'||style="text-align: right;"|—'..
'||style="text-align: right;"|—'..
Baris 994 ⟶ 985:
end
--append sums
wikiTable = wikiTable..'\n'..
'|-\n'..
'! style="text-align: right;" colspan=3|Total'..
'||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('Module:Suppress categories').main(wikiTable)..'\n|}'
end
Baris 1.001 ⟶ 1.002:
--[[==========================================================================]]
--
-- 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 table basic format: { 'parameter name', propertyId # in Wikidata, formatting/validation function, section, example ID for documentation }
-- p.conf table optional named parameters:
--
-- category: to override the ID in category names (defaults to "... with <parameter> identifiers")
-- prefix: to include a prefix (usually a wikilink explaining what the identifier is) before the external link itself
p.conf = {
{ 'AAG', 3372, p.aagLink,
{ 'ACM-DL', 864, p.acmLink,
{ 'ADB', 1907, p.adbLink,
{ 'AGSA', 6804, p.agsaLink,
{ 'autores.uy', 2558, p.autoresuyLink,
{ 'AWR',
{ '
{ '
{ '
{ '
{ '
{ '
{ '
{ '
{ 'CINII', 271, p.ciniiLink, 'Basis data ilmiah', 'DA12345678', link = 'CiNii (identifier)' },
{ 'CWGC', 1908, p.cwgcLink, 'Lain-lain', '1234567' },
{ '
{ '
{ '
{ '
{ '
{ 'FAST', 2163, p.fastLink,
{ 'FNZA', 6792, p.fnzaLink,
{ 'GND', 227, p.gndLink,
{ 'HDS', 902, p.hdsLink,
{ 'IAAF', 1146, p.iaafLink,
{ 'ICCU', 396, p.iccuLink,
{ 'ICIA', 1736, p.iciaLink,
{ 'IEU', 9070, p.ieuLink,
{ 'ISNI', 213, p.isniLink,
{ 'Joconde', 347, p.jocondeLink,
{ 'KULTURNAV', 1248, p.kulturnavLink,
{ 'LCCN', 244, p.lccnLink,
{ 'LIR', 886, p.lirLink,
{ 'LNB', 1368, p.lnbLink,
{ 'Léonore', 640, p.leonoreLink,
{ 'MA', 6366, p.maLink,
{ 'MBA', 434, p.mbaLink,
{ 'MBAREA', 982, p.mbareaLink,
{ 'MBI', 1330, p.mbiLink,
{ 'MBL', 966, p.mblLink,
{ 'MBP', 1004, p.mbpLink,
{ 'MBRG', 436, p.mbrgLink,
{ 'MBS', 1407, p.mbsLink,
{ 'MBW', 435, p.mbwLink,
{ 'MGP', 549, p.mgpLink,
{ 'NARA', 1225, p.naraLink,
{ 'NCL', 1048, p.nclLink,
{ 'NDL', 349, p.ndlLink,
{ 'NGV', 2041, p.ngvLink,
{ 'NKC', 691, p.nkcLink,
{ 'NLA', 409, p.nlaLink,
{ 'NLG', 3348, p.nlgLink,
{ 'NLI', 949, p.nliLink,
{ 'NLK', 5034, p.nlkLink,
{ 'NLP', 1695, p.nlpLink,
{ 'NLR', 1003, p.nlrLink,
{ 'NSK', 1375, p.nskLink,
{ 'NTA', 1006, p.ntaLink,
{ 'ORCID', 496, p.orcidLink,
{ 'PIC', 2750, p.picLink,
{ 'PLWABN', 7293, p.plwabnLink,
{ 'Publons', 3829, p.publonsLink,
{ 'RID', 1053, p.ridLink,
{ 'RISM', 5504, p.rismLink,
{ 'RERO', 3065, p.reroLink,
{ 'RKDartists', 650, p.rkdartistsLink,
{ 'RKDID', 350, p.rkdidLink,
{ 'RSL', 947, p.rslLink,
{ 'SELIBR', 906, p.selibrLink,
{ 'SIKART', 781, p.sikartLink,
{ 'SNAC-ID', 3430, p.snacLink,
{ 'SUDOC', 269, p.sudocLink,
{ 'S2AuthorId', 4012, p.s2authoridLink,
{ 'TA98', 1323, p.ta98Link,
{ 'TDVİA', 7314, p.tdviaLink,
{ '
{ '
{ 'Trove', 1315, p.troveLink, 'Lain-lain', '12345678', prefix = '[[Trove (identifier)|Trove (Australia)]]' }, --formerly NLA-person
{ '
{ 'ULAN', 245, p.ulanLink, 'Lembaga penelitian seni', '500123456' },
{ '
{ '
{ '
{ 'WORLDCATID', 7859, nil, 'Umum', nil, link = 'WorldCat Identities (identifier)' },
}
Baris 1.114 ⟶ 1.115:
}
-- Deprecated aliases to p.conf; tracked in [[
-- Format: { 'deprecated parameter name', 'replacement parameter name in p.conf' }
p.deprecated = {
{ 'GKD', 'GND' },
{ 'PND', 'GND' },
{ 'RLS', 'RSL' },
{ 'SWD', 'GND' },
{ 'NARA-organization', 'NARA' },
Baris 1.130 ⟶ 1.131:
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]
Baris 1.148 ⟶ 1.152:
end
--
for _, d in pairs( p.deprecated ) do
local dep, param = d[1], d[2]
Baris 1.154 ⟶ 1.158:
parentArgs[param] = parentArgs[dep]
if namespace == 0 then
deprecatedIdCat = '[[Kategori:
end
end
end
--
local itemId = nil
if namespace ~= 0 then
Baris 1.173 ⟶ 1.177:
--Wikidata fallback if available
if itemId then
local suppressedIdCount = 0
local iMatches = 0
for _, params in ipairs( p.conf ) do
Baris 1.181 ⟶ 1.186:
if wikidataIds[1] then
if val == '' and (namespace == 0 or testcases) then
suppressedIdCount = suppressedIdCount + 1
suppressedIdCat = '[[Kategori:Artikel Wikipedia dengan penanda pengawasan otoritas yang disembunyikan|'..params[1]..']]'
else
Baris 1.202 ⟶ 1.208:
if iMatches > 0 and iMatches == iParentArgs then
sameOnWDCat = '[[Kategori:Halaman yang menggunakan pengawasan otoritas dengan semua parameter cocok dengan Wikidata]]'
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 = '[[Kategori:'..sCat..']]'..p.redCatLink(sCat)
end
end
end
--configure rows
local rct = 0
local sectionOrder = {
local sections = {
[
[
[
[
[
[
[
}
--
--
if parentArgs.PLWABN or parentArgs.plwabn then
parentArgs.NLP = ''
Baris 1.230 ⟶ 1.245:
table.insert( tval, val )
if params.prefix then
table.insert( tlinks, params[3]( val,
else
table.insert( tlinks, params[3]( val ) )
end
end
--collect
if itemId and tval[1] then
local nextIdVal = 2
Baris 1.256 ⟶ 1.271:
rct = rct + 1
if tval[2] then
multipleIdCat = p.getCatForId( '
end
end
end
Baris 1.265 ⟶ 1.280:
local worldcatId = parentArgs['worldcatid'] or parentArgs['WORLDCATID']
if worldcatId and worldcatId ~= '' then --if WORLDCATID present & unsuppressed
table.insert( sections[
worldcatCat = p.getCatForId( 'WORLDCATID' )
rct = rct + 1
elseif worldcatId == nil then --if WORLDCATID absent but unsuppressed
local viafId = parentArgs['viaf'] or parentArgs['VIAF']
local lccnId = parentArgs['lccn'] or parentArgs['LCCN']
if viafId and viafId ~= '' and p.viafLink( viafId ) then --VIAF must be present, unsuppressed, & validated
table.insert( sections[
if namespace == 0 then
worldcatCat = '[[Kategori:Artikel Wikipedia dengan penanda WorldCat-VIAF]]'
end
rct = rct + 1
elseif lccnId and lccnId ~= '' and p.lccnLink( lccnId ) then --LCCN must be present, unsuppressed, & validated
local lccnParts = p.splitLccn( lccnId )
if lccnParts and lccnParts[1] ~= 'sh' then
local lccnIdFmtd = lccnParts[1]..lccnParts[2]..'-'..lccnParts[3]
table.insert( sections[
if namespace == 0 then
worldcatCat = '[[Kategori:Artikel Wikipedia dengan penanda WorldCat-LCCN]]'
end
end
rct = rct + 1
end
elseif worldcatId == '' then --if WORLDCATID suppressed
Baris 1.289 ⟶ 1.307:
end
--configure Navbox
local outString = ''
if rct > 0 then
local Navbox = require('Module:Navbox')
local sectionID = 1
local args = { pid = 'identifiers' } -- #target the list of identifiers
Baris 1.303 ⟶ 1.316:
local pencil = frame:expandTemplate{ title = 'EditAtWikidata', args = args}
local navboxArgs = {
name = '
navboxclass = 'authority-control',
bodyclass = 'hlist',
Baris 1.311 ⟶ 1.324:
for _, sectName in ipairs(sectionOrder) do
if #sections[sectName] ~= 0 then
navboxArgs[
navboxArgs[
sectionID = sectionID + 1
end
end
if navboxArgs.group2 then
navboxArgs.title = '[[Bantuan:Pengawasan otoritas|Pengawasan otoritas]]'..pencil
else
local sect = navboxArgs.group1
if sect ==
-- Just say "Authority control" with no label if only
-- since "
navboxArgs.group1 =
else
navboxArgs.group1 =
end
end
Baris 1.339 ⟶ 1.344:
end
--auxCats
if rct == 0 or rct >= 25 then
if namespace == 0 or testcases then
local eCat = 'AC dengan '..rct..' elemen'
elementsCat = '[[Kategori:'..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 yang menggunakan parameter state: collapsed'
elseif parentArgs.state == 'expanded' then sCat = 'AC yang menggunakan parameter state: expanded'
elseif parentArgs.state == 'autocollapse' then sCat = 'AC yang menggunakan parameter state: autocollapse'
else sCat = 'AC yang menggunakan parameter state: other'
end
stateCat = '[[Kategori:'..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, '(%[%[)(Category)', '%1:%2') --for easier checking
end
--out
outString = outString..auxCats
if namespace ~= 0 then
outString = mw.ustring.gsub(outString, '(%[%[)(Category:Artikel Wikipedia)', '%1:%2') --by definition
|