Prijeđi na sadržaj

Modul:Authority control

Izvor: Wikipedija
Datum izmjene: 21. marta 2022. u 15:43; autor: Edgar Allan Poe (razgovor | doprinosi) (a ovo?)

Dokumentaciju za ovaj modul možete napraviti na stranici Modul:Authority control/dok

require('Module:No globals')

local function getCatForId( id )
    local title = mw.title.getCurrentTitle()
    local namespace = title.namespace
    if namespace == 0 then
        return '[[Category:Wikipedijini članci sa ' .. id .. ' identifikatorima]]'
    elseif namespace == 2 and not title.isSubpage then
        return '[[Category:Korisničke stranice sa ' .. id .. ' identifikatorima]]'
    else
        return '[[Category:Razne stranice sa ' .. id .. ' identifikatorima]]'
    end
end

local function viafLink( id )
    if not string.match( id, '^%d+$' ) then
        return false
    end
    return '[https://viaf.org/viaf/' .. id .. ' ' .. id .. ']' .. getCatForId( 'VIAF' )
end

local function kulturnavLink( id )
    return '[http://kulturnav.org/language/en/' .. id .. ' id]' 
end

local function sikartLink( id )
    return '[http://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 ciniiLink( id )
    return '[http://ci.nii.ac.jp/author/' .. id .. '?l=en ' .. id .. ']' 
end

local function bneLink( id )
    return '[http://catalogo.bne.es/uhtbin/authoritybrowse.cgi?action=display&authority_id=' .. id .. ' ' .. id .. ']' 
end


local function uscongressLink( id )
    return '[http://bioguide.congress.gov/scripts/biodisplay.pl?index=' .. id .. ' ' .. id .. ']' 
end

local function narapersonLink( id )
    return '[https://research.archives.gov/person/' .. id .. ' ' .. id .. ']' 
end

local function naraorganizationLink( id )
    return '[https://research.archives.gov/organization/' .. id .. ' ' .. id .. ']' 
end

local function botanistLink( id )
	local id2 = mw.ustring.gsub(id, '%s', function(s) return mw.uri.encode(s, 'PATH') end)
    return '[http://www.ipni.org/ipni/advAuthorSearch.do?find_abbreviation=' .. id2 .. ' ' .. id .. ']' 
end

local function mgpLink( id )
    -- TODO Implement some sanity checking regex
    return '[http://www.genealogy.ams.org/id.php?id=' .. id .. ' ' .. id .. ']' 
end

local function rslLink( id )
    -- TODO Implement some sanity checking regex
    return '[http://aleph.rsl.ru/F?func=find-b&find_code=SYS&adjacent=Y&local_base=RSL11&request=' .. id .. '&CON_LNG=ENG ' .. id .. ']'
end

local function leonoreLink( id )
-- Identifiants allant de LH/1/1 à LH/2794/54 (légionnaires)
-- Identifiants allant de C/0/1 à C/0/84 (84 légionnaires célèbres)
-- Identifiants allant de 19800035/1/1 à 19800035/385/51670 (légionnaires décédés entre 1954 et 1977, et quelques dossiers de légionnaires décédés avant 1954)
    if not string.match( id, '^LH/%d%d?%d?%d?/%d%d?%d?$' ) and
       not string.match( id, '^C/0/%d%d?$' ) and
	   not string.match( id, '^19800035/%d%d?%d?%d?/%d%d?%d?%d?%d?$' ) then
        return false
    end
    return '[//www.culture.gouv.fr/public/mistral/leonore_fr?ACTION=CHERCHER&FIELD_1=COTE&VALUE_1=' .. id .. ' ' .. id .. ']' 
end

local function sbnLink( id )
    if not string.match( id, '^IT\\ICCU\\%d%d%d%d%d%d%d%d%d%d$' ) and not string.match( id, '^IT\\ICCU\\%u%u[%d%u]%u\\%d%d%d%d%d%d$' ) then
        return false
    end
    return '[http://opac.sbn.it/opacsbn/opac/iccu/scheda_authority.jsp?bid=' .. id .. ' ' .. id .. ']' .. getCatForId( 'SBN' )
end

local function nkcLink( id )
	return '[http://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 '[http://aleweb.ncl.edu.tw/F/?func=accref&acc_sequence=' .. id .. '&CON_LNG=ENG ' .. id .. ']' 
end

local function ndlLink( id )
	return '[http://id.ndl.go.jp/auth/ndlna/' .. id .. ' ' .. id .. ']' 
end

local function sudocLink( id )
    if not string.match( id, '^%d%d%d%d%d%d%d%d[%dxX]$' ) then
        return false
    end
    return '[http://www.idref.fr/' .. id .. ' ' .. id .. ']' 
end

local function hlsLink( id )
    if not string.match( id, '^%d+$' ) then
        return false
    end
    return '[http://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 splitLccn( 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)
    while str:len() < length do
        str = c .. str
    end
    return str
end

local function lccnLink( id )
    local parts = splitLccn( id )
    if not parts then
        return false
    end
    local lccnType = parts[1] ~= 'sh' and 'names' or 'subjects'
    id = parts[1] .. parts[2] .. append( parts[3], '0', 6 )
    return '[http://id.loc.gov/authorities/' .. lccnType .. '/' .. id .. ' ' .. id .. ']' .. getCatForId( 'LCCN' )
end

local function mbLink( id )
    -- TODO Implement some sanity checking regex
    return '[//musicbrainz.org/artist/' .. id .. ' ' .. id .. ']' .. getCatForId( 'MusicBrainz' )
end

--Returns the ISNI check digit isni must be a string where the 15 first elements are digits
local function getIsniCheckDigit( isni )
    local total = 0
    for i = 1, 15 do
        local digit = isni:byte( i ) - 48 --Get integer value
        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

--Validate ISNI (and ORCID) and retuns it as a 16 characters string or returns false if it's invalid
--See http://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 '[http://isni.org/isni/' .. id .. ' ' .. id:sub( 1, 4 ) .. ' ' .. id:sub( 5, 8 ) .. ' '  .. id:sub( 9, 12 ) .. ' '  .. id:sub( 13, 16 ) .. ']' .. getCatForId( 'ISNI' )
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 '[http://orcid.org/' .. id .. ' ' .. id .. ']' .. getCatForId( 'ORCID' )
end

local function gndLink( id )
    return '[http://d-nb.info/gnd/' .. id .. ' ' .. id .. ']' .. getCatForId( 'GND' )
end

local function selibrLink( id )
	if not string.match( id, '^%d+$' ) then
        return false
    end
    return '[//libris.kb.se/auth/' .. id .. ' ' .. id .. ']' .. getCatForId( 'SELIBR' )
end

local function bnfLink( id )
    --Add cb prefix if it has been removed
    if not string.match( id, '^cb.+$' ) then
        id = 'cb' .. id
    end

    return '[http://catalogue.bnf.fr/ark:/12148/' .. id .. ' ' .. id .. '] [http://data.bnf.fr/ark:/12148/' .. id .. ' (podaci)]' .. getCatForId( 'BNF' )
end

local function bpnLink( id )
    if not string.match( id, '^%d+$' ) then
        return false
    end
    return '[http://www.biografischportaal.nl/en/persoon/' .. id .. ' ' .. id .. ']' .. getCatForId( 'BPN' )
end

local function ridLink( id )
    return '[http://www.researcherid.com/rid/' .. id .. ' ' .. id .. ']' .. getCatForId( 'RID' )
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 .. ']' .. getCatForId( 'BIBSYS' )
end

local function ulanLink( id )
    return '[//www.getty.edu/vow/ULANFullDisplay?find=&role=&nation=&subjectid=' .. id .. ' ' .. id .. ']' .. getCatForId( 'ULAN' )
end

local function nlaLink( id )
	return '[//nla.gov.au/anbd.aut-an' .. id .. ' ' .. id .. ']' .. getCatForId( 'NLA' )
end

local function rkdartistsLink( id )
	return '[https://rkd.nl/en/explore/artists/' .. id .. ' ' .. id .. ']' .. getCatForId( 'RKDartists' )
end

local function conorLink( id )
    if not string.match( id, '^%d+$' ) then
        return false
    end
    return '[http://www.cobiss.si/scripts/cobiss?command=DISPLAY&base=CONOR&rid=' .. id .. ' ' .. id .. ']' .. getCatForId( 'CONOR.SI' )
end

local function nskLink( id )
    if not string.match( id, '^%d%d%d%d%d%d%d%d%d$' ) then
        return false
    end
    return '[http://katalog.nsk.hr/F/?func=direct&doc_number=' .. id .. '&local_base=nsk10 ' .. id .. ']' .. getCatForId( 'NSK' ) --no https as of 9/2019
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">' .. link .. '</span>\n'
        else
            return '* ' .. label .. ' ' .. link .. '\n'
        end
    else
        return '* <span class="error">The ' .. id .. ' id ' .. rawValue .. ' is not valid.</span>[[Category:Wikipedia articles with faulty authority control identifiers (' .. id .. ')]]\n'
    end
end

--In this order: name of the parameter, label, propertyId in Wikidata, formatting function
local conf = {
	{ 'AAG', 3372, p.aagLink, 'Art galleries and museums', '1' },
	{ 'ACM-DL', 864, p.acmLink, 'Scientific databases', '12345678901', link = 'ACM DL (identifier)' },
	{ 'ADB', 1907, p.adbLink,'Biographical dictionaries', 'barton-sir-edmund-toby-71' },
	{ 'admiralty', 3562, p.admiraltyLink, 'Lighthouse identifiers', 'D1204.1', prefix='[[Admiralty number|Admiralty]]'},
	{ 'AGSA', 6804, p.agsaLink, 'Art galleries and museums', '3625' },
	{ 'ARLHS', 2980, p.ARLHSLink, 'Lighthouse identifiers', 'LAT023'},
	{ 'autores.uy', 2558, p.autoresuyLink, 'Biographical dictionaries', '12345' },
	{ 'AWR', 4186, p.awrLink, 'Biographical dictionaries', 'PR00768b' },
	{ 'BIBSYS', 1015, p.bibsysLink, 'National libraries', '1234567890123' },
	{ 'Bildindex', 2092, p.bildLink, 'Art research institutes', '1' },
	{ 'BNC', 1890, p.bncLink, 'National libraries', '123456789' },
	{ 'BNE', 950, p.bneLink, 'National libraries', 'XX1234567' },
	{ 'BNF', 268, p.bnfLink, 'National libraries', '123456789' },
	{ 'Botanist', 428, p.botanistLink , 'Scientific databases', 'L.' },
	{ 'BPN', 651, p.bpnLink , 'Biographical dictionaries', '12345678' },
	{ 'CANTIC', 1273, p.canticLink, 'National libraries', 'a12345678' },
	{ 'CANTICN', 9984, p.canticnLink, 'National libraries', '981058515460906706' },
	{ 'CCG', 3920, p.ccgLink, 'Lighthouse identifiers', 'A1761', prefix='[[CCG (identifier)|CCG]]' },
	{ 'CINII', 271, p.ciniiLink, 'Scientific databases', 'DA12345678', link = 'CiNii (identifier)' },
	{ 'CWGC', 1908, p.cwgcLink, 'Other', '1234567' },
	{ 'DAAO', 1707, p.daaoLink, 'Art research institutes', 'rolf-harris' },
	{ 'DBLP', 2456, p.dblpLink, 'Scientific databases', '123/123' },
	{ 'DIB',  6829, p.dibLink, 'Biographical dictionaries', 'a1234' },
	{ 'DSI', 2349, p.dsiLink, 'Art research institutes', '1538' },
	{ 'DTBIO', 7902, p.dtbioLink, 'Biographical dictionaries', '118554700' },
	{ 'EMU', 4613, p.emuLink, 'National libraries', '15409' },
	{ 'FAST', 2163, p.fastLink, 'Other', '1' },
	{ 'FNZA', 6792, p.fnzaLink, 'Art research institutes', '12' },
	{ 'GND', 227, p.gndLink, 'National libraries', '4079154-3' },
	{ 'Google Scholar', 1960, p.googleLink, 'Scientific databases', 'QPdLuj8AAAAJ' },
	{ 'HDS', 902, p.hdsLink, 'Other', '050123' },
	{ 'IAAF', 1146, p.iaafLink, 'Other', '123' },
	{ 'ICCU', 396, p.iccuLink, 'National libraries', 'CFIV000163' }, --formerly SBN
	{ 'ICIA', 1736, p.iciaLink, 'Art research institutes', '1' },
	{ 'IEU', 9070, p.ieuLink, 'Other', 'N\\A\\NationalAcademyofArtandArchitecture' },
	{ 'ISNI', 213, p.isniLink, 'General', '0000-0000-6653-4145', prefix = '[[ISNI (identifier)|ISNI]]' },
	{ 'J9U', 8189, p.j9uLink, 'National libraries', '987007305652505171' },
	{ 'Joconde', 347, p.jocondeLink, 'Art research institutes', '12345678901' },
	{ 'KULTURNAV', 1248, p.kulturnavLink, 'Art research institutes', '12345678-1234-1234-1234-1234567890AB', link = 'KulturNav (identifier)' },
	{ 'LCCN', 244, p.lccnLink, 'National libraries', 'n78039510' },
	{ 'LIR', 886, p.lirLink, 'Other', '1' },
	{ 'LNB', 1368, p.lnbLink, 'National libraries', '123456789' },
	{ 'MATHSN', 4955, p.mathsnLink, 'Scientific databases', '175270' },
	{ 'MBA', 434, p.mbaLink, 'Other', '12345678-1234-1234-1234-1234567890AB', category = 'MusicBrainz' }, --special cat name
	{ 'MBAREA', 982, p.mbareaLink, 'Other', '12345678-1234-1234-1234-1234567890AB', category = 'MusicBrainz area' }, --special cat name
	{ 'MBI', 1330, p.mbiLink, 'Other', '12345678-1234-1234-1234-1234567890AB', category = 'MusicBrainz instrument' }, --special cat name
	{ 'MBL', 966, p.mblLink, 'Other', '12345678-1234-1234-1234-1234567890AB', category = 'MusicBrainz label' }, --special cat name
	{ 'MBP', 1004, p.mbpLink, 'Other', '12345678-1234-1234-1234-1234567890AB', category = 'MusicBrainz place' }, --special cat name
	{ 'MBRG', 436, p.mbrgLink, 'Other', '12345678-1234-1234-1234-1234567890AB', category = 'MusicBrainz release group' }, --special cat name
	{ 'MBS', 1407, p.mbsLink, 'Other', '12345678-1234-1234-1234-1234567890AB', category = 'MusicBrainz series' }, --special cat name
	{ 'MBW',  435, p.mbwLink, 'Other', '12345678-1234-1234-1234-1234567890AB', category = 'MusicBrainz work' }, --special cat name
	{ 'MGP', 549, p.mgpLink, 'Scientific databases', '123456' },
	{ 'NARA', 1225, p.naraLink, 'Other', '12345678' },
	{ 'NCL', 1048, p.nclLink, 'National libraries', '1081436' },
	{ 'NDL', 349, p.ndlLink, 'National libraries', '012345678' },
	{ 'NGA', 3563, p.ngaLink, 'Lighthouse identifiers', '114-5592'},
	{ 'NGV', 2041, p.ngvLink, 'Art galleries and museums', '12354' },
	{ 'NKC', 691, p.nkcLink, 'National libraries', 'abcd12345678901234' },
	{ 'NLA', 409, p.nlaLink, 'National libraries', '123456789012' },
	{ 'NLG', 3348, p.nlgLink, 'National libraries', '12345678' },
	{ 'NLK', 5034, p.nlkLink, 'National libraries', 'KAB197000000' },
	{ 'NLP', 1695, p.nlpLink, 'National libraries', '9810123456789012345' },
	{ 'NLR', 1003, p.nlrLink, 'National libraries', '123456789' },
	{ 'NSK', 1375, p.nskLink, 'National libraries', '123456789' },
	{ 'NTA', 1006, p.ntaLink, 'National libraries', '12345678X' },
	{ 'ORCID', 496, p.orcidLink, 'General', '0000-0002-7398-5483', prefix = '[[ORCID (identifier)|ORCID]]' },
	{ 'PIC', 2750, p.picLink, 'Art research institutes', '1' },
	{ 'PLWABN',  7293, p.plwabnLink, 'National libraries', '9812345678905606' },
	{ 'Publons', 3829, p.publonsLink, 'Scientific databases', '2776255' },
	{ 'RID', 1053, p.ridLink, 'Scientific databases', 'A-1234-1934' },
	{ 'RISM', 5504, p.rismLink, 'Other', 'pe1',  prefix = '[[RISM (identifier)|RISM (France)]]' },
	{ 'RERO', 3065, p.reroLink, 'Other', '02-A012345678', prefix = '[[RERO (identifier)|RERO (Switzerland)]]' },
	{ 'RKDartists', 650, p.rkdartistsLink, 'Art research institutes', '123456' },
	{ 'RKDID', 350, p.rkdidLink, 'Art research institutes', '123456' },
	{ 'RSL', 947, p.rslLink, 'National libraries', '123456789' },
	{ 'Scopus', 1153, p.scopusLink, 'Scientific databases', '7005487412' },
	{ 'SELIBR', 906, p.selibrLink, 'National libraries', '123456' },
	{ 'SIKART', 781, p.sikartLink, 'Art research institutes', '123456789' },
	{ 'SNAC-ID', 3430, p.snacLink, 'Other', 'A' },
	{ 'SUDOC', 269, p.sudocLink, 'Other', '026927608', prefix = '[[SUDOC (identifier)|SUDOC (France)]]' },
	{ 'TA98', 1323, p.ta98Link, 'Scientific databases', 'A12.3.45.678' },
	{ 'TDVİA', 7314, p.tdviaLink, 'Other', 'asim-b-behdele' },
	{ 'TePapa', 3544, p.tepapaLink, 'Art galleries and museums', '1' },
	{ 'TLS',  1362, p.tlsLink, 'Other', 'Abcd' },
	{ 'Trove', 1315, p.troveLink, 'Other', '12345678', prefix = '[[Trove (identifier)|Trove (Australia)]]' }, --formerly NLA-person
	{ 'UKPARL', 6213, p.ukparlLink, 'Other', 'AQUupyiR' },
	{ 'ULAN', 245, p.ulanLink, 'Art research institutes', '500123456' },
	{ 'USCG', 3723, p.uscgLink, 'Lighthouse identifiers', '6-0695', prefix='[[USCG (identifier)|USCG]]'},
	{ 'USCongress', 1157, p.uscongressLink, 'Other', 'A000123', link = 'US Congress (identifier)' },
	{ 'VcBA', 8034, p.vcbaLink, 'National libraries', '494/9793' },
	{ 'VIAF', 214, p.viafLink, 'General', '123456789', prefix = '[[VIAF (identifier)|VIAF]]' },
	{ 'WORLDCATID', 7859, p.worldcatidLink, 'General', 'lccn-n78-95332', link = 'WorldCat Identities (identifier)' },
	{ 'ZBMATH', 1556, p.zbmathLink, 'Scientific databases', 'turing.alan-m' },
}

-- Check that the Wikidata item has this property-->value before adding it
local reqs = {}

local p = {}

function p.authorityControl( frame )
    local parentArgs = frame:getParent().args
    --Create rows
    local elements = {}

    --redirect PND to GND
    if (parentArgs.GND == nil or parentArgs.GND == '') and parentArgs.PND ~= nil and parentArgs.PND ~= '' then
        parentArgs.GND = parentArgs.PND
    end

    --Wikidata fallback if requested
    local item = mw.wikibase.getEntityObject()
    if item ~= nil and item.claims ~= nil then
        for _, params in pairs( conf ) do
            if params[3] ~= 0 then
                local val = parentArgs[params[1]]
                if not val or val == '' 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

    --Worldcat
    if parentArgs['WORLDCATID'] and parentArgs['WORLDCATID'] ~= '' then
        table.insert( elements, createRow( 'WORLDCATID', '', parentArgs['WORLDCATID'], '[//www.worldcat.org/identities/' .. parentArgs['WORLDCATID'] .. ' WorldCat identiteti]', false ) ) --Validation?
    elseif parentArgs['VIAF'] and string.match( parentArgs['VIAF'], '^%d+$' ) then -- Hackishly copy the validation code; this should go away when we move to using P1793 and P1630
        table.insert( elements, createRow( 'VIAF', '', parentArgs['VIAF'], '[//www.worldcat.org/identities/containsVIAFID/' .. parentArgs['VIAF'] .. ' WorldCat identiteti]', false ) )
    elseif parentArgs['LCCN'] and parentArgs['LCCN'] ~= '' then
        local lccnParts = splitLccn( parentArgs['LCCN'] )
        if lccnParts and lccnParts[1] ~= 'sh' then
            table.insert( elements, createRow( 'LCCN', '', parentArgs['LCCN'], '[//www.worldcat.org/identities/lccn-' .. lccnParts[1] .. lccnParts[2] .. '-' .. lccnParts[3] .. ' WorldCat identiteti]', false ) )
        end
    end

    --Configured rows
    local rct = 0
    for k, params in pairs( conf ) do
        local val = parentArgs[params[1]]
        if val and val ~= '' then
            table.insert( elements, createRow( params[1], params[2] .. ':', val, params[4]( val ), true ) )
            rct = rct + 1
        end
    end
    local Navbox = require('Module:Navbox')
    local elementscats = ''
		local args = {}
		local pencil = frame:expandTemplate{ title = 'EditAtWikidata', args = args}
    if rct > 13 then
    	elementscats  = '[[Category:AC with ' .. rct .. ' elements]]'
	end
	
	if #elements ~= 0 then
		return Navbox._navbox( {
			name  = 'Authority control',
			bodyclass = 'hlist',
			group1 = '[[Pomoć:Normativna kontrola|Normativna kontrola]]' .. pencil .. elementscats,
			list1 = table.concat( elements )
			} )
	else
		return ""
	end
end

return p