Changes

Jump to navigation Jump to search

Module:Authority control

238 bytes added, 17:43, 11 December 2018
WorldCat standardization, per talk, from sandbox
local parentArgs = frame:getParent().args
local elements = {} --create/insert rows later
local worldcatCat = ''
local suppressedIdCat = ''
local deprecatedIdCat = ''
parentArgs[params[1]] = wikidataIds[1]
end end end end end end end
--Worldcat
if parentArgs['WORLDCATID'] and parentArgs['WORLDCATID'] ~= '' then
table.insert( elements, p.createRow( 'WORLDCATID', '', parentArgs['WORLDCATID'], '[[WorldCat]] [https://www.worldcat.org/identities/' .. parentArgs['WORLDCATID'] .. ' Identities]', false ) ) --Validation?
elseif parentArgs['WORLDCATID'] == nil then --must be unsuppressed
if parentArgs['VIAF'] and parentArgs['VIAF'] ~= '' and p.viafLink( parentArgs['VIAF'] ) then --VIAF must be unsuppressed & validated
table.insert( elements, p.createRow( 'VIAF', '', parentArgs['VIAF'], '[[WorldCat]] [https://www.worldcat.org/identities/containsVIAFID/' .. parentArgs['VIAF'] .. ' Identities]', false ) )
elseif parentArgs['LCCN'] and parentArgs['LCCN'] ~= '' and p.lccnLink( parentArgs['LCCN'] ) then --LCCN must be unsuppressed & validated
local lccnParts = p.splitLccn( parentArgs['LCCN'] )
if lccnParts and lccnParts[1] ~= 'sh' then
table.insert( elements, p.createRow( 'LCCN', '', parentArgs['LCCN'], '[[WorldCat]] [https://www.worldcat.org/identities/lccn-' .. lccnParts[1] .. lccnParts[2] .. '-' .. lccnParts[3] .. ' Identities]', false ) )
end
end
elseif parentArgs['WORLDCATID'] == '' then
suppressedIdCat = '[[Category:Wikipedia articles with suppressed authority control identifiers|WORLDCATID]]'
end
--Configured rows
end
end
--WorldCat
local worldcatId = parentArgs['WORLDCATID']
if worldcatId and worldcatId ~= '' then --if unsuppressed & present
table.insert( elements, p.createRow( 'WORLDCATID', '', worldcatId, '[[WorldCat Identities]]: [https://www.worldcat.org/identities/'..worldcatId..' '..worldcatId..']', false ) ) --Validation?
elseif worldcatId == nil then --if unsuppressed & absent
local viafId = parentArgs['VIAF']
local lccnId = parentArgs['LCCN']
if viafId and viafId ~= '' and p.viafLink( viafId ) then --VIAF must be unsuppressed & validated
table.insert( elements, p.createRow( 'VIAF', '', viafId, '[[WorldCat Identities]]: [https://www.worldcat.org/identities/containsVIAFID/'..viafId..' '..viafId..']', false ) )
worldcatCat = '[[Category:Wikipedia articles with WorldCat-VIAF identifiers]]'
elseif lccnId and lccnId ~= '' and p.lccnLink( lccnId ) then --LCCN must be unsuppressed & validated
local lccnParts = p.splitLccn( lccnId )
if lccnParts and lccnParts[1] ~= 'sh' then
local lccnIdFmtd = lccnParts[1] .. lccnParts[2] .. '-' .. lccnParts[3]
table.insert( elements, p.createRow( 'LCCN', '', lccnId, '[[WorldCat Identities]]: [https://www.worldcat.org/identities/lccn-'..lccnIdFmtd..' '..lccnIdFmtd..']', false ) )
worldcatCat = '[[Category:Wikipedia articles with WorldCat-LCCN identifiers]]'
end
end
elseif worldcatId == '' then --if suppressed
suppressedIdCat = '[[Category:Wikipedia articles with suppressed authority control identifiers|WORLDCATID]]'
end
local Navbox = require('Module:Navbox')
local elementsCat = ''
list1 = table.concat( elements )
} )
local auxCats = worldcatCat .. elementsCat .. suppressedIdCat .. deprecatedIdCat
if testcases then
auxCats = mw.ustring.gsub(auxCats, '(%[%[)(Category)', '%1:%2') --for easier checking
Anonymous user

Navigation menu