Changes
Jump to navigation
Jump to search
use mw.ustring.match for function tlsLink to fix Lua bug at Friedrich Dürrenmatt; see Template talk:Authority control#The time allocated for running scripts has expired
local class = "[%a%d_',%.%-%(%)%*/–]"
local regex = "^%u" .. string.rep(class, 3) .. string.rep(class.."?", 56) .. "$"
if not stringmw.ustring.match( id2, regex ) then
return false
end
function p.bneLink( id )
--P950's format regex: (XX|FF|a)\d{4,7}|(bima|bimo|bica|bis[eo]|bivi|Mise|Mimo|Mima)\d{10} (e.g. XX1234567)
if not string.match( id, '^[XF][XF]%d%d%d%d%d?%d?%d?$' ) and not string.match( id, '^a%d%d%d%d%d?%d?%d?$' ) and not string.match( id, '^bi[mcsv][aoei]%d%d%d%d%d%d%d%d%d%d$' ) and
not string.match( id, '^Mi[sm][eoa]%d%d%d%d%d%d%d%d%d%d$' ) then
return false
function p.hdsLink( id )
--P902's format regex: 50\d{3}|[1-4]\d{4}|[1-9]\d{0,3}| (e.g. 50123)
if not string.match( id, '^50%d%d%d$' ) and not string.match( id, '^[1-4]%d%d%d%d$' ) and
not string.match( id, '^[1-9]%d?%d?%d?$' ) then
return false
function p.gndLink( id )
--P227's format regex: (1|1[01])\d{7}[0-9X]|[47]\d{6}-\d|[1-9]\d{0,7}-[0-9X]|3\d{7}[0-9X] (e.g. 4079154-3)
if not string.match( id, '^1[01]?%d%d%d%d%d%d%d[0-9X]$' ) and not string.match( id, '^[47]%d%d%d%d%d%d%-%d$' ) and
not string.match( id, '^[1-9]%d?%d?%d?%d?%d?%d?%d?%-[0-9X]$' ) and
not string.match( id, '^3%d%d%d%d%d%d%d[0-9X]$' ) then
function p.dblpLink( id )
--P2456's format regex: \d{2,3} /\d+(-\d+)?|[a-z] /[a-zA-Z][0-9A-Za-z]*(-\d+)? (e.g. 123/123)
if not string.match( id, '^%d%d%d?/%d+$' ) and not string.match( id, '^%d%d%d?/%d+%-%d+$' ) and
not string.match( id, '^[a-z]/[a-zA-Z][0-9A-Za-z]*$' ) and
not string.match( id, '^[a-z]/[a-zA-Z][0-9A-Za-z]*%-%d+$' ) then
return '*<span class="nowrap">' .. label .. ' ' .. link .. '</span>\n'
end
local catName = 'Wikipedia articles with faulty authority control identifiers (' .. id .. ')'
return '* <span class="error">The ' .. id .. ' id ' .. rawValue .. ' is not valid.</span>[[Category:' .. catName .. ']]' .. p.redCatLink(catName) .. '\n'
-- Creates a human-readable standalone wikitable version of p.conf, and tracking categories with page counts, for use in the documentation
function p.docConfTable( frame )
local wikiTable = '{| class="wikitable sortable"\n' ..
'! rowspan=2 | Parameter\n' ..
'! rowspan=2 | Label\n' ..
'! Faulty IDs\n' ..
'|-\n'
for _, conf in pairs( p.conf ) do
local param, link, pid = conf[1], conf[2], conf[3]
local elements = {} --insert/create rows later
local suppressedCats = ''
--Redirect aliases to parameter names
for _, a in pairs( p.aliases ) do
end
end
--Use QID= parameter for testing/example purposes only
local itemId = nil
itemId = mw.wikibase.getEntityIdForCurrentPage()
end
--Wikidata fallback if requested
if itemId then
parentArgs[params[1]] = wikidataIds[1]
end end end end end end end
--Worldcat
if parentArgs['WORLDCATID'] and parentArgs['WORLDCATID'] ~= '' then
end
end
--Configured rows
local rct = 0
elementsCats = '[[Category:' .. catName .. ']]' .. p.redCatLink(catName)
end
local outString = ''
if #elements ~= 0 then
outString = outString .. elementsCats
end
return outString
end
return p