Modul:Authority control/bakpasir: Perbedaan antara revisi
Konten dihapus Konten ditambahkan
Hidayatsrf (bicara | kontrib) Tidak ada ringkasan suntingan |
|||
(10 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 161 ⟶ 164:
id = 'cb'..id
end
return '[https://catalogue.bnf.fr/ark:/12148/'..id..' '
end
Baris 206 ⟶ 209:
end
return '[https://www.cwgc.org/find-war-dead/casualty/'..id..'/ '..(label or 'Commonwealth War Graves Commission')..']'..p.getCatForId( 'CWGC' )
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 334 ⟶ 345:
return false
end
return '[http://kulturnav.org/'..id..' '..(label or 'KulturNav (
end
Baris 364 ⟶ 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 374 ⟶ 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 391 ⟶ 404:
return '['..url..' '..label..']'..cat
else
return '[[MBA (identifier)|MusicBrainz]] ['
end
end
Baris 405 ⟶ 418:
return '['..url..' '..label..']'..cat
else
return '[[MBAREA (identifier)|MusicBrainz]] ['
end
end
Baris 419 ⟶ 432:
return '['..url..' '..label..']'..cat
else
return '[[MBI (identifier)|MusicBrainz]] ['
end
end
Baris 433 ⟶ 446:
return '['..url..' '..label..']'..cat
else
return '[[MBL (identifier)|MusicBrainz]] ['
end
end
Baris 447 ⟶ 460:
return '['..url..' '..label..']'..cat
else
return '[[MBP (identifier)|MusicBrainz]] ['
end
end
Baris 461 ⟶ 474:
return '['..url..' '..label..']'..cat
else
return '[[MBRG (identifier)|MusicBrainz]] ['
end
end
Baris 475 ⟶ 488:
return '['..url..' '..label..']'..cat
else
return '[[MBS (identifier)|MusicBrainz]] ['
end
end
Baris 490 ⟶ 503:
return '['..url..' '..label..']'..cat
else
return '[[MBW (identifier)|MusicBrainz]] ['
end
end
Baris 737 ⟶ 750:
return false
end
return longurl..id..' '..(label or 'Terminologia Anatomica')..']'..p.getCatForId( 'TA98' ) end
Baris 747 ⟶ 761:
return '[https://islamansiklopedisi.org.tr/'..id..' '..(label or 'Encyclopedia of Islam')..']'..p.getCatForId( 'TDVİA' )
end
function p.tepapaLink( id, label )
Baris 760 ⟶ 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 814 ⟶ 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 822 ⟶ 838:
function p.append(str, c, length)
while str:len() < length do
str = c
end
return str
Baris 837 ⟶ 853:
local result = (12 - remainder) % 11
if result == 10 then
return
end
return tostring( result )
Baris 890 ⟶ 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 911 ⟶ 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
Baris 925 ⟶ 942:
local miscCount = lang:formatNum( mw.site.stats.pagesInCategory(miscCat, 'pages') )
local faultyCount = lang:formatNum( mw.site.stats.pagesInCategory(faultyCat, 'pages') )
--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 942 ⟶ 964:
local wcd = { 'WorldCat-LCCN', 'WorldCat-VIAF' }
for _, w in pairs(wcd) do
local articleCat = '
local articleCount = lang:formatNum( mw.site.stats.pagesInCategory(articleCat, 'pages') )
local appearsAs
if w ==
appearsAs =
else
appearsAs =
end
a = a + lang:parseFormattedNumber(articleCount)
wikiTable = wikiTable..'\n'..
'|-\n'..
Baris 956 ⟶ 979:
'||'..appearsAs..
'||data-sort-value='..w..'|'..'—'..
'||style="text-align: right;"|[[:Kategori
'||style="text-align: right;"|—'..
'||style="text-align: right;"|—'..
Baris 962 ⟶ 985:
end
--append sums
return require("Module:Suppress categories").main(wikiTable)..'\n|}'▼
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)
end
Baris 969 ⟶ 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 optional named parameters:
▲-- Parameter format: { 'parameter name', propertyId # in Wikidata, formatting/validation function, section, example ID for documentation }
--
-- 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',
{ 'BIBSYS', 1015, p.bibsysLink,
{ 'Bildindex', 2092, p.bildLink,
{ 'BNC', 1890, p.bncLink,
{ 'BNE', 950, p.bneLink,
{ 'BNF', 268, p.bnfLink,
{ 'Botanist', 428, p.botanistLink ,
{ 'BPN', 651, p.bpnLink ,
{ 'CANTIC', 1273, p.canticLink,
{ 'CINII', 271, p.ciniiLink,
{ 'CWGC', 1908, p.cwgcLink,
{ 'DAAO', 1707, p.daaoLink,
{ 'DBLP', 2456, p.dblpLink,
{ 'DIB', 6829, p.dibLink,
{ 'DSI', 2349, p.dsiLink,
{ '
{ '
{ '
{ '
{ '
{ 'IAAF', 1146, p.iaafLink, 'Lain-lain', '123' },
{ '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,
{ 'TePapa', 3544, p.tepapaLink,
{ 'TLS', 1362, p.tlsLink,
{ 'Trove', 1315, p.troveLink,
{ 'UKPARL', 6213, p.ukparlLink,
{ 'ULAN', 245, p.ulanLink,
{ 'USCongress', 1157, p.uscongressLink,
{ 'VcBA', 8034, p.vcbaLink,
{ 'VIAF', 214, p.viafLink,
{ 'WORLDCATID', 7859, nil,
}
Baris 1.079 ⟶ 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.095 ⟶ 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.113 ⟶ 1.152:
end
--
for _, d in pairs( p.deprecated ) do
local dep, param = d[1], d[2]
Baris 1.119 ⟶ 1.158:
parentArgs[param] = parentArgs[dep]
if namespace == 0 then
deprecatedIdCat = '[[Kategori:
end
end
end
--
local itemId = nil
if namespace ~= 0 then
Baris 1.138 ⟶ 1.177:
--Wikidata fallback if available
if itemId then
local suppressedIdCount = 0
local iMatches = 0
for _, params in ipairs( p.conf ) do
Baris 1.146 ⟶ 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.167 ⟶ 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
local s = 's'
if suppressedIdCount == 1 then s = '' end
local sCat = 'ACArt with '..suppressedIdCount..' suppressed element'..s
end
end
end
--
local rct = 0
local sectionOrder = {
local sections = {
[
[
[
[
[
[
[
}
--
--
if parentArgs.PLWABN or parentArgs.plwabn then
parentArgs.NLP = ''
Baris 1.195 ⟶ 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.224 ⟶ 1.274:
end
end
end
Baris 1.230 ⟶ 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
Baris 1.237 ⟶ 1.287:
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]]'
Baris 1.246 ⟶ 1.296:
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]]'
Baris 1.257 ⟶ 1.307:
end
--configure Navbox
local Navbox = require('Module:Navbox')▼
▲ local elementsCat = ''
▲ if rct == 0 or rct >= 25 then
local eCat = 'AC dengan '..rct..' elemen'▼
▲ elementsCat = '[[Kategori:'..eCat..']]'..p.redCatLink(eCat)
▲ end
local outString = ''
if rct > 0 then
local sectionID = 1
local args = { pid = 'identifiers' } -- #target the list of identifiers
Baris 1.271 ⟶ 1.316:
local pencil = frame:expandTemplate{ title = 'EditAtWikidata', args = args}
local navboxArgs = {
name = '
navboxclass = 'authority-control',
bodyclass = 'hlist',
Baris 1.279 ⟶ 1.324:
for _, sectName in ipairs(sectionOrder) do
if #sections[sectName] ~= 0 then
navboxArgs[
navboxArgs[
sectionID = sectionID + 1
end
end
if navboxArgs.group2 then
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.299 ⟶ 1.344:
end
--auxCats
local auxCats = worldcatCat .. elementsCat .. multipleIdCat .. suppressedIdCat .. ▼
if rct == 0 or rct >= 25 then
deprecatedIdCat .. differentOnWDCat .. sameOnWDCat▼
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
if testcases then
auxCats = mw.ustring.gsub(auxCats, '(%[%[)(Category)', '%1:%2') --for easier checking
end
outString = outString .. auxCats▼
--out
if namespace ~= 0 then
outString = mw.ustring.gsub(outString, '(%[%[)(Category:Artikel Wikipedia)', '%1:%2') --by definition
|