Módulo:Controle de autoridade/Testes

Origem: Wikipédia, a enciclopédia livre.
Documentação do módulo[ver] [editar] [histórico] [purgar]

Descrição[editar código-fonte]

Este módulo contem código da predefinição {{Controle de autoridade}}. Consulte a sua documentação para mais informações.

Nomes dos parâmetros e propriedades Wikidata associadas[editar código-fonte]

Listadas na ordem mostradas pelo módulo.

Order Parameter Label Wikidata property
1 VIAF VIAF P214: identificador VIAF
2 LCCN LCCN P244: número de controlo da Biblioteca do Congresso
3 ISNI ISNI P213: ISNI
4 ORCID ORCID P496: identificador ORCID
5 GND GND P227: identificador GND
6 SELIBR SELIBR P906: SELIBR
7 SUDOC SUDOC P269: identificador idRef
8 BNF BNF P268: identificador BnF
9 BPN BPN P651: Biografisch Portaal van Nederland ID
10 RID ResearcherID P1053: ResearcherID
11 BIBSYS BIBSYS P1015: identificador BIBSYS
12 ULAN ULAN P245: identificador ULAN
13 HDS HDS P902: identificador HDS
14 LIR LIR P886: LIR
15 MBA MusicBrainz P434: identificador MusicBrainz de artista
16 MGP MGP P549: identificador do Mathematics Genealogy Project
17 NLA NLA P409: identificador da Biblioteca National da Austrália
18 NDL NDL P349: identificador da Biblioteca Nacional da Dieta
19 NCL NCL P1048: identificador NCL
20 NKC NKC P691: identificador AUT NKC
21 Léonore Léonore P640: identificador Léonore
22 SBN ICCU P396: identificador SBN
23 RLS RLS P947: identificador RSL
24 PTBNP PTBNP P1005: identificador PTBNP
25 Botanist Botanist P428: abreviação do autor botânico
26 NARA-person NARA P1222
27 NARA-organization NARA P1223
28 USCongress US Congress P1157: US Congress Bio ID
29 BNE BNE P950: identificador BNE
30 CINII CiNii P271: NACSIS-CAT author ID
31 TLS TLS P1362: Theaterlexikon der Schweiz ID
32 SIKART SIKART P781: SIKART ID
33 KULTURNAV KulturNav P1248: KulturNav-ID
34 RKDartists RKD P650: identificador RKDartists
35 autores.uy autores.uy P2558: identificador Atores.UY
36 PIC PIC P2750: Photographers’ Identities Catalog ID
37 Itaulink Itaú Cultural P4399: Itaú Cultural ID

Categorias de monitoramento[editar código-fonte]

Este módulo atualmente implementa as seguintes categorias de monitoramento:

Por identificador[editar código-fonte]

Listados na ordem que são adicionados pelo módulo.

VIAF:

LCCN:

ISNI:

ORCID:

GND:

SELIBR:

BNF:

BPN:

RID:

BIBSYS:

ULAN:

MusicBrainz (MBA):

NLA:

SBN:

RKDartists:

IATH:

DBLP:

ACM DL:

autores.uy:

PIC:

Categorias existentes atualmente não implementadas neste módulo:

Identificadores com falhas[editar código-fonte]

Número de identificadores[editar código-fonte]

require('Módulo:No globals')

local p = {}

function p.generic ( id, link, parameter )
    local idlink = mw.ustring.gsub( id, ' ', '%%%%20' )
    idlink = mw.ustring.gsub( id, '%[', '%%5B' )
    idlink = mw.ustring.gsub( id, '%]', '%%5D' )
    link = mw.ustring.gsub( link, '$1', idlink )
    return '[' .. link .. ' ' .. id .. ']'
end

function p.bncLink ( id, link, parameter )
    --P1890's format regex: \d{9} (e.g. 123456789)
    -- filtro local do BNC, para evadir multitude de identificadores da Wikidata que não se ligam adequadamente
    -- ver https://www.wikidata.org/wiki/Wikidata:Database_reports/Constraint_violations/P1890#%22Format%22_violations
    if ( string.match( id, '^%d%d%d%d%d%d%d%d%d$' ) ) then
        return p.generic ( id, link, parameter )
    end
    return false
end

function p.ineLink ( id, link, parameter )
    -- representação especial da INE, link padrão com cinco parâmetros utilizados
    local ineMainRE, ineTailRE = '^(%d%d)(%d%d%d)', '(%d%d)(%d%d)(%d%d)'
    local codProv, codMuni, codEC, codES, codNUC = string.match( id, ineMainRE .. ineTailRE .. '$' )
    if not codEC or not codES or not codNUC then
        codProv, codMuni = string.match( id, ineMainRE .. '$' )
        if codProv and codMuni then
            codEC, codES, codNUC = '00', '00', '00'
        else
            codProv, codMuni = string.match( id, ineMainRE )
            codEC, codES, codNUC = '', '', ''
        end
    end
    if codProv and codMuni then
        link = 'http://www.ine.es/nomen2/inicio_a.do?accion=busquedaAvanzada&inicio=inicio_a&subaccion=&botonBusquedaAvanzada=Consultar+selecci%C3%B3n&numPag=0&ordenAnios=ASC&comunidad=00&entidad_amb=no&poblacion_amb=T&poblacion_op=%3D&poblacion_txt=&denominacion_op=like&denominacion_txt=&codProv=$1&codMuni=$2&codEC=$3&codES=$4&codNUC=$5'
        link = link:gsub('$1', codProv):gsub('$2', codMuni):gsub('$3', codEC):gsub('$4', codES):gsub('$5', codNUC)
        return p.generic( id, link, parameter )
    end
    return id
end

function p.aagLink( id, link, parameter)
    --P3372's format regex: \d+ (e.g. 1)
    if not id:match( '^%d+$' ) then
        return false
    end
    return p.generic( id, link, parameter ) .. ' [https://www.aucklandartgallery.com/explore-art-and-ideas/artist/'..id..'/ ' .. ' AAG]'
end

function p.acmLink( id, link, parameter )
    --P864's format regex: \d{11} (e.g. 12345678901)
    if not id:match( '^%d%d%d%d%d%d%d%d%d%d%d$' ) then
        return false
    end
    return p.generic( id, link, parameter ) .. ' [https://dl.acm.org/profile/' .. id .. ' ACM]'
end

function p.adbLink( id, link, parameter )
    --P1907's format regex: [a-z][-a-z]+-([1-3]\d|[1-9])\d{0,3} (e.g. barton-sir-edmund-toby-71)
    if not id:match( '^[a-z][-a-z]+-[1-3]%d%d?%d?%d?$' ) and
       not id:match( '^[a-z][-a-z]+-[1-9]%d?%d?%d?$' ) then
        return false
    end
    return '[http://adb.anu.edu.au/biography/'..id..' '..(id or 'Austrália')..']'
end

function p.admiraltyLink( id, link, parameter )
    --P3562's format regex: [A-Q]\d{4}(\.\d+)? (e.g. D1204.1)
    if not id:match('^[A-Q]%d%d%d%d$') and
       not id:match('^[A-Q]%d%d%d%d%.%d+$') then
        return false
    end
    return id
end

function p.agsaLink( id, link, parameter )
    --P6804's format regex: [1-9]\d* (e.g. 3625)
    if not id:match( '^[1-9]%d*$' ) then
        return false
    end
    return '[https://www.agsa.sa.gov.au/collection-publications/collection/creators/_/'..id..'/ '..(id or 'Sul da Austrália')..']'
end

function p.ARLHSLink( id, link, parameter )
    --P2980's format regex: [A-Z]{3}\d{3,4}[A-Z]?| e.g. LAT023
    if not id:match('^[A-Z][A-Z][A-Z]%d%d%d%d?[A-Z]?$') then
        return false
    end
    return '[http://wlol.arlhs.com/lighthouse/'..id..'.html '..(id or 'ARLHS')..']'
end

function p.autoresuyLink( id, link, parameter )
    --P2558's format regex: [1-9]\d{0,4} (e.g. 12345)
    if not id:match( '^[1-9]%d?%d?%d?%d?$' ) then
        return false
    end
    return '[https://autores.uy/autor/'..id..' '..(id or 'Uruguai')..']'
end

function p.awrLink( id, link, parameter )
    --P4186's format regex: (([A-Z]{3}\d{4})|([A-Z]{2}\d{5}))[a-z] (e.g. PR00768b)
    if not id:match( '^[A-Z][A-Z][A-Z]%d%d%d%d[a-z]$' ) and
       not id:match( '^[A-Z][A-Z]%d%d%d%d%d[a-z]$' ) then
        return false
    end
    return '[http://www.womenaustralia.info/biogs/'..id..'.htm '..(id or 'Australian Women\'s Register')..']'
end

function p.bibsysLink( id, link, parameter )
    --P1015's format regex: [1-9]\d* or [1-9](\d{0,8}|\d{12}) (e.g. 1234567890123)
    --TODO: follow up @ [[d:Property talk:P1015#Discrepancy between the 2 regex constraints]] or escalate/investigate
    if not id:match( '^[1-9]%d?%d?%d?%d?%d?%d?%d?%d?$' ) and
       not id:match( '^[1-9]%d%d%d%d%d%d%d%d%d%d%d%d$' ) then
        return false
    end
    return '[https://authority.bibsys.no/authority/rest/authorities/html/'..id..' '..(id or 'Noruega')..']'
end

function p.bildLink( id, link, parameter )
    --P2092's format regex: \d+ (e.g. 1)
    if not id:match( '^%d+$' ) then
        return false
    end
    return '[https://www.bildindex.de/document/obj'..id..' '..(id or 'Bildindex (Alemanha)')..']'
end

function p.blbnbLink( id, link, parameter )
    --P4619's format regex: \d{9}* (e.g. 001027092)
    if not id:match( '^%d%d%d%d%d%d%d%d%d$' ) then
        return false
    end
    return '[http://acervo.bn.br/sophia_web/autoridade/detalhe/'..id..' '..(id or 'BLBNB (Brasil)')..']'
end

function p.bneLink( id, link, parameter )
    --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 id:match( '^[XF][XF]%d%d%d%d%d?%d?%d?$' ) and
       not id:match( '^a%d%d%d%d%d?%d?%d?$' ) and
       not id:match( '^bi[mcsv][aoei]%d%d%d%d%d%d%d%d%d%d$' ) and
       not id:match( '^Mi[sm][eoa]%d%d%d%d%d%d%d%d%d%d$' ) then
        return false
    end
    return '[http://catalogo.bne.es/uhtbin/authoritybrowse.cgi?action=display&authority_id='..id..' '..(id or 'Espanha')..']' --no https as of 9/2019
end

function p.bnfLink( id, link, parameter )
    --P268's format regex: \d{8}[0-9bcdfghjkmnpqrstvwxz] (e.g. 123456789)
    if not id:match( '^c?b?%d%d%d%d%d%d%d%d[0-9bcdfghjkmnpqrstvwxz]$' ) then
        return false
    end
    --Add cb prefix if it has been removed
    if not id:match( '^cb.+$' ) then
        id = 'cb'..id
    end
    return p.generic( id, link, parameter ) .. ' [http://data.bnf.fr/ark:/12148/cb' .. id .. ' (data)]'
end

function p.botanistLink( id, link, parameter )
    --P428's format regex: ('t )?(d')?(de )?(la )?(van (der )?)?(Ma?c)?(De)?(Di)?\p{Lu}?C?['\p{Ll}]*([-'. ]*(van )?(y )?(d[ae][nr]?[- ])?(Ma?c)?[\p{Lu}bht]?C?['\p{Ll}]*)*\.? ?f?\.? (e.g. L.)
    --not easily/meaningfully implementable in Lua's regex since "(this)?" is not allowed...
    if not mw.ustring.match( id, "^[%u%l%d%. '-]+$" ) then --better than nothing
        return false
    end
    id = id:gsub(' +', '%%20')
    return '[https://www.ipni.org/ipni/advAuthorSearch.do?find_abbreviation='..id..' '..(id or 'Índice Internacional de Nomes de Plantas')..']'
end

function p.bndLink( id, link, parameter )
    --P5691's format regex: \d{5} (e.g. 22954)
    if not id:match( '^%d%d%d%d%d$' ) then
        return false
    end
    return '[http://purl.pt/'..id..(id or 'BND (Portugal)')..']'
end

function p.bpnLink( id, link, parameter )
    --P651's format regex: \d{6,8} (e.g. 00123456)
    if not id:match( '^%d%d%d%d%d%d%d%d$' ) and --original format regex, changed 8/2019 to
       not id:match( '^0?%d%d%d%d%d%d%d$' ) and --allow 1-2 leading 0s, allowed by the website
       not id:match( '^0?0?%d%d%d%d%d%d$' ) then
        return false
    end
    return '[http://www.biografischportaal.nl/en/persoon/'..id..' '..(id or 'Países Baixos')..']' --no https as of 9/2019
end

function p.canticLink( id, link, parameter )
    --P1273's format regex: a\d{7}[0-9x] (e.g. a10640745)
    if not id:match( '^a%d%d%d%d%d%d%d[%dx]$' ) then
        return false
    end
    return '[http://cantic.bnc.cat/registres/CUCId/'..id..' url]' --no https as of 10/2019
end

function p.ccgLink( id, link, parameter )
    --P3920's format regex: ([NAIP])?[1-9]\d*(\.\d+)? (e.g. A1761)
    if not id:match( '^[NAIP]?[1-9]%d*$' ) and
       not id:match( '^[NAIP]?[1-9]%d*%.%d+$' ) then
        return false
    end
    return id
end

function p.ciniiLink( id, link, parameter )
    --P271's format regex: DA\d{7}[\dX] (e.g. DA12345678)
    if not id:match( '^DA%d%d%d%d%d%d%d[%dX]$' ) then
        return false
    end
    return '[https://ci.nii.ac.jp/author/'..id..'?l=en '..(id or 'CiNii (Japão)')..']'
end

function p.cwgcLink( id, link, parameter )
    --P1908's format regex: [1-9]\d* (e.g. 75228351)
    if not id:match( '^[1-9]%d*$' ) then
        return false
    end
    return '[https://www.cwgc.org/find-war-dead/casualty/'..id..'/ '..(id or 'Commonwealth War Graves Commission')..']'
end

function p.emuLink( id, link, parameter )
    --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..' '..(id or 'Ucrânia')..']'
end

function p.daaoLink( id, link, parameter )
    --P1707's format regex: [a-z\-]+\d* (e.g. rolf-harris)
    if not id:match( '^[a-z%-]+%d*$' ) then
        return false
    end
    return '[https://www.daao.org.au/bio/'..id..' '..(id or 'Australian Artists')..']'
end

function p.dblpLink( id, link, parameter )
    --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 id:match( '^%d%d%d?/%d+$' ) and
       not id:match( '^%d%d%d?/%d+%-%d+$' ) and
       not id:match( '^[a-z]/[a-zA-Z][0-9A-Za-z]*$' ) and
       not id:match( '^[a-z]/[a-zA-Z][0-9A-Za-z]*%-%d+$' ) then
        return false
    end
    return '[https://dblp.org/pid/'..id..' '..(id or 'DBLP (ciência da computação)')..']'
end

function p.dibLink( id, link, parameter )
    --P6829's format regex: a\d{4}\d?(-[A-D])? (e.g. a1953)
    if not id:match( '^a%d%d%d%d%d?%-?[A-D]?$' ) then
        return false
    end
    return '[https://dib.cambridge.org/viewReadPage.do?articleId='..id..' '..(id or 'Irlanda')..']'
end

function p.dsiLink( id, link, parameter )
    --P2349's format regex: [1-9]\d* (e.g. 1538)
    if not id:match( '^[1-9]%d*$' ) then
        return false
    end
    return '[http://www.uni-stuttgart.de/hi/gnt/dsi2/index.php?table_name=dsi&function=details&where_field=id&where_value='..id..' '..(id or 'Ilustração técnica')..']'
end

function p.fastLink( id, link, parameter )
    --P2163's format regex: [1-9]\d{0,7} (e.g. 1916996)
    if not id:match( '^[1-9]%d?%d?%d?%d?%d?%d?%d?$' ) then
        return false
    end
    return '[http://id.worldcat.org/fast/'..id..'/ '..(id or 'Faceted Application of Subject Terminology')..']'
end

function p.fnzaLink( id, link, parameter )
    --P6792's format regex: [1-9]\d* (e.g. 9785)
    if not id:match( '^[1-9]%d*$' ) then
        return false
    end
    return '[https://findnzartists.org.nz/artist/'..id..'/ '..(id or 'New Zealand Artists')..']'
end

function p.gndLink( id, link, parameter )
    --P227's format regex: 1[012]?\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 id:match( '^1[012]?%d%d%d%d%d%d%d[0-9X]$' ) and
       not id:match( '^[47]%d%d%d%d%d%d%-%d$' ) and
       not id:match( '^[1-9]%d?%d?%d?%d?%d?%d?%d?%-[0-9X]$' ) and
       not id:match( '^3%d%d%d%d%d%d%d[0-9X]$' ) then
        return false
    end
    return '[https://d-nb.info/gnd/'..id..' '..(id or 'Gemeinsame Normdatei (Alemanha)')..']'
end

function p.googleLink( id, link, parameter )
    --P1960's format regex: [-_0-9A-Za-z]{12} (e.g. CUO0vDcAAAAJ)
    if not id:match( '^[%-_%d%l%u][%-_%d%l%u][%-_%d%l%u][%-_%d%l%u][%-_%d%l%u][%-_%d%l%u][%-_%d%l%u][%-_%d%l%u][%-_%d%l%u][%-_%d%l%u][%-_%d%l%u][%-_%d%l%u]$' ) then
        return false
    end
    return '[https://scholar.google.com/citations?user='..id..' '..(id or 'Google Scholar')..']'
end

function p.hdsLink( id, link, parameter )
    --P902's format regex: \d{6} (e.g. 050123)
    if not id:match( '^%d%d%d%d%d%d$' ) then
        return false
    end
    return '[https://hls-dhs-dss.ch/fr/articles/'..id..' '..(id or 'Dicionário Histórico da Suíça')..']'
end

function p.iaafLink( id, link, parameter )
    --P1146's format regex: [0-9][0-9]* (e.g. 012)
    if not id:match( '^%d+$' ) then
        return false
    end
    return '[https://www.iaaf.org/athletes/_/'..id..' '..(id or 'World Athletics')..']'
end

function p.iccuLink( id, link, parameter )
    --P396's format regex: IT\\ICCU\\(\d{10}|\D\D[\D\d]\D\\\d{6}) (e.g. IT\ICCU\CFIV\000163)
    if not id:match( '^IT\\ICCU\\%d%d%d%d%d%d%d%d%d%d$' ) and
       not id:match( '^IT\\ICCU\\%u%u[%u%d]%u\\%d%d%d%d%d%d$' ) then --legacy: %u used here instead of %D (but the faulty ID cat is empty, out of ~12k uses)
        return false
    end
    return '[https://opac.sbn.it/opacsbn/opac/iccu/scheda_authority.jsp?bid='..id..' '..(id or 'Itália')..']'
end

function p.iciaLink( id, link, parameter )
    --P1736's format regex: \d+ (e.g. 1)
    if not id:match( '^%d+$' ) then
        return false
    end
    return '[https://www.imj.org.il/artcenter/newsite/en/?artist='..id..' '..(id or 'ICIA (Israel)')..']'
end

function p.ieuLink( id, link, parameter )
    --P9070's format regex: [A-Z]\\[A-Z]\\[A-Za-z0-9]+ (e.g. K\Y\Kyiv)
    if not id:match( '^[A-Z]\\[A-Z]\\%w+$' ) then
        return false
    end
    return '[http://www.encyclopediaofukraine.com/display.asp?linkpath=pages\\'..id..' '..(id or 'Internet Encyclopedia of Ukraine')..']'
end

function p.itauLink( id, link, parameter )
    --P4399's format regex: (pessoa|grupo|obra|evento|instituicao|termo)\d+\/[a-z][\-a-z]* (e.g. 1743787)
    if not id:match( '^(pessoa|grupo|obra|evento|instituicao|termo)\d+\/[a-z][\-a-z]*$' ) then
        return false
    end
    return '[https://enciclopedia.itaucultural.org.br/'..id..' '..(id or 'Itáu cultural')..']'
end

function p.isniLink( id, link, parameter )
    id = p.validateIsni( id ) --e.g. 0000-0000-6653-4145
    if not id then
        return false
    end
    return '[https://isni.org/isni/'..id..' url]'
end

function p.ITISLink( id, link, parameter)
    --P815's format regex: [1-9]\d{1,6} numeric string, 1 to 7 digits
    if not id:match( '^%d%d?%d?%d?%d?%d?$' ) then
        return false
    end
    return p.generic( id, link, parameter ) .. ' [https://www.itis.gov/servlet/SingleRpt/SingleRpt?search_topic=TSN&search_value='..id..' '..id..']'
end

function p.jocondeLink( id, link, parameter )
    --P347's format regex: [\-0-9A-Za-z]{11} (e.g. 12345678901)
    local regex = '^'..string.rep('[%-0-9A-Za-z]', 11)..'$'
    if not id:match( regex ) then
        return false
    end
    return '[https://www.pop.culture.gouv.fr/notice/joconde/'..id..' '..(id or 'Joconde (França)')..']'
end

function p.kulturnavLink( id, link, parameter )
    --P1248's format regex: [0-9a-f]{8}\-[0-9a-f]{4}\-[0-9a-f]{4}\-[0-9a-f]{4}\-[0-9a-f]{12} (e.g. 12345678-1234-1234-1234-1234567890AB)
    if not id:match( '^%x%x%x%x%x%x%x%x%-%x%x%x%x%-%x%x%x%x%-%x%x%x%x%-%x%x%x%x%x%x%x%x%x%x%x%x$' ) then
        return false
    end
    return '[http://kulturnav.org/'..id..' '..(id or 'KulturNav (Noruega)')..']' --no https as of 9/2019
end

function p.lccnLink( id, link, parameter )
    local parts = p.splitLccn( id ) --e.g. n78039510
    if not parts then
        return false
    end
    local lccnType = parts[1] ~= 'sh' and 'names' or 'subjects'
    id = parts[1] .. parts[2] .. p.append( parts[3], '0', 6 )
    return '[https://id.loc.gov/authorities/'..lccnType..'/'..id..' '..(id or 'Estados Unidos')..']'
end

function p.lirLink( id, link, parameter )
    --P886's format regex: \d+ (e.g. 1)
    if not id:match( '^%d+$' ) then
        return false
    end
    return '[http://www.e-lir.ch/e-LIR___Lexicon.'..id..'.450.0.html '..(id or 'Lexicon Istoric Retic (Suíça)')..']' --no https as of 9/2019
end

function p.lnbLink( id, link, parameter )
    --P1368's format regex: \d{9} (e.g. 123456789)
    if not id:match( '^%d%d%d%d%d%d%d%d%d$' ) then
        return false
    end
    return '[https://kopkatalogs.lv/F?func=direct&local_base=lnc10&doc_number='..id..'&P_CON_LNG=ENG '..(id or 'Letónia')..']'
end

function p.leonoreLink( id, link, parameter )
    --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      LH//1/1 to        LH//2794/54 (legionaries)
       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( '^19800035/%d%d?%d?%d?/%d%d?%d?%d?%d?Bis$' ) and --IDs from ?
       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
    return '[http://www.culture.gouv.fr/public/mistral/leonore_fr?ACTION=CHERCHER&FIELD_1=COTE&VALUE_1='..id..' '..(id or 'Léonore (França)')..']' --no https as of 9/2019
end

function p.mbaLink( id, link, parameter )
    --P434's format regex: [0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12} (e.g. 12345678-1234-1234-1234-1234567890AB)
    if not id:match( '^%x%x%x%x%x%x%x%x%-%x%x%x%x%-%x%x%x%x%-%x%x%x%x%-%x%x%x%x%x%x%x%x%x%x%x%x$' ) then
        return false
    end
    local url = 'https://musicbrainz.org/artist/'..id
    if link then
        return '['..url..' '..link..']'--..cat
    else
        return '[[MBA (identificador)|MusicBrainz]] ['..url..' artist]'
    end
end

function p.mbareaLink( id, link, parameter )
    --P982's format regex: [0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12} (e.g. 12345678-1234-1234-1234-1234567890AB)
    if not id:match( '^%x%x%x%x%x%x%x%x%-%x%x%x%x%-%x%x%x%x%-%x%x%x%x%-%x%x%x%x%x%x%x%x%x%x%x%x$' ) then
        return false
    end
    local url = 'https://musicbrainz.org/area/'..id
    --if link then
        --return '['..url..' '..link..']'
    --else
        return '['..url..' area]'-- ..cat
    --end
end

function p.mbiLink( id, link, parameter )
    --P1330's format regex: [0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12} (e.g. 12345678-1234-1234-1234-1234567890AB)
    if not id:match( '^%x%x%x%x%x%x%x%x%-%x%x%x%x%-%x%x%x%x%-%x%x%x%x%-%x%x%x%x%x%x%x%x%x%x%x%x$' ) then
        return false
    end
    local url = 'https://musicbrainz.org/instrument/'..id
    if link then
        return '['..url..' '..link..']'--..cat
    else
        return '[[MBI (identificador)|MusicBrainz]] ['..url..' instrument]'
    end
end

function p.mblLink( id, link, parameter )
    --P966's format regex: [0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12} (e.g. 12345678-1234-1234-1234-1234567890AB)
    if not id:match( '^%x%x%x%x%x%x%x%x%-%x%x%x%x%-%x%x%x%x%-%x%x%x%x%-%x%x%x%x%x%x%x%x%x%x%x%x$' ) then
        return false
    end
    local url = 'https://musicbrainz.org/label/'..id
    if link then
        return '['..url..' '..link..']'
    else
        return '[[MBL (identificador)|MusicBrainz]] ['..url..' link]'--..cat
    end
end

function p.mbpLink( id, link, parameter )
    --P1004's format regex: [0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12} (e.g. 12345678-1234-1234-1234-1234567890AB)
    if not id:match( '^%x%x%x%x%x%x%x%x%-%x%x%x%x%-%x%x%x%x%-%x%x%x%x%-%x%x%x%x%x%x%x%x%x%x%x%x$' ) then
        return false
    end
    local url = 'https://musicbrainz.org/place/'..id
    if link then
        return '['..url..' '..link..']'
    else
        return '[[MBP (identificador)|MusicBrainz]] ['..url..' place]'--..cat
    end
end

function p.mbrgLink( id, link, parameter )
    --P436's format regex: [0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12} (e.g. 12345678-1234-1234-1234-1234567890AB)
    if not id:match( '^%x%x%x%x%x%x%x%x%-%x%x%x%x%-%x%x%x%x%-%x%x%x%x%-%x%x%x%x%x%x%x%x%x%x%x%x$' ) then
        return false
    end
    local url = 'https://musicbrainz.org/release-group/'..id
    if link then
        return '['..url..' '..link..']'
    else
        return '[[MBRG (identificador)|MusicBrainz]] ['..url..' release group]'--..cat
    end
end

function p.mbsLink( id, link, parameter )
    --P1407's format regex: [0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12} (e.g. 12345678-1234-1234-1234-1234567890AB)
    if not id:match( '^%x%x%x%x%x%x%x%x%-%x%x%x%x%-%x%x%x%x%-%x%x%x%x%-%x%x%x%x%x%x%x%x%x%x%x%x$' ) then
        return false
    end
    local url = 'https://musicbrainz.org/series/'..id
    if link then
        return '['..url..' '..link..']'
    else
        return '[[MBS (identificador)|MusicBrainz]] ['..url..' series]'--..cat
    end
end

function p.mbwLink( id, link, parameter )
    --P435's format regex: [0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12} (e.g. 12345678-1234-1234-1234-1234567890AB)
    if not id:match( '^%x%x%x%x%x%x%x%x%-%x%x%x%x%-%x%x%x%x%-%x%x%x%x%-%x%x%x%x%x%x%x%x%x%x%x%x$' ) then
        return false
    end

    local url = 'https://musicbrainz.org/work/'..id
    if link then
        return '['..url..' '..link..']'
    else
        return '[[MBW (identificador)|MusicBrainz]] ['..url..' work]'--..cat
    end
end

function p.mgpLink( id, link, parameter )
    --P549's format regex: \d{1,6} (e.g. 123456)
    if not id:match( '^%d%d?%d?%d?%d?%d?$' ) then
        return false
    end
    return '[https://genealogy.math.ndsu.nodak.edu/id.php?id='..id..' '..(id or 'Mathematics Genealogy Project')..']'
end

function p.naraLink( id, link, parameter )
    --P1225's format regex: ^([1-9]\d{0,8})$ (e.g. 123456789)
    if not id:match( '^[1-9]%d?%d?%d?%d?%d?%d?%d?%d?$' ) then
        return false
    end
    return '[https://catalog.archives.gov/id/'..id..' '..(id or 'National Archives (EUA)')..']'
end

function p.nclLink( id, link, parameter )
    --P1048's format regex: \d+ (e.g. 1081436)
    if not id:match( '^%d+$' ) then
        return false
    end
    return '[http://aleweb.ncl.edu.tw/F/?func=accref&acc_sequence='..id..'&CON_LNG=ENG '..(id or 'Taiwan')..']' --no https as of 9/2019
end

function p.ndlLink( id, link, parameter )
    --P349's format regex: 0?\d{8} (e.g. 012345678)
    if not id:match( '^0?%d%d%d%d%d%d%d%d$' ) then
        return false
    end
    return '[https://id.ndl.go.jp/auth/ndlna/'..id..' '..(id or 'Japão')..']'
end

function p.ngaLink( id, link, parameter )
    --P3563's format rgex: 11[0-6]-\d+(\.\d+)? (e.g. 114-7721.2)
    if not id:match('^11[0-6]%-%d+%.?%d*$') then
        return false
    end
    return '[https://wikidata-externalid-url.toolforge.org/?url=https%3A%2F%2Fmsi.nga.mil%2FqueryResults%3Fpublications%2Fngalol%2Flights-buoys%3Fvolume%3D%251%26featureNumber%3D%252%26includeRemovals%3Dfalse%26output%3Dhtml&exp=(%5Cd%7B3%7D)-(.*)&id='..id..' '..(id or 'NGA')..']'
end

function p.ngvLink( id, link, parameter )
    --P2041's format regex: \d+ (e.g. 12354)
    if not id:match( '^%d+$' ) then
        return false
    end
    return '[https://www.ngv.vic.gov.au/explore/collection/artist/'..id..'/ '..(id or 'Victoria')..']'
end

function p.nkcLink( id, link, parameter )
    --P691's format regex: [a-z]{2,4}[0-9]{2,14} (e.g. abcd12345678901234)
    if not id:match( '^[a-z][a-z][a-z]?[a-z]?%d%d%d?%d?%d?%d?%d?%d?%d?%d?%d?%d?%d?%d?$' ) then
        return false
    end
    return '[https://aleph.nkp.cz/F/?func=find-c&local_base=aut&ccl_term=ica='..id..'&CON_LNG=ENG '..(id or 'Chéquia')..']'
end

function p.nlaLink( id, link, parameter )
    --P409's format regex: [1-9][0-9]{0,11} (e.g. 123456789012)
    if not id:match( '^[1-9]%d?%d?%d?%d?%d?%d?%d?%d?%d?%d?%d?$' ) then
        return false
    end
    return '[https://nla.gov.au/anbd.aut-an'..id..' '..(id or 'Austrália')..']'
end

function p.bngLink( id, link, parameter )
    --P3348's format regex: [1-9]\d* (e.g. 1)
    if not id:match( '^[1-9]%d*$' ) then
        return false
    end
    return '[https://data.nlg.gr/resource/authority/record'..id..' '..(id or 'Grécia')..']'
end

function p.bniLink( id, link, parameter )
    --P949's format regex: \d{9} (e.g. 123456789)
    if not id:match( '^%d%d%d%d%d%d%d%d%d$' ) then
        return false
    end
    return '[http://uli.nli.org.il/F/?func=direct&doc_number='..id..'&local_base=nlx10'..' '..(id or 'Israel')..']'
end

function p.nlkLink( id, link, parameter )
    --P5034's format regex: KA.(19|20).{7} (e.g. KAC201501465)
    if not id:match( '^KA.19.......$' ) and
       not id:match( '^KA.20.......$' ) then
        return false
    end
    return '[https://librarian.nl.go.kr/LI/contents/L20101000000.do?id='..id..' '..(id or 'Coreia')..']'
end

function p.nlpLink( id, link, parameter )
    --P1695's format regex: 9810[0-9]\d* or A[0-9]{7}[0-9X] (e.g. 9810123456789012345 or A10414836)
    if not id:match( '^9810%d+$' ) and
       not id:match( '^A%d%d%d%d%d%d%d[%dX]$' ) then
        return false
    end
    return '[https://tools.wmflabs.org/wikidata-externalid-url?p=1695&id='..id..' '..(id or 'Polónia')..']'
end

function p.nlrLink( id, link, parameter )
    --P1003's format regex: \d{9} (e.g. 123456789)
    if not id:match( '^%d%d%d%d%d%d%d%d%d$' ) then
        return false
    end
    return '[http://aleph.bibnat.ro:8991/F/?func=direct&local_base=NLR10&doc_number='..id..' '..(id or 'Romênia')..']'
end

function p.nskLink( id, link, parameter )
    --P1375's format regex: \d{9} (e.g. 123456789)
    if not id:match( '^%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 or 'Croácia')..']' --no https as of 9/2019
end

function p.ntaLink( id, link, parameter )
    --P1006's format regex: \d{8}[\dX] (e.g. 12345678X)
    if not id:match( '^%d%d%d%d%d%d%d%d[%dX]$' ) then
        return false
    end
    return '[http://data.bibliotheken.nl/id/thes/p'..id..' '..(id or 'Países Baixos')..']'
end

function p.orcidLink( id, link, parameter )
    id = p.validateIsni( id ) --e.g. 0000-0002-7398-5483
    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 '[https://orcid.org/'..id..' '..(id or 'ORCID')..']'
end

function p.picLink( id, link, parameter )
    --P2750's format regex: [1-9]\d* (e.g. 1)
    if not id:match( '^[1-9]%d*$' ) then
        return false
    end
    return '[https://pic.nypl.org/constituents/'..id..' '..(id or 'Photographers\' Identities')..']'
end

function p.plwabnLink( id, link, parameter )
    --P7293's format regex: 981[0-9]{8}05606 (e.g. 9810696457305606)
    if not id:match( '^981%d%d%d%d%d%d%d%d05606*$' ) then
        return false
    end
    return '[http://mak.bn.org.pl/cgi-bin/KHW/makwww.exe?BM=1&NU=1&IM=4&WI='..id..' '..id..']'
end

function p.publonsLink( id, link, parameter )
    --P3829's format regex: \d+ (e.g. 654601)
    if not id:match( '^%d+$' ) then
        return false
    end
    return '[https://publons.com/author/'..id..'/ '..(id or 'Publons (investigadores)')..']'
end

function p.PWNLink( id, link, parameter )
    --P7305's format regex: [1-9]\d+ (e.g. 3886065)
    if not id:match( '^[1-9]%d+$' ) then
        return false
    end
    return '[https://encyklopedia.pwn.pl/haslo/;'..id..'.html '..(id or 'Online PWN')..']'
end

function p.ridLink( id, link, parameter )
    --P1053's format regex: [A-Z]{1,3}-\d{4}-(19|20)\d\d (e.g. AAS-5150-2020)
    if not id:match( '^[A-Z][A-Z]?[A-Z]?%-%d%d%d%d%-19%d%d$' ) and
       not id:match( '^[A-Z][A-Z]?[A-Z]?%-%d%d%d%d%-20%d%d$' ) then
        return false
    end
    return '[https://www.researcherid.com/rid/'..id..' '..(id or 'ResearcherID')..']'
end

function p.rismLink( id, link, parameter )
    --P5504's format regex: (pe|ks)?\[1-9]d* (e.g. pe30006410)
    if not id:match( '^pe[1-9]%d*$' ) and --99% start with 'pe'
       not id:match( '^ks[1-9]%d*$' ) and
       not id:match( '^[1-9]%d*$' ) then
        return false
    end
    return '[https://opac.rism.info/search?id='..id..' '..(id or 'RISM (França)')..']'
end

function p.reroLink( id, link, parameter )
    --P3065's format regex: 0[1-2]-[A-Z0-9]{1,10} (e.g. 02-A012345678)
    if not id:match( '^0[1-2]%-[A-Z%d][A-Z%d]?[A-Z%d]?[A-Z%d]?[A-Z%d]?[A-Z%d]?[A-Z%d]?[A-Z%d]?[A-Z%d]?[A-Z%d]?$' ) then
        return false
    end
    return '[http://data.rero.ch/'..id..' '..(id or 'RERO (Suíça')..']'
end

function p.rkdartistsLink( id, link, parameter )
    --P650's format regex: [1-9]\d{0,5} (e.g. 123456)
    if not id:match( '^[1-9]%d?%d?%d?%d?%d?$' ) then
        return false
    end
    return '[https://rkd.nl/en/explore/artists/'..id..' '..(id or 'RKD Artists (Países Baixos)')..']'
end

function p.rkdidLink( id, link, parameter )
    --P350's format regex: [1-9]\d{0,5} (e.g. 123456)
    if not id:match( '^[1-9]%d?%d?%d?%d?%d?$' ) then
        return false
    end
    return '[https://rkd.nl/nl/explore/images/'..id..' '..(id or 'RKD ID (Países Baixos)')..']'
end

function p.berLink( id, link, parameter )
    --P947's format regex: \d{1,9} (e.g. 123456789)
    if not id:match( '^%d%d?%d?%d?%d?%d?%d?%d?%d?$' ) then
        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 '..(id or 'Rússia')..']' --no https as of 9/2019
end

function p.scopusLink( id, link, parameter )
    --P1153's format regex: [1-9]\d{9,10} (e.g. 35247902700)
    if not id:match( '^[1-9]%d%d%d%d%d%d%d%d%d%d?$' ) then
        return false
    end
    return '[https://www.scopus.com/authid/detail.uri?authorId='..id..' '..(id or 'autor Scopus')..']'
end

function p.selibrLink( id, link, parameter )
    --P906's format regex: [1-9]\d{4,5} (e.g. 123456)
    if not id:match( '^[1-9]%d%d%d%d%d?$' ) then
        return false
    end
    return '[https://libris.kb.se/auth/'..id..' '..(id or 'Suécia')..']'
end

function p.sikartLink( id, link, parameter )
    --P781's format regex: \d{7,9} (e.g. 123456789)
    if not id:match( '^%d%d%d%d%d%d%d%d?%d?$' ) then
        return false
    end
    return '[http://www.sikart.ch/KuenstlerInnen.aspx?id='..id..'&lng=en '..(id or 'SIKART (Suíça)')..']' --no https as of 9/2019
end

function p.snacLink( id, link, parameter )
    --P3430's format regex: \d*[A-Za-z][0-9A-Za-z]* (e.g. A)
    if not id:match( '^%d*[A-Za-z][0-9A-Za-z]*$' ) then
        return false
    end
    return '[https://snaccooperative.org/ark:/99166/'..id..' '..(id or 'Social Networks and Archival Context')..']'
end

function p.sudocLink( id, link, parameter )
    --P269's format regex: (\d{8}[\dX]|) (e.g. 026927608)
    if not id:match( '^%d%d%d%d%d%d%d%d[%dxX]$' ) then --legacy: allow lowercase 'x'
        return false
    end
    return '[https://www.idref.fr/'..id..' '..(id or 'SUDOC (França)')..']'
end

function p.ta98Link( id, link, parameter )
    --P1323's format regex: A\d{2}\.\d\.\d{2}\.\d{3}[FM]? (e.g. A12.3.45.678)
    if not id:match( '^A%d%d%.%d%.%d%d%.%d%d%d[FM]?$' ) then
        return false
    end
    local longurl = '[http://tools.wmflabs.org/wikidata-externalid-url/?p=1323&url_prefix=https:%2F%2Fwww.unifr.ch%2Fifaa%2FPublic%2FEntryPage%2FTA98%20Tree%2FEntity%20TA98%20EN%2F&url_suffix=%20Entity%20TA98%20EN.htm&id='
    return longurl..id..' '..(id or 'Terminologia Anatomica')..']'
end

function p.tdviaLink( id, link, parameter )
    --P7314's format regex: [a-z/-]+] (e.g. barkan-omer-lutfi)
    if not id:match( '^[a-z/-]+$' ) then
        return false
    end
    return '[https://islamansiklopedisi.org.tr/'..id..' '..(id or 'Enciclopédia do Islão')..']'
end

function p.tepapaLink( id, link, parameter )
    --P3544's format regex: \d+ (e.g. 1)
    if not id:match( '^%d+$' ) then
        return false
    end
    return '[https://collections.tepapa.govt.nz/agent/'..id..' '..(id or 'Te Papa (Nova Zelândia)')..']'
end

function p.tlsLink( id, link, parameter )
    id = id:gsub(' +', '_')
    --P1362's format regex: \p{Lu}[\p{L}\d_',\.\-\(\)\*/–]{3,69} (e.g. Abcd)
    local class = "[%a%d_',%.%-%(%)%*/–]"
    local idlen = #id
    if idlen < 4 or idlen > 70 then
        return false
    end
    local regex = '^%u'..string.rep(class, idlen - 1)..'$'
    if not mw.ustring.match( id, regex ) then
        return false
    end
    return '[http://tls.theaterwissenschaft.ch/wiki/'..id..' '..(id or 'Theaterlexikon (Suíça)')..']' --no https as of 9/2019
end

function p.troveLink( id, link, parameter )
    --P1315's format regex: [1-9]\d{5,7} (e.g. 12345678)
    if not id:match( '^[1-9]%d%d%d%d%d%d?%d?$' ) then
        return false
    end
    return '[https://trove.nla.gov.au/people/'..id..' '..(id or 'Trove (Austrália)')..']'
end

function p.ukparlLink( id, link, parameter )
    --P6213's format regex: [a-zA-Z\d]{8} (e.g. AQUupyiR)
    if not id:match( '^[a-zA-Z%d][a-zA-Z%d][a-zA-Z%d][a-zA-Z%d][a-zA-Z%d][a-zA-Z%d][a-zA-Z%d][a-zA-Z%d]$' ) then
        return false
    end
    return '[https://id.parliament.uk/'..id..' '..(id or 'Parlamento do RU')..']'
end

function p.ulanLink( id, link, parameter )
    --P245's format regex: 500\d{6} (e.g. 500123456)
    if not id:match( '^500%d%d%d%d%d%d$' ) then
        return false
    end
    return '[https://www.getty.edu/vow/ULANFullDisplay?find=&role=&nation=&subjectid='..id..' '..(id or 'Nomes de Artistas (Getty)')..']'
end

function p.uscgLink( id, link, parameter )
    --P3723's format regex: [1-7]-\d{1,5}(.[1-9])? (e.g. 6-0695)
    if not id:match( '^[1-7]%-%d%d?%d?%d?%d?$' ) and
       not id:match( '^[1-7]%-%d%d?%d?%d?%d?%.%d*[1-9]$' ) then
        return false
    end
    return id
end

function p.uscongressLink( id, link, parameter )
    --P1157's format regex: [A-Z]00[01]\d{3} (e.g. A000123)
    if not id:match( '^[A-Z]00[01]%d%d%d$' ) then
        return false
    end
    return '[http://bioguide.congress.gov/scripts/biodisplay.pl?index='..id..' '..(id or 'Congresso dos EUA')..']' --no https as of 9/2019
end

function p.vcbaLink( id, link, parameter )
    --P8034's format regex: \d{3}\/[1-9]\d{0,5} (e.g. 494/9793)
    if not id:match( '^%d%d%d\/[1-9]%d?%d?%d?%d?%d?$' ) then
        return false
    end
    id = id:gsub('\/', '_')
    return '[https://opac.vatlib.it/auth/detail/'..id..' '..(id or 'Vaticano')..']'
end

function p.woeidLink( id, link, parameter )
    --P1281's format regex: [1-9][0-9]{0,9} (e.g. 2459115)
    if not id:match( '^[1-9][0-9]%d?%d?%d?%d?%d?%d?%d?%d?%d?$' ) then
        return false
    end
    id = id:gsub('\/', '_')
    return '[https://www.flickr.com/places/info/'..id..' '..id..']'
end

function p.tgnLink( id, link, parameter )
    --P1667's format regex: \d{3}\/[1-9]\d{0,5} (e.g. 7011179)
    if not id:match( '^[1-9][0-9]%d?%d?%d?%d?%d?%d?$' ) then
        return false
    end
    id = id:gsub('\/', '_')
    return '[https://www.getty.edu/vow/TGNFullDisplay?find=&place=&nation=&english=Y&subjectid='..id..' '..id..']'
end

function p.viafLink( id, link, parameter )
    --P214's format regex: [1-9]\d(\d{0,7}|\d{17,20}) (e.g. 123456789, 1234567890123456789012)
    if not id:match( '^[1-9]%d%d?%d?%d?%d?%d?%d?%d?$' ) and
       not id:match( '^[1-9]%d%d%d%d%d%d%d%d%d%d%d%d%d%d%d%d%d%d%d?%d?%d?$' ) then
        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..' '..(id or 'VIAF')..']'
end

function p.worldcatidLink( id, link, parameter )
    --P7859's format regex: viaf-\d+|lccn-n[a-z]?[0-9\-]+|n[pc]-.+ (e.g. viaf-100181709, lccn-n78-95332, np-verbeck,%20william$1861)
    if not id:match( '^viaf%-%d+$' ) and
       not id:match( '^lccn%-n[a-z]?[0-9%-]+$' ) and
       not id:match( '^n[pc]%-.+$' ) then
        return false
    end
    return '[https://www.worldcat.org/identities/'..mw.uri.encode(id, 'PATH')..'/ '..(id or 'WorldCat')..']'
end

--[[=========================== Helper functions =============================]]

function p.append(str, c, length)
    while str:len() < length do
        str = c..str
    end
    return str
end

--Returns the ISNI check digit isni must be a string where the 15 first elements are digits, e.g. 0000000066534145
function p.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
function p.validateIsni( id )
    --P213 (ISNI) format regex: [0-9]{4} [0-9]{4} [0-9]{4} [0-9]{3}[0-9X] (e.g. 0000-0000-6653-4145)
    --P496 (ORCID) format regex: 0000-000(1-[5-9]|2-[0-9]|3-[0-4])\d{3}-\d{3}[\dX] (e.g. 0000-0002-7398-5483)
    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 p.getIsniCheckDigit( id ) ~= string.char( id:byte( 16 ) ) then
        return false
    end
    return id
end

function p.splitLccn( id )
    --P244's format regex: (n|nb|nr|no|ns|sh)([4-9][0-9]|00|20[0-1][0-9])[0-9]{6} (e.g. n78039510)
    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

function p.commonscat ( id, link, parameter )
    -- representação especial do link para as categorias do Commons, para manter o formato de link interwiki
    local idlink = mw.ustring.gsub( id, ' ', '_' )
    link = mw.ustring.gsub( link, '$1', idlink )
    return '<span class="plainlinks">[' .. link .. ' ' .. id .. ']</span>'
end

function p.sisterprojects ( id, link, parameter )
    -- links interprojeto
    local prefix = {
        -- Exemplo: -- enwiki = 'w:en',
        commonswiki = 'c',
        ptwikivoyage = 'voy',
        ptwiktionary = 'wikt',
        ptwikibooks = 'b',
        ptwikinews = 'n',
        ptwikiversity = 'v',
        ptwikiquote = 'q',
        ptwikisource = 's',
        mediawikiwiki = 'mw',
        metawiki = 'm',
        specieswiki = 'species',
    }
    if prefix[ parameter ] then
        return '[['..prefix[ parameter ]..':'..id..'|'..id..']]'
    end
    return false
end

function p.getIdsFromSitelinks( itemId, property )
    local ids = {}
    local siteLink = itemId and mw.wikibase.getSitelink( itemId, property )
    if siteLink then
        table.insert( ids, siteLink )
    end
    return ids
end

function p.getIdsFromWikidata( itemId, property )
    local ids = {}
    local declaraciones = mw.wikibase.getBestStatements(itemId, property)

    for _, statement in pairs( declaraciones) do
        if statement.mainsnak.datavalue then
            table.insert( ids, statement.mainsnak.datavalue.value )
        end
    end
    return ids
end

function p.getLink( property, val, mask )
    local link = ''
    if mw.ustring.find( val, '//' ) then
        link = val
    else
        if type(property) == 'number' then
            local entityObject = mw.wikibase.getEntityObject('P'..property)
            local dataType = entityObject.datatype
            if dataType == 'external-id' then
                local allStatements = entityObject:getAllStatements('P1630')
                if allStatements then
                    for pos = 1, #allStatements, 1 do
                        local q = allStatements[pos].qualifiers
                        -- causa erro se não exister rótulo em pt
                        if q and q.P407 and q.P407[1].datavalue.value.id == 'Q5146' then
                            link = allStatements[pos].mainsnak.datavalue.value
                        end
                    end
                end
                if link == '' then
                    local formatterURL = entityObject:getBestStatements('P1630')[1]
                    if formatterURL then
                        link = formatterURL.mainsnak.datavalue.value
                    else
                        local formatterURL = entityObject:getBestStatements('P3303')[1]
                        if formatterURL then link = formatterURL.mainsnak.datavalue.value end
                    end
                end
            elseif dataType == 'url' then
                local subjectItem = entityObject:getBestStatements('P1629')[1]
                if subjectItem then
                    local officialWebsite = mw.wikibase.getBestStatements(subjectItem.mainsnak.datavalue.value.id, 'P856')[1]
                    if officialWebsite then
                        link = officialWebsite.mainsnak.datavalue.value
                    end
                end
            elseif dataType == 'string' then
                local formatterURL = entityObject:getBestStatements('P1630')[1]
                if formatterURL then
                    link = formatterURL.mainsnak.datavalue.value
                else
                    local formatterURL = entityObject:getBestStatements('P3303')[1]
                    if formatterURL then
                        link = formatterURL.mainsnak.datavalue.value
                    else
                        local subjectItem = entityObject:getBestStatements('P1629')[1]
                        if subjectItem then
                            local officialWebsite = mw.wikibase.getBestStatements(subjectItem.mainsnak.datavalue.value.id,'P856')[1]
                            if officialWebsite then
                                link = officialWebsite.mainsnak.datavalue.value
                            end
                        end
                    end
                end
            end
        elseif type(property) == 'string' then
            link = property
        end
    end
    link = mw.ustring.gsub(link, '^[Hh][Tt][Tt][Pp]([Ss]?)&#58;//', 'http%1://') -- fix wikidata URL
    if type(mask) == 'function' then
        return mask( val, link, property )
    end
    link = mw.ustring.gsub(link, '$1', mw.ustring.gsub( mw.ustring.gsub( val, '%%', '%%%%' ), ' ', '%%%%20' ) or val )
    if mw.ustring.find( link, '//' ) then
        if type(mask) == 'string' then
            link = mw.ustring.gsub( link, '%[', '%%5B' )
            link = mw.ustring.gsub( link, '%]', '%%5D' )
            if mask == 'y' then
                return '['..link..' ID]'
            elseif mask == 'n' then
                return '['..link..' '..val..']'
            end
            return '['..link..' '..mask..']'
        end
    elseif link == '' then
        return val
    else
        return '[['..link..'|'..val..']]'
    end
end

function p.getCommonsValue ( itemId )
    local commonslink = ''
    local categories = ''

    local property = p.getIdsFromWikidata( itemId, 'P373' )
    if property and property[1] then
        property = property[1]
        commonslink = commonslink .. p.getLink( 373, property, p.commonscat )
    else
        property = ''
    end

    local sitelink = p.getIdsFromSitelinks( itemId, 'commonswiki' )
    if sitelink and sitelink[1] then
        sitelink = sitelink[1]
        if sitelink ~= 'Category:' .. property then
            if commonslink == '' then
                commonslink = commonslink .. p.sisterprojects( sitelink, nil, 'commonswiki' )
            end
        end
    else
        sitelink = ''
    end

    --if property and sitelink then
    --    if sitelink ~= 'Category:' .. property then
            -- categories = categories .. '[[Categoria:!Controle de autoridade com link diferentes do Commons]]'
    --    end
    --elseif sitelink then -- not property
        -- categories = categories .. '[[Categoria:!Controle de autoridade sem Commonscat]]'
    --elseif property then -- not sitelink
        -- categories = categories .. '[[Categoria:!Controle de autoridade sem Commons]]'
    --else -- not property and not sitelink
        -- categories = categories .. '[[Categoria:!Controle de autoridade sem nenhum link do Commons]]'
    --end
    if commonslink ~= '' then
        return { commonslink .. categories }
    end
    return {}
end

local conf = {}
--In this order: name of the parameter, label, propertyId in Wikidata, formatting function, category id
-- -- name of the parameter: unique name
-- -- label: internal link in wiki format, don't forget to translate local lang
-- -- propertyId in Wikidata: number without 'P' suffix
-- -- formatting function: one of these four options
-- -- -- local function (like 'generic')
-- -- -- string 'y' (yes), to show a default identifier 'ID'
-- -- -- string 'n' (no), to show the real identifier
-- -- -- any other string, to show this string as identifier ('id', 'url', 'link', ...)
-- -- category id: one of these tree options
-- -- -- number 0, to not add category
-- -- -- number 1, to add a category based on the name of the parameter
-- -- -- any string, to add a category based on this string
conf.databases = {}
conf.databases[1] =    {}
conf.databases[1].name = '[[Controle de autoridade]]'
conf.databases[1].list = {
    {
    title = 'Projetos Wikimedia',
    group = {
    { 'Wikidata', '[[Ficheiro:Wikidata-logo.svg|20px|link=Wikidata|alt=Wd|Wikidata]] Dados', 'Wikidata:$1', 'n', 0 },
    { 'Commons', '[[Ficheiro:Commons-logo.svg|15px|link=Wikimedia Commons|alt=Commonscat|Commonscat]] Multimedia', p.getCommonsValue, 'n', 0 },
    { 'Wikivoyage', '[[Ficheiro:Wikivoyage-logo.svg|15px|link=Wikiviagens|alt=Wikivoyage|Wikivoyage]] Guia turística', 'ptwikivoyage', p.sisterprojects, 0 },
    { 'Wiktionary', '[[Ficheiro:Wiktionary-logo.svg|15px|link=Wikcionário|alt=Wiktionary|Wiktionary]] Dicionário', 'ptswiktionary', p.sisterprojects, 0 },
    { 'Wikibooks', '[[Ficheiro:Wikibooks-logo.svg|15px|link=Wikilivros|alt=Wikibooks|Wikibooks]] Livros e manuais', 'ptswikibooks', p.sisterprojects, 0 },
    { 'Wikinews', '[[Ficheiro:Wikinews-logo.svg|20px|link=Wikinotícias|alt=Wikinews|Wikinews]] Notícias', 'ptwikinews', p.sisterprojects, 0 },
    { 'Wikiversity', '[[Ficheiro:Wikiversity-logo.svg|15px|link=Wikiversidade|alt=Wikiversity|Wikiversity]] Recursos didácticos', 'ptwikiversity', p.sisterprojects, 0 },
    { 'Wikiquote', '[[Ficheiro:Wikiquote-logo.svg|15px|link=Wikiquote|alt=Wikiquote|Wikiquote]] Citações celébres', 'ptwikiquote', p.sisterprojects, 0 },
    { 'Wikisource', '[[Ficheiro:Wikisource-logo.svg|15px|link=Wikisource|alt=Wikisource|Wikisource]] Textos', 'ptwikisource', p.sisterprojects, 0 },
    { 'MediaWiki', '[[Ficheiro:MediaWiki-2020-icon.svg|20px|link=MediaWiki|alt=MediaWiki|MediaWiki]] MediaWiki', 'mediawikiwiki', p.sisterprojects, 0 },
    { 'Meta-Wiki', '[[Ficheiro:Wikimedia Community Logo.svg|15px|link=Wikimedia Meta-Wiki|alt=Meta-Wiki|Meta-Wiki]] Coordenação', 'metawiki', p.sisterprojects, 0 },
    { 'Wikispecies', '[[Ficheiro:Wikispecies-logo.svg|15px|link=Wikispecies|alt=Wikispecies|Wikispecies]] Espécies', 'specieswiki', p.sisterprojects, 0 },
    },
    },
    {
    title = 'Identificadores',
    group = {
    { 'DBNL', '[[Biblioteca Digital para a Literatura Holandesa|DBNL]]', 723, 'n', 1 },
    { 'NUKAT', '[[:d:Q11789729|NUKAT]]', 1207, 'n', 1 },
    { 'RSL', '[[Biblioteca do Estado Russo|RSL]]', 947, 'n', 1 },

    { 'DBLP', '[[DBLP (ciência da computação)|DBLP]]', 2456, p.dblpLink, 0},
    { 'MGP', '[[Projeto de Genealogia Matemática|Mathematics Genealogy Project]]', 549, p.mgpLink, 0},
    { 'BNG', '[[Biblioteca Nacional da Grécia|BNG]]', 966, p.bngLink, 0},
    { 'NLK', '[[Biblioteca Nacional da Coreia (identificador)|BNC]]', 966, p.nlkLink, 0},
    { 'NSK', '[[:d:Q55753821|NSK]]', 1375, p.nskLink, 0},
    { 'NTA', '[[Biblioteca Real dos Países Baixos (identificador)|NTA]]', 1006, p.ntaLink, 0},
    { 'PLWABN', '[[Biblioteca Nacional da Polónia (identificador)|PLWABN]]', 7293, p.plwabnLink, 0},
    --{ 'WORLDCATID', '[[WorldCat Identities (identificador)|WCI]]', 7859, p.worldcatidLink, 0}, --ver se está duplicado

-- lusofonia
    { 'ABL', '[[Academia Brasileira de Letras|ABL]]', 5527, 'n', 0 },
    { 'ANVISA', '[[Agência Nacional de Vigilância Sanitária|ANVISA]]', 4393, 'n', 0 },
    { 'Arca', '[[:d:Q106190123|Arca]]', 9412, 'n', 0 },
    { 'Assembleia da República', '[[Assembleia da República]]', 6199, 'n', 0 },
    { 'BDAP', '[[:d:Q104775938|BDAP]]', 9063, 'n', 0 },
    { 'BLBNB', '[[Biblioteca Nacional (Brasil)|BNB]]', 4619, p.blbnbLink, 0 },
    { 'BND', '[[Biblioteca Nacional Digital (identificador)|BND]]', 5691, p.bndLink, 0 },
    { 'BDCN', '[[BDCN]]', 9464, 'n', 0 },
    { 'Brapci', '[[Brapci]]', 9452, 'n', 0 },
    { 'Brasiliana Iconográfica', '[[Brasiliana Iconográfica]]', 6004, 'n', 0 },
    { 'CamaraDeputados', '[[Câmara dos Deputados do Brasil|Câmara dos Deputados]]', 7480, 'n', 0 },
    { 'COBNP', '[[Biblioteca Nacional (Portugal)|COBNP]]', 6373, 'n', 'PTBNP' },
    { 'Ciência Vitae', '[[:d:Q84072847|Ciência Vitae]]', 7893, 'n', 0 },
    { 'CNPJ', '[[Cadastro Nacional da Pessoa Jurídica|CNPJ]]', 6204, 'n', 0 },
    { 'CPC-PR', '[[:d:Q105523391|CPC-PR]]', 9257, 'n', 0 },
    { 'CPP-2010', 'CPP-2010', 1052, 'n', 0 },
    { 'CPDOC', '[[Centro de Pesquisa e Documentação de História Contemporânea do Brasil|CPDOC]]', 4660, 'n', 0 },
    { 'DHP', '[[:d:Q100594076|DHP]]', 8749, 'n', 0 },
    { 'E-Mec', '[[e-MEC]]', 5148, 'n', 0 },
    { 'Enciclopédia Açoriana', '[[Enciclopédia Açoriana]]', 1385, 'n', 0 },
    { 'EPIB', '[[Enciclopédia dos Povos Indígenas no Brasil|EPIB]]', 9064, 'n', 0 },
    { 'LexML Brasil', '[[LexML Brasil]]', 9119, 'n', 0 },
    { 'FAPESP instituição', '[[Fundação de Amparo à Pesquisa do Estado de São Paulo|FAPESP]]', 4597, 'n', 0 },
    { 'FAPESP pesquisador', '[[Fundação de Amparo à Pesquisa do Estado de São Paulo|FAPESP]]', 4598, 'n', 0 },
    { 'GruCultura', 'GruCultura', 6691, 'n', 0 },
    { 'Fortalezas.org', '[[:d:Q106206120|Fortalezas.org]]', 9369, 'n', 0 },
    { 'HPIP', '[[Património de Influência Portuguesa (base de dados)|HPIP]]', 5094, 'n', 0 },
    { 'IFVPF', '[[:d:Q106196471|IFVPF]]', 9421, 'n', 0 },
    { 'IGC Contínuo', '[[Índice Geral de Cursos|IGC]]', 6069, 'n', 0 },
    { 'IGC Faixa', '[[Índice Geral de Cursos|IGC]]', 6095, 'n', 0 },
    { 'INEPAC', '[[Instituto Estadual do Patrimônio Cultural|INEPAC]]', 5549, 'n', 0 },
    { 'IPHAN', '[[Instituto do Patrimônio Histórico e Artístico Nacional|IPHAN]]', 5500, 'n', 0 },
    { 'IPHAE', '[[Instituto do Patrimônio Histórico e Artístico do Estado do Rio Grande do Sul|IPHAE]]', 9142, 'n', 0 },
    { 'IPBB', '[[:d:Q55362823|Patrimônio Belga no Brasil]]', 5528, 'n', 0 },
    { 'Inventário dos Monumentos RJ', '[[:d:Q67153310|Inventário dos Monumentos RJ]]', 6542, 'n', 0 },
    { 'ISA', '[[Instituto Socioambiental|ISA]]', 6468, 'n', 0 },
    { 'ITAÚ Cultural', '[[Itaú Cultural (identificador)|Itaú Cultural]]', 4399, p.itauLink, 1 },
    { 'Jornal do Vôlei', '[[:d:Q108070370|Jornal do Vôlei]]', 9841, 'n', 0 },
    { 'Libreflix', '[[Libreflix]]', 6614, 'n', 0 },
    { 'Littera', '[[Universidade Nova de Lisboa|Littera]]', 6130, 'n', 0 },
    { 'MAI', '[[Museu de Arqueologia de Itaipu|MAI]]', 6822, 'n', 0 },
    { 'MARGS', '[[Museu de Arte do Rio Grande do Sul Ado Malagoli|MARGS]]', 6667, 'n', 0 },
    { 'Museu da Pessoa', '[[Museu da Pessoa]]', 10023, 'n', 0 },
    { 'Museu de Memes', '[[Museu de Memes]]', 7946, 'n', 0 },
    { 'Memória Globo', '[[Memória Globo]]', 4400, 'n', 0 },
    { 'Memórias da Ditadura', '[[Ditadura militar brasileira|Memórias da Ditadura]]', 6673, 'n', 0 },
    { 'Desaparecidos Políticos', '[[Ditadura militar brasileira|Desaparecidos Políticos]]', 6674, 'n', 0 },
    { 'CEMDP', '[[Ditadura militar brasileira|CEMDP]]', 6692, 'n', 0 },
    { 'CNV', '[[Comissão Nacional da Verdade]]', 6690, 'n', 0 },
    { 'MHN', '[[Museu Histórico Nacional|MHN]]', 6631, 'n', 0 },
    { 'Mube', '[[Museu Brasileiro da Escultura e Ecologia|MuBE]]', 4721, 'n', 0 },
    { 'Museusbr', '[[:d:Q69561563|Museusbr]]', 4401, 'n', 0 },
    { 'Museu Nacional UFRJ', '[[Museu Nacional (Rio de Janeiro)|Museu Nacional da UFRJ]]', 5954, 'n', 0 },
    { 'Placar UOL Eleições', '[[Universo Online|Placar UOL Eleições]]', 6672, 'n', 0 },
    { 'PLI', '[[:d:Q50338586|PLI]]', 4423, 'n', 0 },
    { 'PDHCHBBNA', '[[:d:Q98960406|PDHCHBBNA]]', 8611, 'n', 0 },
    { 'Porcelana Brasil', '[[:d:Porcelana Brasil|Porcelana Brasil]]', 9354, 'n', 0 },
    { 'Portal da Literatura', '[[:d:Q104775904|Portal da Literatura]]', 9141, 'n', 0 },
    { 'Projeto Monumentos de São Paulo', 'Projeto Monumentos de São Paulo', 4360, 'n', 0 },
    { 'Projeto Vercial', '[[:d:Q104439735|Projeto Vercial]]', 9053, 'n', 0 },
    { 'Qualis', '[[Qualis]]', 9683, 'n', 0 },
    { 'QEdu', 'QEdu', 4344, 'n', 0 },
    { 'Registo de Transparência da UE', '[[:d:Q15851383|Registo de Transparência da UE]]', 2657, 'n', 0 },
    { 'ReP', '[[:d:Q107004545|ReP]]', 9612, 'n', 0 },
    { 'São Paulo', 'São Paulo', 5950, 'n', 0 },
    { 'SIPA', '[[SIPA (base de dados)|SIPA]]', 1700, 'n', 0 },
    { 'SNBP', '[[Sistema Nacional de Bibliotecas Públicas|SNBP]]', 6937, 'n', 0 },
    { 'SNISB', '[[:d:Q62007231|SNISB]]', 6630, 'n', 0 },
    { 'TOPCMB', '[[:d:Q97732428|TOPCMB]]', 8514, 'n', 0 },
    { 'TSE', '[[Tribunal Superior Eleitoral|TSE]]', 4251, 'n', 0 },
    { 'Terras Indígenas no Brasil', '[[:d:Q106490200|Terras Indígenas no Brasil]]', 9442, 'n', 0 },
    { 'UEB', '[[Justiça Eleitoral do Brasil|UEB]]', 6555, 'n', 0 },
-- outros
    { 'ACM-DL', '[[ACM DL (identificador)|ACM DL]]', 864, p.acmlink, 0 },
    { 'AELG', '[[Associação de Escritoras e Escritores em Língua Galega|AELG]]', 3436, 'n', 0 },
    { 'AGORHA', '[[:d:Q21994367|AGORHA]]', 2342, 'n', 0 },
    { 'AcademiaNet', '[[:de:AcademiaNet|AcademiaNet]]', 2080, 'n', 0 },
    { 'ABok', '[[The Ashley Book of Knots|ABok]]', 1806, 'n', 0 },
    { 'ASN', '[[Aviation Safety Network|ASN]]', 1755, 'n', 0 },
    { 'BALaT', '[[:fr:BALaT|BALaT]]', 3293, 'n', 0 },
    { 'BAV', '[[BAV]]', 1017, 'n', 1 },
    { 'BBC', '[[British Broadcasting Corporation|BBC]]', 827, 'n', 0 },
    { 'BD Gest autor', '[[:fr:BD Gest|BD Gest]]', 5491, 'n', 0 },
    { 'BD Gest série', '[[:fr:BD Gest|BD Gest]]', 8619, 'n', 0 },
    { 'BIBSYS', '[[Bibsys|BIBSYS]]', 1015, p.bibsysLink, 1 },
    { 'Bavarikon', '[[:de:Bavarikon|Bavarikon]]', 4005, 'n', 0 },
    { 'Belvedere', '[[Österreichische Galerie Belvedere|Belvedere]]', 3421, 'n', 0 },
    { 'Bitraga autor', '[[:gl:Biblioteca da Tradución Galega|Bitraga]]', 6173, 'n', 0 },
    { 'Bitraga obra', '[[:gl:Biblioteca da Tradución Galega|Bitraga]]', 6175, 'n', 0 },
    { 'EliseuVisconti', '[[Projeto Eliseu Visconti]]', 6506, 'n', 0 },
    { 'ISBN', '[[International Standard Book Number|ISBN]]', 212, 'n', 1 },
    { 'Joconde', '[[:fr:Joconde (catalogue)|Joconde]]', 347, p.jocondeLink, 0 },
    { 'BNI', '[[Biblioteca Nacional de Israel|NLI]]', 949, p.bniLink, 'NLI' },
    { 'OCLC', '[[Online Computer Library Center|OCLC]]', 243, 'n', 1 },
    { 'ULAN', '[[Union List of Artist Names|ULAN]]', 245, p.ulanLink, 1 },
    { 'bgm.tv personage', '[[:zh:Bangumi 番組計劃|Bangumi]]', 6296, 'n', 0 },
    { 'bgm.tv pessoa', '[[:zh:Bangumi 番組計劃|Bangumi]]', 6298, 'n', 0 },
    { 'bgm.tv tópico', '[[:zh:Bangumi 番組計劃|Bangumi]]', 5732, 'n', 0 },
    -- { 'ANMF', '[[Académie Nationale de Médecine|ANMF]]', 3956, 'n', 0 },
    -- { 'DIR3', '[[:es:Directorio Común de Unidades Orgánicas y Oficinas|DIR3]]', 6222, 'n', 0 },
    -- { 'ISCO', '[[d:Q1233766|ISCO]]', 952, 'n', 0 },
    -- { 'KVAB', '[[:es:Real Academia Flamenca de Ciencias y Artes de Bélgica|KVAB]]', 3887, 'n', 0 },
    -- { 'Microsoft Academic', '[[Microsoft Academic]]', 6366, 'n', 0 },
    { 'SELIBR', '[[LIBRIS|SELIBR]]', 906, p.selibrLink, 1 },
    { 'AAT', '[[Art & Architecture Thesaurus|AAT]]', 1014, 'n', 1 },
    { 'ACNP', 'ACNP', 6981, 'n', 0 },
    { 'ARAE', '[[:d:Q105580684|ARAE]]', 9226, 'n', 0 },
    { 'Asamblea de Madrid', '[[:es:Asamblea de Madrid|Assembleia de Madrid]]', 4797, 'n', 0 },
    { 'BCN', '[[:es:Biblioteca del Congreso de la Nación Argentina|BCNA]]', 2879, 'n', 1 },
    { 'BCNCL', '[[:es:Biblioteca del Congreso Nacional de Chile|Biografias BCN]]', 5442, 'url', 0 },
    { 'BNA', '[[Biblioteca Nacional da República Argentina|BNA]]', 3788, 'n', 0 },
    { 'BNC', '[[Biblioteca Nacional do Chile (identificador)|BNC]]', 1890, p.bncLink, 0 },
    { 'BNE', '[[Biblioteca Nacional de Espanha|BNE]]', 950, p.bneLink, 1 },
    { 'BNF', '[[Biblioteca Nacional de França|BNF]]', 268, p.bnfLink, 1 },
    { 'BNM', '[[Biblioteca Nacional do México|BNM]]', 4440, 'n', 0 },
    { 'BOE', '[[Boletín Oficial del Estado|BOE]]', 4256, 'n', 0 },
    { 'BPN', '[[Biografisch Portaal (identificador)|BPN]]', 651, p.bpnLink, 1 },
    --{ 'CANTIC1', '[[Biblioteca da Catalunha (identificador)|CANTIC]]', 1273, p.canticLink, 0 }, -- será que é duplicado em P9984
    { 'CANTIC', '[[Biblioteca da Catalunha|CANTIC]]', 9984, 'n', 0 },
    { 'CCBAE', '[[:d:Q61505171|CCBAE]]', 6493, 'n', 0 },
    { 'CINII', '[[CiNii (identificador)|CiNii]]', 271, p.ciniiLink, 0 },
    { 'CONICET', '[[CONICET]]', 3900, 'n', 0 },
    { 'CensoGuia', '[[:es:Censo-Guía de Ficheiros de España e Iberoamérica]]', 3998, 'n', 0 },
    { 'DOAJ', '[[:es:Directory of Open Access Journals|DOAJ]]', 5115, 'n', 0 },
    { 'DPRR', 'DPRR', 6863, 'n', 0},
    { 'DipFedBra', '[[Câmara dos Deputados do Brasil]]', 7480, 'n', 0 },
    { 'Directorio Legislativo', 'Directorio Legislativo', 6585, 'n', 0 },
    { 'DirectorioMuseos', '[[:d:Q56246649|Directorio de Museos y Colecciones de España]]', 5763, 'n', 0 },
    { 'ERIH PLUS', 'ERIH PLUS', 3434, 'n', 0 },
    { 'Ficheiro Histórico de Diputados de España', '[[Congresso dos Deputados (Espanha)|Ficheiro Histórico de Diputados (1810-1977)]]', 9033, 'n', 0 },
    { 'GND', '[[Integrated Authority File|GND]]', 227, p.gndLink, 1 },
    { 'GoogleScholar', '[[Google Académico]]', 1960, p.googleLink, 0 },
    { 'Grierson', '[[:es:Directorio de científicos argentinos Dra. Grierson|Grierson]]', 3946, 'n', 0 },
    { 'HAW', '[[:es:Academia de Ciencias y Humanidades de Heidelberg|HAW]]', 2273, 'n', 0 },
    { 'HCDN', '[[Câmara de Deputados da Nação Argentina|Estadísticas HCDN]]', 4693, 'n', 0 },
    { 'HCDNbio', '[[Câmara de Deputados da Nação Argentina|Biografia HCDN]]', 5225, 'n', 0 },
    { 'IPNIaut', '[[Índice Internacional de Nomes de Plantas|IPNI]]', 586, 'n', 'IPNI' },
    { 'IPNIpub', '[[Índice Internacional de Nomes de Plantas|IPNI]]', 2008, 'n', 1 },
    { 'ISNI', '[[ISNI (identificador)|ISNI]]', 213, p.isniLink, 1 },
    { 'ISSN', '[[ISSN]]', 236, 'n', 1 },
    { 'KNAW', '[[KNAW]]', 2454, 'n', 0 },
    { 'KULTURNAV', '[[KulturNav (identificador)|KulturNav]]', 1248, p.kulturnavaLink, 0 },
    { 'LCCN', '[[Library of Congress Control Number|LCCN]]', 244, p.lccnLink, 1 },
    { 'LCCNLCOC', '[[Library of Congress Control Number|LCCN]]', 1144, 'n', 0 },
    { 'Latindex', '[[Latindex]]', 3127, 'n', 0 },
    { 'Leopoldina', '[[Deutsche Akademie der Naturforscher Leopoldina|Leopoldina]]', 3413, 'n', 0 },
    { 'Libraries.org', 'Libraries.org', 4848, 'n', 0 },
    { 'Léonore', '[[Base Léonore (identificador)|Léonore]]', 640, p.leonoreLink, 1 },
    { 'NARA', '[[National Archives and Records Administration|NARA]]', 1225, p.naraLink, 1 },
    { 'NCL', '[[National Central Library|NCL]]', 1048, p.nclLink, 0 },
    { 'NDL', '[[Biblioteca Nacional da Dieta|NDL]]', 349, p.ndlLink, 1 },
    { 'NKC', '[[Biblioteca Nacional da República Checa|NKC]]', 691, p.nkcLink, 0 },
    { 'NLA', '[[Biblioteca Nacional da Austrália|NLA]]', 409, p.nlaLink, 1 },
    { 'NLM', '[[Biblioteca Nacional de Medicina dos Estados Unidos|NLM]]', 1055, 'n', 1 },
    { 'NorwegianRegister', '[[:es:Norsk senter for forskningsdata|Norwegian Register]]', 1270, 'n', 0 },
    { 'Número IMO', 'Número IMO', 458, 'n', 0},
    { 'ORCID', '[[ORCID]]', 496, p.orcidLink, 1 },
    { 'OpenLibrary', '[[Open Library (identificador)|Open Library]]', 648, 'n', 'Open Library' },
    { 'PARES', 'PARES', 4813, 'n', 0 },
    { 'RANM', '[[:es:Real Academia Nacional de Medicina|RANM]]', 3945, 'n', 0 },
    { 'RBD', '[[:es:Ministerio de Educación de Chile|RBD MINEDUC]]', 1919, 'n', 0 },
    { 'RID', '[[ResearcherID]]', 1053, p.ridLink, 1 },
    { 'RKDartists', '[[RKD]]', 650, p.rkdartistsLink, 1 },
    { 'BER', '[[Biblioteca do Estado Russo|BER]]', 947, p.berLink, 0 },
    { 'RoyalSociety', '[[Royal Society]]', 2070, 'url', 'Royal Society' },
    { 'S2', '[[:d:Q22908627|S2]]', 4012, 'n', 0 },
    { 'SAW', '[[:es:Academia Sajona de Ciencias de Leipzig|SAW]]', 3411, 'n', 1 },
    { 'ICCU', '[[Istituto Centrale per il Catalogo Unico|ICCU]]', 396, p.iccuLink, 0 },
    { 'SIKART', '[[SIKART]]', 781, p.sikartLink, 0 },
    { 'SNAC', '[[d:Q29861311|SNAC]]', 3430, p.snacLink, 'SNAC-ID' },
    { 'SSRN', '[[Social Science Research Network|SSRN]]', 3747, 'n', 0 },
    { 'SUCA', 'SUCA', 5946, 'n', 1 },
    { 'SUDOC', '[[Système universitaire de documentation|SUDOC]]', 269, p.sudocLink, 1 },
    { 'SUDOCcat', '[[Système universitaire de documentation|SUDOC]]', 1025, 'n', 'SUDOC' },
    { 'Scopus', '[[Scopus]]', 1153, p.scopusLink, 1 },
    { 'Senadores de España (1834-1923)', '[[Senado (Espanha)|Senadores de España (1834-1923)]]', 10265, 'n', 0 },
    { 'Slovenska biografija', '[[:d:Q15975890|Slovenska biografija]]', 1254, 'n', 0 },
    { 'Tebeosfera-autor', '[[:es:Tebeosfera|Tebeosfera]]', 5562, 'n', 0 },
    { 'USCongress', '[[Biographical Directory of the United States Congress|US Congress]]', 1157, p.uscongressLink, 0 },
    { 'VIAF', '[[VIAF (identificador)|VIAF]]', 214, p.viafLink, 1 },
    { 'ZDB', '[[:es:Zeitschriftendatenbank|ZDB]]', 1042, 'n', 1 },
    { 'autores.uy', '[[:d:Q22975461|autores.uy]]', 2558, p.autoresuyLink, 1 },
    { 'frickSpain ', '[[Coleção Frick|research.frick]]', 8572, 'n', 0 },
    { 'tribunsdelaplebe.fr', 'TDLP', 8961, 'n', 0},
    },
    },
    {
    title = 'Dicionários e enciclopédias',
    group = {
    {'LNB', '[[Biblioteca Nacional da Letónia|LNB]]', 1368, p.lnbLink, 0},
    { 'ADB', 'ADB', 1907, p.adbLink, 0 },
    { 'DIB', '[[:d:Q5273969|DIB]]', 6829, p.dibLink, 0 },
    { 'EMU', '[[:d:Q4532152|EMU]]', 4613, p.emuLink, 0 },
    { 'NLR', '[[Biblioteca Nacional da Roménia|BNR]]', 1003, p.nlrLink, 1},
    { 'VcBA', '[[BAV]]', 8034, p.vcbaLink, 0},


    { 'AAR', '[[:it:American Academy in Rome|AAR]]', 9097, 'n', 0 },
    { 'Angelicum', '[[Pontifícia Universidade São Tomás de Aquino|Angelicum]]', 5731, 'n', 0 },
    { 'PTBNP', '[[Biblioteca Nacional (Portugal)|PTBNP]]', 1005, 'n', 'PTBNP' },
    { 'AUB', '[[Universidade Americana de Beirute|AUB]]', 9409, 'n', 0 },
    { 'Amathus', '[[:d:Q105663258|Amathus]]', 9252, 'n', 0 },
    { 'AWR', '[[:d:Q36581948|AWR]]', 4186, p.awrLink, 0 },
    { 'BAU', '[[Universidade Árabe de  Beirute|BAU]]', 9504, 'n', 0 },
    { 'BFS', '[[:it:Biblioteca Franco Serantini|BFS]]', 9178, 'n', 0 },
    { 'BGCTS', '[[:d:Q106647706|BGCTS]]', 9534, 'n', 0 },
    { 'BIBSYS obra', '[[Bibsys|BIBSYS]]', 6211, 'n', 0 },
    { 'BINER', '[[:d:Q105459443|BINER]]', 9179, 'n', 0 },
    { 'BL sysnum', '[[:d:Q53571158|BL sysnum]]', 5199, 'n', 0 },
    { 'BM', '[[Biblioteca Marciana|BM]]', 8944, 'n', 0 },
    { 'BNAED', '[[Biblioteca Nacional da República Argentina|BNA]]', 1143, 'n', 0 },
    { 'BSS', '[[:d:Q106647632|BSS]]', 9522, 'n', 0 },
    { 'BVFE', '[[:d:Q86834882|BVFE]]', 9117, 'n', 0 },
    { 'BVMC local', '[[Biblioteca Virtual Miguel de Cervantes|BVMC]]', 4098, 'n', 0 },
    { 'BVPH autoridade', '[[Biblioteca Virtual da Prensa Histórica|BVPH]]', 6492, 'n', 0 },
    { 'BiValDi', '[[:es:Biblioteca Valenciana Digital|BiValDi]]', 3932, 'n', 0 },
    { 'CB', '[[:d:Q105755418|CB]]', 9287, 'n', 0 },
    { 'CCLV', '[[:it:Biblioteca capitolare di Verona|CCLV]]', 9282, 'n', 0 },
    { 'CINII artigo', '[[CiNii]]', 2409, 'n', 0 },
    { 'CINII livro', '[[CiNii]]', 1739, 'n', 0 },
    { 'CL', '[[Biblioteca de Chipre|CL]]', 9250, 'n', 0 },
    { 'CNB livro', '[[Biblioteca Nacional da Chéquia|NKC]]', 3184, 'n', 0 },
    { 'CONOR AL', '[[:d:Q5013258|CONOR.AL]]', 8848, 'n', 0 },
    { 'CONOR BG', '[[:d:Q5013258|CONOR.BG]]', 8849, 'n', 0 },
    { 'CONOR KS', '[[:d:Q5013258|CONOR.KS]]', 8850, 'n', 0 },
    { 'CONOR SR', '[[:d:Q5013258|CONOR.SR]]', 8851, 'n', 0 },
    { 'CREPČ instituição', '[[:sk:Centrum vedecko-technických informácií Slovenskej republiky|CREPČ]]', 10075, 'n', 0 },
    { 'CREPČ pessoa', '[[:sk:Centrum vedecko-technických informácií Slovenskej republiky|CREPČ]]', 10076, 'n', 0 },
    { 'CUT', '[[:el:Τεχνολογικό Πανεπιστήμιο Κύπρου|CUT]]', 9251, 'n', 0 },
    { 'CoBiS', '[[:d:Q81525085|CoBiS]]', 7865, 'n', 0 },
    { 'DAAO', '[[:d:Q5273961|DAAO]]', 1707, p.daaoLink, 0 },
    { 'DLL autor', '[[:d:Q89982699|DLL]]', 8122, 'n', 0 },
    { 'DLL obra', '[[:d:Q89982699|DLL]]', 8123, 'n', 0 },
    { 'EBAF', '[[École Biblique|EBAF]]', 9661, 'n', 0},
    -- { 'EMLO local', '[[:d:Q44526767|EMLO]]', 4672, 'n', 0 }, erro trad
    { 'EMLO pessoa', '[[:d:Q44526767|EMLO]]', 1802, 'y', 0 },
    { 'EUC', '[[:el:Ευρωπαϊκό Πανεπιστήμιο Κύπρου|EUC]]', 9253, 'n', 0 },
    { 'EUL', 'EUL', 1084, 'n', 0 },
    { 'FCCOS', '[[:d:Q107075514|FCCOS]]', 9678, 'n', 0 },
    { 'GDC', '[[:d:Q104244355|GDC]]', 8795, 'n', 0 },
    { 'HKCAN', '[[:zh:香港中文名稱規範數據庫|HKCAN]]', 5909, 'n', 0 },
    { 'ICUL', '[[:ro:Biblioteca Centrală Universitară din Iași|ICUL]]', 9861, 'n', 0 },
    { 'INAPP autor', '[[:d:Q108366617|INAPP]]', 9871, 'n', 0 },
    { 'INAPP obra', '[[:d:Q108366617|INAPP]]', 9874, 'n', 0 },
    { 'K Scholar', '[[Assembleia Nacional da Coreia do Sul|K-Scholar]]', 8223, 'n', 0 },
    { 'KANTO', '[[:fi:KANTO|KANTO]]', 8980, 'n', 0 },
    { 'KD', '[[Keratsini-Drapetsona|KD]]', 9337, 'n', 0 },
    { 'Kalliope-Verbund', '[[:de:Kalliope-Verbund|Kalliope-Verbund]]', 9964, 'n', 0 },
    { 'Kallías', '[[:de:Deutsches Literaturarchiv Marbach|Kallías]]', 9918, 'n', 0 },
    { 'LIBRISED', '[[LIBRIS]]', 1182, 'n', 0 },
    { 'LTIK', '[[:ko:한국문학번역원|LTIK]]', 4760, 'n', 0 },
    { 'MEK', '[[:hu:Magyar Elektronikus Könyvtár|MEK]]', 2623, 'n', 0 },
    { 'MG', '[[Palazzo Castellani (Florença)|MG]]', 8947, 'n', 0 },
    { 'NDL JPNO', '[[Biblioteca Nacional da Dieta|NDL]]', 2687, 'n', 0 },
    { 'NDL obra', '[[Biblioteca Nacional da Dieta|NDL]]', 9836, 'n', 0 },
    { 'NDLEd', '[[Biblioteca Nacional da Dieta|NDL]]', 1054, 'n', 0 },
    { 'NLB', '[[:d:Q27927503|NLB]]', 3390, 'n', 0 },
    { 'NLI obra', '[[Biblioteca Nacional de Israel|NLI]]', 3959, 'n', 'NLI' },
    { 'NLNZ', '[[Biblioteca Nacional da Nova Zelândia|NLNZ]]', 7682, 'n', 0 },
    { 'NLP', '[[Biblioteca Nacional da Polónia|NLP]]', 1695, p.nlpLink, 0 },
    { 'NLW catálogo', '[[Biblioteca Nacional do País de Gales|NLW]]', 6786, 'url', 0 },
    { 'NLW', '[[:d:Q666063|NLW]]', 2966, 'n', 0 },
    { 'NMBL', '[[:d:Q2083799|NMBL]]', 7472, 'n', 0 },
    { 'NSZL', '[[Biblioteca Nacional da Hungria|NSZL]]', 951, 'n', 0 },
    { 'OCLC obra', '[[Online Computer Library Center|OCLC]]', 5331, 'n', 0 },
    { 'PIAC', '[[:d:Q2120406|PIAC]]', 8982, 'n', 0 },
    { 'PRDL', '[[:d:Q7233488|PRDL]]', 1463, 'n', 1 },
    { 'PUSC', '[[Pontifícia Universidade São Tomás de Aquino|Angelicum]]', 5739, 'n', 0 },
    { 'RRL', '[[Rijksmuseum|RRL]]', 7444, 'n', 0 },
    { 'SAIA', '[[Escola Arqueológica Italiana de Atenas|SAIA]]', 9536, 'n', 0 },
    { 'SBN', '[[:it:Servizio bibliotecario nazionale|SBN]]', 5485, 'n', 1 },
    { 'SEARCH', '[[:d:Q104866947|SEARCH]]', 9081, 'n', 0 },
    { 'SHARE autor', '[[:d:Q56557486|Catálogo SHARE]]', 3987, 'n', 0 },
    { 'SHARE obra', '[[:d:Q56557486|Catálogo SHARE]]', 7609, 'n', 0 },
    { 'SIR', '[[:it:Istituto svedese di studi classici a Roma|SIR]]', 9164, 'n', 0 },
    { 'SL', '[[:d:Q616272|SL]]', 6702, 'n', 0 },
    { 'SNK', '[[:d:Q620899|SNK]]', 9807, 'n', 0 },
    { 'SVKKL', '[[:d:Q8115944|SVKKL]]', 9322, 'n', 0 },
    { 'SWB', '[[:d:Q1684093|SWB]]', 1044, 'n', 1 },
    { 'SWHPL', '[[:en:Southwest Harbor Public Library|SWHPL]]', 8871, 'n', 0 },
    { 'Share-VDE', '[[:d:Q96776982|Share-VDE]]', 6329, 'n', 0 },
    { 'Syriaca dicionário', '[[:en:Syriaca.org|Syriaca]]', 6934, 'n', 0 },
    { 'Syriaca obra', '[[:en:Syriaca.org|Syriaca]]', 7034, 'n', 0 },
    { 'Tabakalera', '[[:es:Tabakalera|Tabakalera]]', 10069, 'n', 0 },
    { 'Te Papa', '[[Museu da Nova Zelândia Te Papa Tongarewa|Te Papa]]', 3544, p.tepapaLink, 0 },
    { 'UCACR', '[[Biblioteca Nacional da Arménia|UCACR]]', 9147, 'n', 0 },
    { 'UGSpace', '[[Universidade de Gana|UGSpace]]', 8602, 'n', 0 },
    { 'UPSA', '[[Universidade Pontifícia de Salamanca|UPSA]]', 9247, 'n', 0 },
    { 'URBS', '[[:d:Q100594815|URBS]]', 8750, 'n', 0 },
    { 'Auñamendi', '[[:es:Enciclopedia Auñamendi|Auñamendi]]', 3218, 'n', 0 },
    { 'Britannica', '[[Britannica]]', 1417, 'url', 0 },
    { 'DBE', '[[:d:Q41705771|DBE]]', 4459, 'url', 0 },
    { 'DBSE', '[[:es:Diccionario biográfico del socialismo español|DBSE]]', 2985, 'url', 0 },
    { 'ELEM', '[[:es:Enciclopedia de la Literatura en México|ELEM]]', 1565, 'n', 0 },
    { 'GEA', '[[Gran Enciclopedia Aragonesa|GEA]]', 1807, 'n', 0 },
        --{ 'GEC', '[[Gran Enciclopèdia Catalana|GEC]]', 1296, 'n', 0 },
    { 'GEN', '[[:es:Gran Enciclopedia Navarra|GEN]]', 7388, 'n', 0 },
    { 'HDS', '[[Historical Dictionary of Switzerland|HDS]]', 902, p.hdsLink, 0 },
    { 'LIR', '[[Historical Dictionary of Switzerland#Lexicon_Istoric_Retic|LIR]]', 886, p.lirLink, 0 },
    { 'TLS', '[[Theaterlexikon der Schweiz|TLS]]', 1362, p.tlsLink, 0 },
    { 'Treccaniid', '[[Enciclopédia Treccani|Treccani]]', 3365, 'url', 0 },
    { 'Treccani', '[[Enciclopédia Treccani|Treccani]]', 4223, 'url', 0 },
    },
    },
    {
    title = 'Repositórios digitais',
    group = {
    { 'FNA', '[[:d:Q2983474|FNA]]', 4177, 'y', 1 },

    { 'MBI', '[[Musicbrainz|MusicBrainz]]', 1330, p.mbiLink, 0 },
    { 'MBS', '[[Musicbrainz|MusicBrainz]]', 1407, p.mbsLink, 0 },
    { 'MBW', '[[Musicbrainz|MusicBrainz]]', 435, p.mbwLink, 0 },
    { 'NGV', '[[Galeria Nacional de Vitória|National Gallery of Victoria]]', 2041, p.ngvLik, 0 },
    { 'PIC', '[[:d:Q23892012|PIC]]', 2750, p.picLink, 0 },
    { 'Publons', '[[:d:Q18389628|Publons]]', 3829, p.publonsLink, 0 },
    { 'PWN', '[[Internetowa encyklopedia PWN (identificador)|PWN]]', 7305, p.PWNlLink, 0 },
    { 'RISM', '[[:d:Q2178828|RISM]]', 5504, p.rismLink, 0 },
    { 'RERO', '[[RERO (identificador)|RERO]]', 3065, p.reroLink, 0 },
    { 'RKDID', '[[RKD]]', 350, p.rkdidLink, 'RKD' },
    { 'TDVIA', '[[:d:Q21527102|TDVIA]]', 7314, p.tdviaLink, 0 },
    { 'UKPARL', '[[Parlamento da Inglaterra|UKPARL]]', 6213, p.ukparlLink, 0 },

    { 'DSI', '[[:d:Q21417186|DSI]]', 2349, p.dsiLink, 0 },
    { 'FNZA', '[[:d:Q99484217|FNZA]]', 6792, p.fnzaLink, 0 },
    { 'ICIA', 'ICIA', 1736, p.iciaLink, 0 },
    { 'IEU', '[[:d:Q87193076|IEU]]', 9070, p.ieuLink, 0},
    { 'AGSA', '[[:d:Q705557|AGSA]]', 6804, p.agsaLink, 0 },
    { 'Bildindex', '[[:d:Q860888|Bildindex]]', 2092, p.bildLink, 0 },

    { 'MobyGames', '[[MobyGames]]', 1933, 'n', 0 },
    { 'NUPILL autor', '[[Universidade Federal de Santa Catarina|NUPILL]]', 1473, 'n', 'NUPILL' },
    { 'AAG', 'Galerias de arte e museus', 3372, p.aagLink, 0 },
    { 'ARLIMA', '[[:d:Q43363768|ARLIMA]]', 4549, 'n', 0 },
    { 'NUPILL documento', '[[Universidade Federal de Santa Catarina|NUPILL]]', 1474, 'n', 0 },
    { 'arXiv', '[[arXiv]]', 818, 'n', 0 },
    -- { 'JSTORrevista', '[[JSTOR]]', 1230, 'n', 0 },
    -- { 'UNZautor', '[[UNZ.org|UNZ]]', 2734, 'n', 0 },
    -- { 'UNZrevista', '[[UNZ.org|UNZ]]', 2735, 'n', 0 },
    { 'BDCYL', '[[:es:Biblioteca Digital de Castilla y León|BDCYL]]', 3964, 'n', 0 },
    { 'BHL-bibliografia', '[[Biodiversity Heritage Library|BHL]]', 4327, 'n', 0 },
    { 'BIDICAM', '[[d:Q61500710|BIDICAM]]', 6490, 'n', 0 },
    { 'BVANDALUCIA', '[[:es:Biblioteca Virtual de Andalucía|BVA]]', 6496, 'n', 0 },
    { 'BVMCobra', '[[Biblioteca Virtual Miguel de Cervantes|BVMC]]', 3976, 'n', 0 },
    { 'BVMCpessoa', '[[Biblioteca Virtual Miguel de Cervantes|BVMC]]', 2799, 'n', 0 },
    { 'BVPB', '[[d:Q18596294|BVPB]]', 4802, 'n', 0 },
    { 'DOI', '[[DOI]]', 356, 'n', 1 },
    { 'Dialnet', '[[Dialnet]]', 1607, 'n', 0 },
    { 'DialnetRevista', '[[Dialnet]]', 1609, 'n', 0 },
    { 'Europeana', '[[Europeana]]', 7704, 'n', 1 },
    { 'GalicianaAutor', '[[Galiciana]]', 3307, 'n', 0 },
    { 'Galicianaobra', '[[Galiciana]]', 3004, 'n', 0 },
    { 'GutenbergAutor', '[[Projeto Gutenberg]]', 1938, 'n', 'Gutenberg' },
    { 'Handle', '[[Sistema Handle|Handle]]', 1184, 'url', 0 },
    { 'HathiTrust', '[[HathiTrust]]', 1844, 'n', 0 },
    --{ 'LAC', '[[Biblioteca e Arquivos do Canadá|LAC]]', 1670, 'n', 0},
    { 'MNCARS', '[[Museu Nacional Centro de Arte Rainha Sofia|MNCARS]]', 4439, 'url', 0 },
    { 'MuseoDelPradoObra', '[[Museu do Prado]]', 8905, 'n', 0 },
    { 'MuseoDelPradoPersona', '[[Museu do Prado]]', 5321, 'n', 0 },
    { 'Packard Humanities Institute', '[[:es:Packard Humanities Institute|PHI]]', 6941, 'n', 0 },
    { 'Persée', '[[Persée (portal)|Persée]]', 2732, 'n', 0 },
    { 'PerséeRevista', '[[Persée (portal)|Persée]]', 2733, 'n', 0 },
    { 'Redalyc', '[[Redalyc]]', 3131, 'n', 0 },
    { 'TLL', '[[:d:Q570837|TLL]]', 7042, 'n', 0 },
    { 'Trove', '[[Trove (identificador)|Trove (Austrália)]]', 1315, p.troveLink, 0 }, --formerly NLA-person
    },
    },
    {
    title = 'Hemerotecas digitais',
    group = {
    { 'FAST', '[[Faceted Application of Subject Terminology (identificador)|FAST]]', 2163, p.fastLink, 0 },

    { 'ArquivoArq', '[[:d:Q105528142|Arquivo Arq]]', 4694, 'n', 0 },
    { 'HemBNE', '[[Hemeroteca Digital da Biblioteca Nacional da Espanha|Hemeroteca digital da BNE]]', 2768, 'n', 0 },
    { 'BVPH', '[[Biblioteca Virtual de Prensa Histórica]]', 2961, 'n', 0 },
    { 'Memoriademadrid', '[[:es:Memoriademadrid|Memoriademadrid]]', 7372, 'n', 0 },
    },
    },
    {
    title = 'Lugares',
    group = {
    { 'MBAREA', '[[MBAREA (identificador)|MusicBrainz]]', 982, p.mbareaLink, 0 },
    { 'MBP', '[[Musicbrainz|MusicBrainz]]', 1004, p.mbpLink, 0},

        --{ 'Foursquare', '[[Foursquare]]', 1968, 'n', 0 },
    { 'Booking.com', '[[Booking.com]]', 3607, 'n', 0 },
    { 'CatholicHierarchyDioc', '[[Catholic-Hierarchy.org|Catholic-Hierarchy]]', 1866, 'n', 'Catholic Hierarchy' },
    { 'Emporis', '[[Emporis]]', 455, 'n', 0 },
    { 'FAA', '[[Administração Federal de Aviação|FAA]]', 240, 'n', 0 },
    { 'Find a Grave cemetery', '[[Find a Grave|Find a Grave (cemitério)]]', 2025, 'n', 'Find a Grave' },
    { 'GeoNames', '[[Geonames|GeoNames]]', 1566, 'n', 1 },
    { 'HappyCow', '[[HappyCow]]', 3877, 'n', 0 },
    { 'Hotels.com', '[[:en:Hotels.com|Hotels.com]]', 3898, 'n', 0 },
    { 'IATA', '[[Associação Internacional de Transportes Aéreos|IATA]]', 238, 'n', 0 },
    { 'ICAO', '[[Organização da Aviação Civil Internacional|ICAO]]', 239, 'n', 0 },
    { 'JPL', '[[Jet Propulsion Laboratory|JPL]]', 716, 'n', 0 },
    { 'MTPort', '[[:en:MarineTraffic|MarineTraffic]]', 1624, 'n', 0 },
    { 'Michelin Restaurants', '[[Guia Michelin|Michelin Restaurants]]', 4160, 'n', 0 },
    { 'Michelin Voyages', '[[:fr:Guide vert|Michelin Voyages]]', 4161, 'n', 0 },
    { 'MusicBrainzArea', '[[Musicbrainz|MusicBrainz]]', 982, 'y', 0},
    { 'NPCA', '[[Associação de Conservação de Parques Nacionais|NPCA]]', 3515, 'n', 0 },
    { 'NPF', '[[:en:National Park Foundation|NPF]]', 3516, 'n', 0 },
    { 'NSSDC', '[[NSSDC ID]]', 247, 'n', 0 },
    { 'NUTS', '[[Nomenclatura das Unidades Territoriais para Fins Estatísticos|NUTS]]', 605, 'n', 0 },
    { 'Natura2000', '[[Rede Natura 2000|Natura 2000]]', 3425, 'n', 0 },
    { 'OSM', '[[Openstreetmap|OSM]]', 402, 'n', 0 },
    { 'Peakbagger', '[[:d:Q28736250|Peakbagger]]', 3109, 'n', 0 },
    { 'Peakfinder', '[[:d:Q28925511|Peakfinder]]', 3770, 'n', 0 },
    { 'Radzima.org', '[[:be:Radzima.org|Razima.org]]', 2491, 'n', 0 },
    { 'Recreation.gov', '[[:en:Recreation.gov|Recreation.gov]]', 3609, 'n', 0 },
    { 'Routard.com', '[[:fr:Guide du routard|Routard.com]]', 4986, 'n', 0 },
    { 'Structurae', '[[Structurae]]', 454, 'n', 0 },
    { 'TheatricaliaPlace', '[[:d:Q24056151|Theatricalia]]', 2468, 'n', 0 },
    { 'Touring Club Italiano', '[[:it:Touring Club Italiano|Touring Club Italiano]]', 5601, 'n', 0 },
    { 'TripAdvisor', '[[TripAdvisor]]', 3134, 'n', 0 },
    { 'UK Pub History', 'UK Pub History', 4340, 'n', 0 },
    { 'WOEID', '[[WOEID (identificador)|WOEID]]', 1281, p.woeidLink, 0 },
    { 'Wikimapia', '[[Wikimapia]]', 7678, 'n', 0 },
    { 'Yelp', '[[Yelp]]', 3108, 'n', 0 },
    { 'eParks', '[[:d:Q34925270|eParks]]', 4170, 'n', 0 },
    { 'AtlasIR', '[[:d:Q24575107|Atlas Digital do Império Romano]]', 1936, 'n', 0 },
    { 'GNIS', 'GNIS', 590, 'n', 0},
    { 'IBGE', '[[Instituto Brasileiro de Geografia e Estatística|IBGE]]', 1585, 'n', 0 },
    { 'IDESCAT', '[[:es:Instituto de Estadística de Cataluña|IDESCAT]]', 4335, 'n', 0 },
    { 'INE Portugal', '[[Instituto Nacional de Estatística (Portugal)|INE]]', 6324, 'n', 0 },
    { 'INE', '[[Instituto Nacional de Estadística (Espanha)|INE]]', 772, p.ineLink, 0 },
    { 'INSEE-canton', '[[Institut national de la statistique et des études économiques|INSEE]]', 2506, 'n', 0 },
    { 'INSEE-commune', '[[Institut national de la statistique et des études économiques|INSEE]]', 374, 'n', 0 },
    { 'INSEE-departamento', '[[Institut national de la statistique et des études économiques|INSEE]]', 2586, 'n', 0 },
    { 'INSEE-region', '[[Institut national de la statistique et des études économiques|INSEE]]', 2585, 'n', 0 },
    { 'KSH', '[[:es:Központi Statisztikai Hivatal|KSH]]', 939, 'n', 0 },
    { 'LAU', '[[Unidade administrativa local|LAU]]', 782, 'n', 0 },
    { 'NATURA2000', '[[:es:Red Natura 2000|Natura 2000]]', 3425, 'n', 0 },
    { 'OFS-CHE', 'OFS', 771, 'n', 0 },
    { 'OKATO', 'OKATO', 721, 'n', 0 },
    { 'OSTAT', '[[Statistik Austria|ÖSTAT]]', 964, 'n', 0 },
    { 'Pleiades', '[[:d:Q24423804|Pleiades]]', 1584, 'n', 0 },
    { 'SIRUTA', 'SIRUTA', 843, 'n', 0 },
    { 'SNCZI-IPE-EMBALSE', '[[:es:Sistema Nacional de Cartografía de Zonas Inundables|SNCZI]]-IPE', 4568, 'n', 0 },
    { 'SNCZI-IPE-PRESA', '[[:es:Sistema Nacional de Cartografía de Zonas Inundables|SNCZI]]-IPE', 4558, 'n', 0 },
    { 'TGN', '[[Getty Thesaurus of Geographic Names (identificador)|TGN]]', 1667, p.tgnLink, 0 },
    { 'TOID', 'TOID', 3120, 'url', 0 },
    { 'TmGEO', '[[:d:Q22094624|Trismegistos GEO]]', 1958, 'n', 0 },
    { 'WWF', '[[Fundo Mundial para a Natureza|WWF]]', 1294, 'n', 0 },
    },
    },
    {
    title = 'Arquitetura',
    group = {
    { 'Anais do Museu Paulista', '[[Anais do Museu Paulista]]', 8586, 'n', 0 },
    { 'COAMinmueble', '[[:es:Colegio Oficial de Arquitectos de Madrid|COAM]]', 2917, 'n', 0 },
    { 'COAMpersona', '[[:es:Colegio Oficial de Arquitectos de Madrid|COAM]]', 4488, 'n', 0 },
    { 'DocomomoIberico', '[[:es:Fundación Docomomo Ibérico|Docomomo Ibérico]]', 3758, 'n', 0 },
        },
    },
    {
    title = 'Faróis',
    group = {
    { 'ARHLS', '[[Sociedade de Radioamadores de Faróis|ARHLS]]', 2980, p.ARLHSLink, 0 },
    { 'CCG', '[[CCG (identificador)|CCG]]', 3920, p.ccgLink, 0 },
    { 'MarineTraffic', '[[:en:MarineTraffic|MarineTraffic]]', 3601, 'n', 0 },
    { 'NGA', '[[NGA]]', 3563, p.ngaLink, 0 },
    { 'OnlineListofLights', '[[:d:Q843152|Online List of Lights]]', 3223, 'n', 0 },
    { 'UKHO', '[[Instituto Hidrográfico do Reino Unido|UKHO]]', 3562, p.admiraltyLink, 0 },
    { 'USCG', '[[USCG (identificador)|USCG]]', 3723, p.uscgLink, 0 },
    },
    },
    {
    title = 'Música',
    group = {
    { 'MBA', '[[Musicbrainz|MusicBrainz]]', 434, p.mbaLink, 0},
    { 'MBL', '[[Musicbrainz|MusicBrainz]]', 966, p.mblLink, 0},
    { 'MBRG', '[[Musicbrainz|MusicBrainz]]', 436, p.mbrgLink, 0},
    { 'CBDB', '[[:en:China Biographical Database|CBDB]]', 497, 'CBDB'},
    { 'CALIS', '[[:d:Q9384291|CALIS]]', 270, 'n', 1 },

    { 'IMMuB artista', '[[Instituto Memória Musical Brasileira|IMMuB]]', 8812, 'n', 0 },
    { 'Allmusic', '[[AllMusic]]', 1728, 'n', 0 },
    { 'AllmusicAlbum', '[[AllMusic]]', 1729, 'n', 0 },
    { 'AllmusicComposition', '[[AllMusic]]', 1994, 'n', 0 },
    { 'AllmusicSong', '[[AllMusic]]', 1730, 'n', 0 },
    { 'DCAMPB', '[[Dicionário Cravo Albin da Música Popular Brasileira|DCAMPB]]', 4351, 'n', 0 },
    { 'DiscogsMaster', '[[Discogs]]', 1954, 'n', 0 },
    { 'IMMuB álbum', '[[Instituto Memória Musical Brasileira|IMMuB]]', 8813, 'n', 0 },
    { 'MusicBrainzRelease', '[[Musicbrainz|MusicBrainz]]', 436, 'y', 0 },
    { 'MusicBrainzWork', '[[Musicbrainz|MusicBrainz ]]', 435, 'y', 0 },
    { 'Musica Brasilis ID compositor', '[[Portal Musica Brasilis|Musica Brasilis]]', 8853, 'n', 0 },
    { 'Musica Brasilis ID partitura', '[[Portal Musica Brasilis|Musica Brasilis]]', 9116, 'n', 0 },
    { 'OpenCritic', '[[OpenCritic]]', 2864, 'n', 0 },
    },
    },
    {
    title = 'Património histórico',
    group = {
    { 'CONDEPHAAT', '[[Conselho de Defesa do Patrimônio Histórico|CONDEPHAAT]]', 5525, 'n', 0 },
    { 'DHBB', '[[Dicionário Histórico-Biográfico Brasileiro|DHBB]]', 9451, 'n', 0 },
    { 'Wikiparques', '[[:d:Q90728308|Wikiparques]]', 8114, 'n', 0 },
    { 'Árvore de Interesse Público', '[[Árvores de interesse público|Árvore de Interesse Público]]', 8492, 'n', 0 },
    { 'EgliseInfo', 'EgliseInfo', 1644, 'n', 0 },
    { 'Europeana1', '[[Europeana]]', 727, 'n', 0 },
    -- { 'GoogleMaps', '[[Google Maps]]', 3749, 'n', 0 }, causa erros
    { 'PCP', '[[:de:Bundesamt für Bevölkerungsschutz|PCP]]', 381, 'n', 0 },
    { 'AustriaObjektID', 'Austria ObjektID', 2951,  'n', 0 },
    { 'BCIN', '[[:ca:Bien Cultural de Interés Nacional|BCIN]]', 1586, 'n', 0 },
    { 'BDI-IAPH', '[[:es:Instituto Andaluz del Patrimonio Histórico|Patrimonio Inmueble de Andalucía]]', 3318, 'n', 0 },
    { 'BIC', '[[Bem de Interesse Cultural (Espanha)|BCIN]]', 808, 'n', 0 },
    { 'BerlinerKulturdenkmal', 'Berliner Kulturdenkmal', 2424, 'n', 0 },
    { 'CADW', 'Cadw', 1459, 'n', 0 },
    { 'CNMLBH', 'CNMLBH', 4587, 'n', 0 },
    { 'CPCCLM', '[[:es:Catálogo de Patrimonio Cultural de Castilla-La Mancha|Catálogo de Patrimonio Cultural de Castela-a-Mancha]]', 6539, 'n', 0 },
    { 'CRHP', '[[:d:Q3456275|CRHP]]', 477, 'n', 0 },
    { 'FBBID', '[[:es:Fredede og Bevaringsværdige Bygninger|FBB]]', 2783,  'n', 0 },
    { 'Fornminnesregistret', '[[:es:Fornminnesregistret|FMIS]]', 1260,  'n', 0 },
    { 'HGC', 'Heritage Gazetteer for Cyprus', 6916, 'n', 0 },
    { 'HGL', 'Heritage Gazetteer of Libya', 6751, 'n', 0 },
    { 'HispaniaNostra', '[[:es:Lista roja de patrimonio en peligro|Lista Vermelha Hispania Nostra]]', 4868, 'url', 0 },
    { 'IAPH', '[[:es:Instituto Andaluz del Patrimonio Histórico|IAPH]]', 8425, 'n', 0 },
    { 'IGESPAR', '[[Instituto de Gestão do Património Arquitetónico e Arqueológico|IGESPAR]]', 1702, 'n', 1 },
    { 'IGPCV', '[[:es:Inventario General del Patrimonio Cultural Valenciano|IGPCV]]', 2473, 'n', 0 },
    { 'IPAC', '[[:ca:Inventari del Patrimoni Arquitectònic de Catalunya|IPAC]]', 1600, 'n', 0 },
    { 'Infopatrimonio', '[[:d:Q64745161|Infopatrimônio]]', 4372, 'n', 0 },
    { 'KULTURMINNE', '[[:es:Riksantikvaren|Kulturminne]]', 758, 'n', 0 },
    { 'MERIMEE', '[[Base Mérimée|Mérimée]]', 380, 'n', 0 },
    { 'NHLE', '[[National Heritage List for England|NHLE]]', 1216, 'n', 0 },
    { 'NRHP', '[[Registro Nacional de Lugares Históricos|NRHP]]', 649, 'n', 0 },
    { 'PWJCYL', '[[Junta de Castela e Leão|Património Web JCyL]]', 3177, 'n', 0 },
    { 'Památkový Katalog', 'Památkový katalog', 762, 'n', 0 },
    { 'PatrimonioIrao', 'Patrimonio Nacional do Irão', 1369, 'n', 0 },
    { 'Rijksmonument', 'Rijksmonument', 359, 'n', 0 },
    { 'SIPCA', 'SIPCA', 3580, 'n', 0 },
    { 'World Heritage Site', '[[Património da Humanidade]]', 757, 'n', 0 },
    },
    },
    {
    title = 'Desportistas',
    group = {
    { 'COB', '[[Comitê Olímpico do Brasil|COB]]', 4060, 'n', 0 },
    { 'FPF', '[[Federação Portuguesa de Futebol|FPF]]', 8780, 'n', 0 },
    -- { 'databaseOlympics', '[[:d:Q21725558|databaseOlympics]]', 3520, 'n', 0 },
    { '365chess', '[[:d:Q27529905|365chess]]', 3314, 'n', 0 },
    { 'ACB', '[[:d:Q24763557|ACB]]', 3525, 'n', 0 },
    { 'AFLTables', '[[Australian Football League|AFLTables]]', 3547, 'n', 0 },
    { 'AHL', '[[American Hockey League|AHL]]', 3651, 'n', 0 },
    { 'AllAthletics', '[[:d:Q28914760|AllAthletics]]', 3765, 'n', 0 },
    { 'As', '[[As (jornal)|As]]', 3427, 'n', 0 },
    { 'Australianfootball', '[[:d:Q19546019|Australianfootball]]', 3546, 'n', 0 },
    { 'BaseballCube', '[[:d:Q21470099|BaseballCube]]', 4731, 'n', 0 },
    { 'BaseballRef', '[[Baseball-Reference.com|Baseball-Ref]]', 1825, 'n', 0 },
    { 'BasketballHoF', '[[Basketball Hall of Fame|BasketballHoF]]', 3646, 'n', 0 },
    { 'BasketballRef', '[[:d:Q22235911|Basketball-Reference]]', 2685, 'n', 0 },
    { 'CFDW', '[[:en:College Football Data Warehouse|CFDW]]', 3560, 'n', 0 },
    { 'CPE', '[[Comitê Paralímpico Espanhol|CPE]]', 4593, 'n', 0 },
    { 'ChessGames', '[[ChessGames.com|ChessGames]]', 1665, 'n', 0 },
    { 'ChessTempo', '[[:d:Q27529928|ChessTempo]]', 3315, 'n', 0 },
    { 'CyclingArchives', '[[:d:Q21540416|CyclingArchives]]', 1409, 'n', 0 },
    { 'CyclingQuotientMen', '[[:d:Q18342406|CyclingQuotient]]', 2648 , 'n', 0 },
    { 'CyclingQuotientWoen', '[[:d:Q18342406|CyclingQuotient]]', 2708 , 'n', 0 },
    { 'DriverDB', '[[:d:Q19587362|DriverDB]]', 3684, 'n', 0 },
    { 'EAA', '[[Associação Europeia de Atletismo|EAA]]', 3766, 'y', 0},
    { 'EHF', '[[Federação Europeia de Andebol|EHF]]', 3573, 'n', 0 },
    { 'ESPNMLB', '[[ESPN]]', 3571, 'n', 0 },
    { 'ESPNNBA', '[[ESPN]]', 3685, 'n', 0 },
    { 'ESPNNFL', '[[ESPN]]', 3686, 'n', 0 },
    { 'ESPNNHL', '[[ESPN]]', 3687, 'n', 0 },
    { 'EUfootballInfo', '[[:d:Q19428050|EUfootballInfo]]', 3726, 'n', 0 },
    { 'EWRC', '[[:en:EWRC-results.com|eWRC]]', 3927, 'n', 0 },
    { 'EliteProspects', '[[:d:Q10481575|EliteProspects]]', 2481, 'n', 0 },
    { 'EuroTour', '[[PGA European Tour|EuroTour]]', 3521, 'n', 0 },
    { 'Eurohockey', '[[:d:Q108208521|Eurohockey]]', 2601, 'n', 0 },
    { 'Euroleague', '[[Euroliga]]', 3536, 'n', 0 },
    { 'FEI', '[[Federação Equestre Internacional]]', 3111, 'n', 0 },
    { 'FIS-al', '[[Federação Internacional de Esqui|FIS]]', 2772, 'n', 0 },
    { 'FIS-cc', '[[Federação Internacional de Esqui|FIS]]', 2773, 'n', 0 },
    { 'FIS-fs', '[[Federação Internacional de Esqui|FIS]]', 2774, 'n', 0 },
    { 'FIS-jp', '[[Federação Internacional de Esqui|FIS]]', 2775, 'n', 0 },
    { 'FIS-nk', '[[Federação Internacional de Esqui|FIS]]', 2776, 'n', 0 },
    { 'FIS-sb', '[[Federação Internacional de Esqui|FIS]]', 2777, 'n', 0 },
    { 'Fangraphs', '[[Fangraphs]]', 3574, 'n', 0 },
    { 'Footofeminin', '[[:d:Q40776453|Footofeminin]]', 4262, 'n', 0 },
    { 'ForaDeJogo', '[[:d:Q63257321|ForaDeJogo]]', 3046, 'n', 0 },
    { 'Fussballdaten', '[[:en:Fussballdaten.de|Fussballdaten]]', 3538, 'n', 0 },
    { 'FutsalPlanet', 'FutsalPlanet', 3664, 'n', 0 },
    { 'GPI', '[[:en:Global Poker Index|GPI]]', 3564, 'n', 0 },
    { 'HockeyReference', '[[:d:Q28649144|HockeyReference]]', 3598, 'n', 0 },
    { 'Hockeydb', '[[:d:Q19385775|Hockeydb]]', 2602, 'n', 0 },
    { 'IAAF', '[[Associação Internacional de Federações de Atletismo|IAAF]]', 1146, p.iaafLink, 0 },
    { 'ItsRugby', '[[:d:Q28872309|ItsRugby]]', 3769, 'n', 0 },
    { 'JapanTour', '[[Japan Golf Tour|JapanTour]]', 3535, 'n', 0 },
    { 'JudoInside', '[[:d:Q11226978|JudoInside]]', 2767, 'n', 0 },
    { 'Juwra', '[[:d:Q29576307|Juwra]]', 3949, 'n', 0 },
    { 'KHL', '[[Liga Continental de Hóquei|KHL]]', 3652, 'n', 0 },
    { 'LEquipe', '[[L\'Équipe]]', 3665, 'n', 0 },
    { 'LegendsOfHockey', '[[Hockey Hall of Fame|LegendsOfHockey]]', 3567, 'n', 0 },
    { 'MotoGP', '[[MotoGP]]', 3928, 'n', 0 },
    { 'NFT', '[[:d:Q18693731|NFT]]', 2574, 'n', 0 },
    { 'OWGR', '[[Ranking Mundial de Golfe Oficial|OWGR]]', 3568, 'n', 0 },
    { 'OlimpBase', '[[:d:Q631396|OlimpBase]]', 3940, 'n', 0 },
    { 'ProCyclingStats race', '[[:d:Q42398578|ProCyclingStats race]]', 2327, 'n', 0 },
    { 'ProCyclingStats', '[[:d:Q21745613|ProCyclingStats]]', 1663, 'n', 0 },
    { 'ProFootballHoF', '[[Pro Football Hall of Fame|ProFootballHoF]]', 3581, 'n', 0 },
    { 'ProFootballReference', '[[Pro-Football-Reference.com|ProFootballReference]]', 3561, 'n', 0 },
    { 'RacingReference', '[[:d:Q24286051|RacingReference]]', 3048, 'n', 0 },
    { 'Rallye-info', '[[:d:Q29576451|Rallye-info]]', 3930, 'n', 0 },
    { 'SABR', '[[Society for American Baseball Research|SABR]]', 2482, 'n', 0 },
    { 'SCRUM', '[[ESPN|SCRUM]]', 858, 'n', 0 },
    { 'SRCFB', '[[:d:Q101094584|SRCFB]]', 3697, 'n', 0 },
    { 'Scoresway', '[[:d:Q42309113|Scoresway]]', 3043, 'n', 0 },
    { 'Skidb', '[[:d:Q28778400|Ski-db]]', 3619, 'n', 0 },
    { 'SoccerBase', '[[:d:Q21705947|SoccerBase]]', 2193, 'n', 0 },
    { 'SoccerBaseManager', '[[:d:Q21705947|SoccerBase]]', 2195, 'n', 0 },
    { 'Soccerdonna', '[[:d:Q41779610|Soccerdonna]]', 4381, 'n', 0 },
    { 'Soccerway', '[[:d:Q24192203|Soccerway]]', 2369, 'n', 0 },
    { 'SportsReference', '[[Sports Reference]]', 1447, 'n', 0 },
    { 'Swimrankings', '[[:d:Q23439984|Swimrankings]]', 2640, 'n', 0 },
    { 'TennisArchives', '[[:d:Q18015180|TennisArchives]]', 3670, 'n', 0 },
    { 'TennisHoF', '[[International Tennis Hall of Fame|TennisHoF]]', 3363, 'n', 0 },
    { 'TheSports.org', '[[:d:Q21996558|TheSports.org]]', 4391, 'n', 0 },
    { 'Thefinalball', '[[Zerozero|Thefinalball]]', 3047, 'n', 0 },
    { 'WF', '[[:d:Q20773699|Worldfootball]]', 2020, 'n', 0 },
    { 'WSOP', '[[Série Mundial de Pôquer|WSOP]]', 3554, 'n', 0 },
    { 'WorldArchery', '[[Federação Mundial de Tiro com Arco|WorldArchery]]', 3010, 'n', 0 },
    { 'WorldCurlingTour', '[[World Curling Tour|WorldCurlingTour]]', 3556, 'n', 0 },
    { 'WorldSBK', '[[Campeonato Mundial de Superbike|WorldSBK]]', 4076, 'n', 0 },
    { 'databaseFootball', '[[:d:Q19508656|databaseFootball]]', 3532, 'n', 0 },
    { 'ATP', '[[Associação de Tenistas Profissionais|ATP]]', 536, 'n', 0 },
    { 'BDFutbol', '[[BDFutbol]]', 3655, 'n', 0 },
    { 'BWF', '[[Federação Mundial de Badminton|BWF]]', 2729, 'n', 0 },
    { 'BoxRec', '[[BoxRec]]', 1967, 'n', 0 },
    { 'CEE', 'CEE', 4475, 'n', 0 },
    { 'CEV', '[[:es:Confederación Europea de Voleibol|CEV]]', 3725, 'n', 0 },
    { 'COI', '[[Comité Olímpico Internacional|COI]]', 3171, 'n', 0 },
    { 'Copa Davis', '[[Copa Davis]]', 2641, 'n', 0 },
    { 'EPCR', '[[European Professional Club Rugby|EPCR]]', 3666, 'n', 0 },
    { 'Entr. ACB', 'Treinador ACB', 6297, 'n', 0 },
    { 'Euroliga', '[[Euroliga]]', 3536, 'n', 0 },
    { 'FIBA', '[[Federação Internacional de Basquetebol|FIBA]]', 3542, 'n', 0 },
    { 'FIDE', '[[Federação Internacional de Xadrez|FIDE]]', 1440, 'n', 0 },
    { 'FIE', '[[Federação Internacional de Esgrima|FIE]]', 2423, 'n', 0 },
    { 'FIFA', '[[FIFA]]', 1469, 'n', 0 },
    { 'FIG', '[[Federação Internacional de Ginástica|FIG]]', 2696, 'n', 0 },
    { 'FIH', 'FIH', 3742, 'n', 0 },
    { 'FIL', '[[Federação Internacional de Luge|FIL]]', 2990, 'n', 0 },
    { 'FINA', '[[Federação Internacional de Natação|FINA]]', 3408, 'n', 0 },
    { 'FISA', '[[Federação Internacional de Sociedades de Remo|FISA]]', 2091, 'n', 0 },
    { 'FIVB', '[[Federação Internacional de Voleibol|FIVB]]', 2801, 'n', 0 },
    { 'Fed Cup', '[[Copa Billie Jean King|Fed Cup]]', 2642, 'n', 0 },
    { 'FootballDatabase', '[[FootballDatabase]]', 3537, 'n', 0 },
    { 'IBSF', 'IBSF', 2991, 'n', 0 },
    { 'IBU', '[[União Internacional de Biatlo|IBU]]', 2459, 'n', 0 },
    { 'ICF', 'ICF', 3689, 'n', 0 },
    { 'IFSC', 'IFSC', 3690, 'n', 0 },
    { 'IJF', '[[Federação Internacional de Judo|IJF]]', 4559, 'n', 0 },
    { 'IOF', 'IOF', 3672, 'n', 0 },
    { 'ISHOF', '[[International Swimming Hall of Fame|ISHOF]]', 3691, 'n', 0 },
    { 'ISSF', '[[Federação Internacional de Tiro Desportivo|ISSF]]', 2730, 'n', 0 },
    { 'ISU', '[[União Internacional de Patinagem|ISU]]', 2694, 'n', 0 },
    { 'ITF', '[[Federação Internacional de Ténis|ITF]]', 599, 'n', 0 },
    { 'ITHF', '[[Salão da Fama do Ténis|ITHF]]', 3363, 'n', 0 },
    { 'ITTF', '[[Federação Internacional de Tenis de Mesa|ITTF]]', 1364, 'n', 0 },
    { 'ITU', '[[União Internacional de Triatlo|ITU]]', 3604, 'n', 0 },
    { 'IWF', 'IWF', 3667, 'n', 0 },
    { 'LPGA', '[[LPGA]]', 2810, 'n', 0 },
    { 'Liga Diamante', '[[Liga de Diamante]]', 3923, 'n', 0 },
    { 'MLB', '[[Grandes Ligas|MLB]]', 3541, 'n', 0 },
    { 'NBA', '[[NBA]]', 3647, 'n', 0 },
    { 'NFL', '[[National Football League|NFL]]', 3539, 'n', 0 },
    { 'NHL', '[[National Hockey League|NHL]]', 3522, 'n', 0 },
    { 'NLL', '[[National Lacrosse League|NLL]]', 3955, 'n', 0 },
    { 'NSK', 'NSK', 3385, 'n', 0 },
    { 'PGA', '[[Professional Golfers Association of America|PGA]]', 2811, 'n', 0 },
    { 'Sherdog', '[[Sherdog]]', 2818, 'n', 0 },
    { 'Transfermarkt', '[[Transfermarkt]]', 2446, 'n', 0 },
    { 'UEFA', '[[UEFA]]', 2276, 'n', 0 },
    { 'UIPM', 'UIPM', 2726, 'n', 0 },
    { 'WAF', '[[Federação Internacional de Tiro com Arco|WAF]]', 3010, 'n', 0 },
    { 'WCF', '[[Federação Mundial de Curling|WCF]]', 3557, 'n', 0 },
    { 'WNBA', '[[WNBA]]', 3588, 'n', 0 },
    { 'WWE', '[[WWE]]', 2857, 'n', 0 },
    { 'World Athletics', '[[World Athletics]]', 1146, 'n', 0 },
    { 'WTA', '[[Associação de Tênis Feminino|WTA]]', 597, 'n', 0 },
    },
    },
    {
    title = 'Cinema',
    group = {
    { 'ISFDB', '[[Internet Speculative Fiction Database|ISFDB]]', 1274, 'n', 1 },

    { 'AFDb', '[[Adult Film Database|AFDb]]', 3351, 'n', 0 },
    { 'ANNPerson', '[[Anime News Network|ANN (pessoa)]]', 1982, 'n', 0 },
    { 'Allcinema pessoa', '[[:ja:Allcinema|Allcinema]]', 7214, 'n', 0 },
    { 'Allmovie', '[[AllMovie]]', 1562, 'n', 0 },
    { 'AllmovieArtist', '[[AllMovie]]', 2019, 'n', 0 },
    { 'RottenTomatoes', '[[Rotten Tomatoes]]', 1258, 'n', 0 },
    { 'AFI', '[[American Film Institute|AFI]]', 3593, 'n', 0 },
    { 'ANNAnime', '[[Anime News Network|ANN (animé)]]', 1985, 'n', 0 },
    { 'ANNCompany', '[[Anime News Network|ANN (empresa)]]', 1983, 'n', 0 },
    { 'ANNManga', '[[Anime News Network|ANN (mangá)]]', 1984, 'n', 0 },
    { 'AdoroCinema', '[[AdoroCinema]]', 7777, 'n', 0 },
    { 'AlloCineFilm', '[[AlloCiné]]', 1265, 'n', 0 },
    { 'AlloCinePerson', '[[AlloCiné]]', 1266 , 'n', 0 },
    { 'AlloCineSeries', '[[AlloCiné]]', 1267, 'n', 0 },
    { 'AnimeClick anime', '[[:it:AnimeClick.it|AnimeClick.it (animé)]]', 5845, 'n', 0 },
    { 'AnimeClick drama', '[[:it:AnimeClick.it|AnimeClick.it (drama)]]', 5860, 'n', 0 },
    { 'AnimeClick mangá', '[[:it:AnimeClick.it|AnimeClick.it (mangá)]]', 5849, 'n', 0 },
    { 'AnimeClick personagem', '[[:it:AnimeClick.it|AnimeClick.it (personagem)]]', 5847, 'n', 0 },
    { 'AnimeClick pessoa', '[[:it:AnimeClick.it|AnimeClick.it (pessoa)]]', 5848, 'n', 0 },
    { 'AnimeClick romance', '[[:it:AnimeClick.it|AnimeClick.it (romance)]]', 5846, 'n', 0 },
    { 'BoxOfficeMojoFilm', '[[Box Office Mojo|BO Mojo]]', 1237, 'n', 0 },
    { 'BoxOfficeMojoFranchise', '[[Box Office Mojo|BO Mojo]]', 2530, 'n', 0 },
    { 'BoxOfficeMojoPerson', '[[Box Office Mojo|BO Mojo]]', 2688, 'n', 0 },
    { 'BoxOfficeMojoStudio', '[[Box Office Mojo|BO Mojo]]', 2531, 'n', 0 },
    { 'Cinecartaz filme', '[[Público (jornal)|Cinecartaz]]', 10454, 'n', 0 },
    { 'CinePT filme', '[[Universidade da Beira Interior|CinePT]]', 7593, 'n', 0 },
    { 'CinePT pessoa', '[[Universidade da Beira Interior|CinePT]]', 7594, 'n', 0 },
    { 'CineRessourcesFilm', '[[Cinémathèque Française|CineRessources]]', 3203, 'n', 0 },
    { 'CineRessourcesPerson', '[[Cinémathèque Française|CineRessources]]', 3204, 'n', 0 },
    { 'CinemaTreasures', '[[:d:Q46832933|CinemaTreasures]]', 4129, 'n', 0 },
    { 'Cinenacional.com filme', '[[:es:Cinenacional.com|Cinenacional.com]]', 3851, 'n', 0 },
    { 'Cinenacional.com pessoa', '[[:es:Cinenacional.com|Cinenacional.com]]', 3857, 'n', 0 },
    { 'Cineuropa filme', '[[:d:Q30055831|Cineuropa]]', 5791, 'n', 0 },
    { 'Cineuropa pessoa', '[[:d:Q30055831|Cineuropa]]', 6083, 'n', 0 },
    { 'DFI filme', '[[:da:Filmdatabasen|Filmdatabasen]]', 1804, 'n', 0 },
    { 'DFI pessoa', '[[:da:Filmdatabasen|Filmdatabasen]]', 2626, 'n', 0 },
    { 'DanskeFilmStemmer.dk', '[[:d:Q63613201|DanskeFilmStemmer.dk]]', 6777, 'n', 0 },
    { 'Deutsche Synchronkartei film', '[[:de:Deutsche Synchron|Deutsche Synchron]]', 3844, 'n', 0 },
    { 'Disney A to Z', '[[:en:Disney A to Z|Disney A-Z]]', 6181, 'n', 0 },
    { 'Disney+', '[[Disney+]]', 7595, 'n', 0 },
    { 'Eiga.com filme', '[[:ja:映画.com|Eiga.com]]', 7222, 'n', 0 },
    { 'Eiga.com pessoa', '[[:ja:映画.com|Eiga.com]]', 7215, 'n', 0 },
    { 'FilmPortal', '[[:de:Filmportal.de|FilmPortal]]', 2639, 'y', 0 },
    { 'HanCinema drama', '[[HanCinema]]', 5091, 'n', 0 },
    { 'HanCinema filme', '[[HanCinema]]', 5108, 'n', 0 },
    { 'HanCinema pessoa', '[[HanCinema]]', 3045, 'n', 0 },
    { 'IAFDf', '[[Internet Adult Film Database|IAFD-f]]', 3869, 'n', 0 },
    { 'IAFDm', '[[Internet Adult Film Database|IAFD-m]]', 4505, 'n', 0 },
    { 'JMDb filme', '[[Japanese Movie Database]]', 2400, 'n', 0 },
    { 'JMDb pessoa', '[[Japanese Movie Database]]', 3703, 'n', 0 },
    { 'KMDb documentário', '[[Korean Movie Database]]', 3750, 'n', 0 },
    { 'KMDb filme', '[[Korean Movie Database]]', 3704, 'n', 0 },
    { 'KMDb pessoa', '[[Korean Movie Database]]', 1649, 'n', 0 },
    { 'Kinenote filme', '[[:ja:キネマ旬報映画データベース|Kinenote]]', 2508, 'n', 0 },
    { 'Kinenote pessoa', '[[:ja:キネマ旬報映画データベース|Kinenote]]', 3305, 'n', 0 },
    { 'Letterboxd', '[[Letterboxd]]', 6127, 'n', 0 },
    { 'Movie Walker filme', '[[:ja:Movie Walker|Movie Walker]]', 2509, 'n', 0 },
    { 'Movie Walker pessoa', '[[:ja:Movie Walker|Movie Walker]]', 7745, 'n', 0 },
    { 'Moviepilot.de film', '[[Moviepilot]]', 5786, 'n', 0 },
    { 'Netflix', '[[Netflix]]', 1874, 'n', 0 },
    { 'TCM film ID', '[[Turner Classic Movies|TCM]]', 2631, 'n', 0 },
    { 'TMDb', '[[The Movie Database|TMDb]]', 4947, 'n', 0 },
    { 'Óscar', '[[Óscar]]', 6145, 'n', 0 },
    { 'AllMovie', '[[AllMovie]]', 1562, 'n', 0 },
    { 'Allcinema filme', '[[:ja:Allcinema|Allcinema]]', 2465, 'n', 0 },
    { 'AlloCiné', '[[AlloCiné]]', 1265, 'n', 0 },
    { 'BFI', '[[British Film Institute|BFI]]', 2703, 'n', 0 },
    { 'Box Office Mojo', '[[Box Office Mojo]]', 1237, 'n', 0 },
    { 'CineChile', 'CineChile', 6750, 'url', 0 },
    { 'FilmAffinity', '[[FilmAffinity]]', 480, 'n', 0 },
    { 'ICAA película', 'ICAA', 5128, 'n', 0 },
    --{ 'IMDB', '[[Internet Movie Database|IMDB]]', 345, 'n', 1 },
    },
    },
    {
    title = 'Empresários',
    group = {
    { 'Bloomberg', '[[Bloomberg L.P.|Bloomberg]]', 3052, 'n', 0 },
    { 'Crunchbase', '[[Crunchbase]]', 2087, 'n', 0 },
    { 'Lattes', '[[Plataforma Lattes|CV-Lattes]]', 1007, 'n', 0 },
        },
    },
    {
    title = 'Informática',
    group = {
    { 'AUR', 'AUR', 4162, 'n', 0 },
    { 'Arch', 'Arch Linux', 3454, 'n', 0 },
    { 'Debian', 'Debian', 3442, 'n', 0 },
    { 'FSD', 'Free Software Directory', 2537, 'n', 0 },
    { 'Fedora', 'Fedora', 3463, 'n', 0 },
    { 'Gentoo', 'Gentoo', 3499, 'n', 0 },
    { 'OpenHub', 'Open Hub', 1972, 'n', 0 },
    { 'PyPI', '[[PyPI]]', 5568, 'n', 0 },
    { 'Snap', 'Snap', 4435, 'n', 0 },
    { 'TOP500', 'TOP500', 7307, 'n', 0 },
    { 'Ubuntu', 'Ubuntu', 3473, 'n', 0 },
        }
    },
    {
    title = 'Bases de dados taxonómicas',
    group = {
    { 'LepIndex', '[[Museu de História Natural de Londres#The Global Lepidoptera Names Index|LepIndex]]', 3064, 'n', 1},
    { 'Botanist', 'L.', 428, p.botanistLink, 0 },
    { 'APNI', '[[Australian Plant Name Index|APNI]]', 5984, 'n', 0 },
    { 'CMS', '[[Convenção de Bona|CMS]]', 6033, 'url', 0 },
    { 'IRMNG', 'IRMNG', 5055, 'n', 0 },
    { 'NBN', '[[National Biodiversity Network|NBN]]', 3240, 'n', 1 },
    { 'Reptile DB', '[[The Reptile Database|Reptile DB]]', 5473, 'url', 0 },
    { 'ScaleNet', '[[:d:Q61686004|ScaleNet]]', 6516, 'n', 0 },
    { 'SeaLifeBase', '[[:en:SeaLifeBase|SeaLifeBase]]', 6018, 'n', 0 },
    { 'SPRAT', '[[Species Profile and Threats Database|SPRAT]]', 2455, 'n', 0 },
    --{ 'TAXREF', '[[:d:Q26924544|TAXREF]]', 3186, 'n', 1 },
    --{ 'TelaBotanica', '[[Tela Botanica]]', 3105, 'n', 1 },
    { 'Titan', '[[:d:Q59801025|Titan]]', 4125, 'n', 0 },
    { 'Tree of Life', '[[:en:Tree of Life Web Project|Tree of Life]]', 5221, 'n', 0 },
    { 'VicFlora', '[[:d:Q58380943|VicFlora]]', 5945, 'n', 0 },
    --{ 'Vlindernet', '[[:d:Q24053150|Vlindernet]]', 3322, 'n', 0 },
    { 'WCSPF', '[[World Checklist of Selected Plant Families|WCSPF]]', 3591, 'n', 1 },
    { 'BugGuide', '[[BugGuide]]', 2464, 'n', 1 },
    { 'ABA', '[[American Birding Association|ABA]]', 4526, 'n', 0 },
    { 'AFD', '[[Australian Faunal Directory|AFD]]', 6039, 'n', 0 },
    { 'AfroMoths', 'AfroMoths', 6093, 'n', 0 }, ---[[AfroMoths]] DNE as of 4/2021
    { 'AntWeb', '[[AntWeb]]', 5299, 'n', 0 },
    { 'AoI', 'AoI', 5003, 'n', 0 }, ---[[Amphibians of India]] DNE as of 4/2021
    { 'AoFP', 'AoFP', 6159, 'n', 0 }, ---[[Atlas of Florida Plants]] DNE as of 4/2021
    { 'APA', 'APA', 6137, 'n', 0 }, ---[[Alabama Plant Atlas]] DNE as of 4/2021
    { 'APSA', 'APSA', 2809, 'n', 0 }, ---[[Australasian Pollen and Spore Atlas]] DNE as of 4/2021
    { 'Araneae', 'Araneae', 3594, 'n', 0 }, ---[[]] DNE as of 4/2021
    { 'ARKive', '[[ARKive]]', 2833, 'n', 0 },
    { 'ASW', '[[Amphibian Species of the World|ASW]]', 5354, 'n', 0 },
    { 'ATRF', '[[Australian Tropical Rainforest Plants|ATRF]]', 6904, 'n', 0 },
    { 'AusFungi', '[[Australian online fauna & flora databases|AusFungi]]', 9076, 'n', 0 },
    { 'AusLichen', '[[Australian online fauna & flora databases|AusLichen]]', 9093, 'n', 0 },
    { 'BacDive', '[[BacDive]]', 2946, 'n', 0 },
     { 'Bamona', 'BAMONA', 3398, 'n', 0 }, ---[[Butterflies and Moths of North America]] DNE as of 4/2021
     { 'BirdLife-Australia', '[[BirdLife Australia|BirdLife-Australia]]', 6040, 'n', 0 },
     { 'BTO', '[[British Trust for Ornithology|BTO]]', 4798, 'n', 0 }, -- BTO Birds of Britain ID (links to page that includes the code)
     --  { 'BTO', '[[British Trust for Ornithology|BTO]]', 4567, 'n', 0 }, -- BTO five-letter code (no link)
     { 'ButMoth', 'ButMoth', 3060, 'n', 0 },
     { 'Calflora', 'Calflora', 3420, 'n', 0 }, ---[[]] DNE as of 4/2021
     { 'Cal-IPC', 'Cal-IPC', 6176, 'n', 0 }, ---[[California Invasive Plant Council]] DNE as of 4/2021
     { 'Center', '[[Center for Biological Diversity|Center]]', 6003, 'n', 0 },
     { 'CNPS', '[[California Native Plant Society|CNPS]]', 4194, 'n', 0 },
     { 'Cockroach Species File', 'Cockroach Species File', 6052, 'n', 0 }, ---[[]] DNE as of 4/2021
     { 'Conifers', 'Conifers.org', 1940, 'n', 0 }, ---[[]] DNE as of 4/2021
     { 'Coreoidea Species File', 'Coreoidea Species File', 6053, 'n', 0 }, ---[[]] DNE as of 4/2021
     { 'bow', 'BOW', 3444, 'n', 0 },  -- Birds of the World uses eBird identifier (a { 'Ecocrop', '[[Ecocrop]]', 4753, 'n', 0 },
     { 'ECOS', 'ECOS', 6030, 'n', 0 }, ---[[Environmental Conservation Online System]] DNE as of 4/2021
     { 'eFloraSA', '[[State Herbarium of South Australia|eFloraSA]]', 6933, 'n', 0 },
     { 'EPPO', '[[EPPO Code|EPPO]]', 3031, 'n', 0 },
     { 'Euring', 'Euring', 3459, 'n', 0 }, ---[[Euring number]] DNE as of 4/2021
     { 'FaunaEuropaeaNew', '[[Fauna Europaea|Fauna Europaea (new)]]', 4807, 'n', 0 },
     { 'FEIS', 'FEIS', 6044, 'n', 0 }, ---[[Fire Effects Information System]] DNE as of 4/2021
     { 'FLOW', 'FLOW', 6096, 'n', 0 }, ---[[Fulgoromorpha Lists On the Web]] DNE as of 4/2021
     { 'FaunaNA', '[[Flora of North America|FNA]]', 1727, 'n', 0 },
     { 'FoAO', '[[Flora of Australia|FoAO]]', 3100, 'n', 0 }, --old
     { 'FoAO2', '[[Flora of Australia|FoAO2]]', 6756, 'n', 0 }, --new
     { 'FoIO', 'FoIO', 3795, 'n', 0 }, ---[[Flora of Israel Online]] DNE as of 4/2021, he.wiki link interferes with display
     { 'GISD', '[[Global Invasive Species Database|GISD]]', 5626, 'n', 0 },
     { 'GNAB', 'GNAB', 4715, 'n', 0 }, ---[[Guide to North American Birds]] DNE as of 4/2021
     { 'GONIAT', 'GONIAT', 5216, 'n', 0 }, ---[[]] DNE as of 4/2021
     { 'GrassBase', '[[GrassBase]]', 1832, 'n', 0 },

    --{ 'WikiAves', '[[:d:Q45892814|Wiki Aves]]', 4664, 'n', 0 },
    { 'ADW', '[[Animal Diversity Web (identificador)|ADW]]', 4024, 'url', 1 },
    { 'APD', 'African Plant DB', 2036, 'n', 'APDB' },
    { 'Algabase', '[[AlgaeBase]]', 1348, 'n', 0 },
    { 'AmphibiaWeb', 'AmphibiaWeb', 5036, 'n', 0 },
    { 'Avibase', 'Avibase', 2026, 'url', 0 },
    { 'BHL', '[[Biodiversity Heritage Library|BHL]]', 687, 'n', 0 },
    { 'BOLD', 'BOLD', 3606, 'n', 0 },
    { 'BioLib', 'BioLib', 838, 'n', 1 },
    { 'BirdLife', '[[Birdlife International|BirdLife]]', 5257, 'n', 0 },
    { 'CONABIO', 'CONABIO', 4902, 'n', 0 },
    { 'CatalogueOfLife', '[[Catalogue of Life]]', 3088, 'n', 0 },
    { 'Dyntaxa', 'Dyntaxa', 1939, 'n', 1 },
    { 'EOL', '[[Enciclopédia da Vida|EOL]]', 830, 'n', 1 },
    { 'EUNIS', 'EUNIS', 6177, 'n', 0 },
    { 'FOC', '[[Flora of China|Fl. China]]', 1747, 'n', 'FoC' },
    { 'FaunaEuropaea', '[[Fauna Europaea]]', 1895, 'n', 'FE' },
    { 'FishBase', '[[FishBase]]', 938, 'n', 0 },
    { 'FloraBase', 'FloraBase', 3101, 'n', 1 },
    { 'FossilWorks', '[[Paleobiology Database]]', 842, 'n', 0 },
    { 'GBIF', '[[GBIF]]', 846, 'n', 1 },
    { 'GRIN', '[[:es:Germplasm Resources Information Network|GRIN]]', 1421, 'url', 0 },
    { 'GlobalSpecies', 'GlobalSpecies', 6433, 'n', 0 },
    { 'IBC', '[[:es:Internet Bird Collection|IBC]]', 3099, 'n', 0 },
    { 'IOBIS', 'OBIS', 6754, 'n', 0 },
    { 'IPNI', '[[Índice Internacional de Nomes de Plantas|IPNI]]', 961, 'n', 0 },
    { 'ITIS', '[[SITI|ITIS]]', 815, p.ITISLink, 1 },
    { 'IndexFungorum', '[[Index Fungorum]]', 1391, 'n', 0 },
    { 'LPSN', 'LPSN', 1991, 'url', 0 },
    { 'MSW', '[[Mammal Species of the World|MSW]]', 959, 'n', 0 },
    { 'MycoBank', '[[MycoBank]]', 962, 'n', 0 },
    { 'NCBI', '[[Centro Nacional para a Informação Biotecnológica|NCBI]]', 685, 'n', 0 },
    { 'PlantList', '[[The Plant List (identificador)|PlantList]]', 1070, 'n', 1 },
    { 'SpeciesPlus', 'Species+', 2040, 'n', 'Species+' },
    { 'Taxonomicon', 'Taxonomicon', 7066, 'n', 0 },
    { 'Tropicos', 'W3TROPICOS', 960, 'n', 0 },
    { 'UICN', '[[UICN]]', 627, 'n', 'IUCN' },
    { 'USDAP', '[[Departamento de Agricultura dos Estados Unidos|USDA Plants]]', 1772, 'n', 'USDAPLANTS' },
    { 'VASCAN', 'VASCAN', 1745, 'n', 1 },
    { 'WoRMS', '[[Registo Mundial de Espécies Marinhas|WoRMS]]', 850, 'n', 1 },
    { 'Xeno-canto', 'Xeno-canto', 2426, 'url', 0 },
    { 'Zoobank', '[[ZooBank|Zoobank]]', 1746, 'n', 0 },
    { 'eBird', '[[eBird (identificador)|eBird]]', 3444, 'url', 0 },
    { 'iNaturalist', '[[iNaturalist (identificador)|iNaturalist]]', 3151, 'n', 1 },
    { 'uBio', 'uBio', 4728, 'n', 0 },
    },
    },
    {
    title = 'Identificadores médicos',
    group = {
    { 'DTXSID', '[[:d:Q54774134|DTXSID]]', 3117, 'n', 0 },
    { 'EC', '[[Número EC|EC]]', 591, 'n', 0 },
    { 'ECHA', '[[:d:Q59911453|ECHA]]', 2566, 'n', 0 },
    { 'Ensembl', '[[Ensembl]]', 594, 'n', 0 },
    { 'GARD', '[[:d:Q47517289|GARD]]', 4317, 'n', 0 },
    { 'GPnotebook', '[[:en:GPnotebook|GPnotebook]]', 3720, 'n', 0 },
    { 'HGNC', '[[HGNC]]', 354, 'n', 0 },
    { 'HMDB', '[[:en:Human Metabolome Database|HMDB]]', 2057, 'n', 0 },
    { 'HPO', '[[:en:Human Phenotype Ontology|HPO]]', 3841, 'n', 0 },
    { 'IEDB', '[[Banco de Dados de Epítopos Imunes e Recurso de Análise|IEDB]]', 4168, 'n', 0 },
    { 'InterPro', '[[InterPro]]', 2926, 'n', 0 },
    { 'IUPHAR', '[[União Internacional de Farmacologia Básica e Clínica|IUPHAR]]', 595, 'n', 0 },
    { 'KNApSAcK', '[[:d:Q20900436|KNApSAcK]]', 2064, 'n', 0 },
    { 'MeSHcode', '[[MeSH]]', 672, 'n', 0 },
    { 'NCIt', '[[:d:Q19404626|NCIt]]', 1748, 'n', 0 },
    { 'NDF-RT', '[[:d:Q21008030|NDF-RT]]', 2115, 'n', 0 },
    { 'NeuroLex', '[[:en:NeuroLex|NeuroLex]]', 696, 'n', 0 },
    { 'NIOSH', '[[National Institute for Occupational Safety and Health|NIOSH]]', 1931, 'n', 0 },
    { 'Patientplus', '[[:en:Patient UK|Patientplus]]', 1461, 'n', 0 },
    { 'Pfam', '[[Pfam]]', 3519, 'n', 0 },
    { 'PubChemSID', '[[PubChem]]', 2153, 'n', 0 },
    { 'PubMed', '[[PubMed]]', 653, 'n', 0 },
    { 'RefSeq', '[[:en:RefSeq|RefSeq]]', 637, 'n', 0 },
    { 'RefSeqRNA', '[[:en:RefSeq|RefSeq]]', 639, 'n', 0 },
    { 'RxNorm', '[[:en:RxNorm|RxNorm]]', 3345, 'n', 0 },
    { 'Uberon', '[[Uberon]]', 1554, 'n', 0 },
    
    { 'DeCS', '[[Descritores em Ciências da Saúde|DeCS]]', 9272, 'n', 0 },
    { 'DOID', 'DOID', 699, 'n', 0 },
    { 'CIE9', '[[CIE-9]]', 493, 'n', 0 },
    { 'CIE10', '[[CIE-10]]', 494, 'n', 0 },
    { 'CIE9MC', '[[CIE-9-MC]]', 1692, 'n', 0 },
    { 'CIE10MC', 'CIE-10-MC', 4229, 'n', 0 },
    { 'CIEO', '[[CIE-O]]', 563, 'n', 0 },
    { 'CIAP2', '[[Classificação Internacional de Atenção Primária|CIAP-2]]', 667, 'n', 0 },
    { 'OMIM', '[[:es:Herencia Mendeliana en el Hombre|OMIM]]', 492, 'n', 0 },
    { 'DSM IV', '[[:es:Manual diagnóstico y estadístico de los trastornos mentales|DSM IV]]', 663, 'n', 0 },
    { 'DSM 5', '[[DSM 5|DSM-5]]', 1930, 'n', 0 },
    { 'DiseasesDB', '[[Diseases Database|DiseasesDB]]', 557, 'n', 0 },
    { 'MedlinePlus', '[[MedlinePlus]]', 604, 'n', 0 },
    { 'eMedicine', '[[eMedicine]]', 673, 'n', 0 },
    { 'MeSH', '[[MeSH]]', 486, 'n', 0 },
    { 'MeSHdq', 'MeSH D/Q', 9340, 'y', 0 },
    
    { 'Orphanet', '[[Orphanet]]', 1550, 'n', 0 },
    { 'TA98', '[[Terminologia Anatómica|TA]]', 1323, p.ta98Link, 0 },
    { 'FMA', '[[Foundational Model of Anatomy|FMA]]', 1402, 'n', 0 },
    { 'UMLS', 'UMLS', 2892, 'n', 0 },
    { 'GeneReviews', 'GeneReviews', 668, 'n', 0 },
    { 'NumE', '[[Número E]]', 628, 'n', 0 },
    }
    },
    {
    title = 'Identificadores químicos',
    group = {
    { 'CAS', '[[CAS]]', 231, 'n', 0 },
    { 'EINECS', '[[EINECS|Números EINECS]]', 232, 'n', 0},
    { 'ATC', '[[Código ATC]]', 267, 'n', 0 },
    { 'RTECS', '[[RTECS]]', 657, 'n', 0 },
    { 'ChEBI', '[[ChEBI]]', 683, 'n', 0 },
    { 'ChEMBL', '[[ChEMBL]]', 592, 'n', 0 },
    { 'ChemSpider', '[[ChemSpider]]', 661, 'n', 0 },
    { 'DrugBank', '[[DrugBank]]', 715, 'n', 0 },
    { 'PubChem', '[[Pubchem]]', 662, 'n', 0 },
    { 'UNII', '[[Unique Ingredient Identifier|UNII]]', 652, 'n', 0 },
    { 'KEGG', '[[KEGG]]', 665, 'n', 0 },
    { 'SMILES', '[[Simplified molecular input line entry specification|SMILES]]', 233, 'y', 0 },
    { 'InChI', 'InChI', 234, 'y', 0 },
    { 'InChIKey', 'InChI key', 235, 'y', 0 },
    }
    },
    {
    title = 'Identificadores biológicos',
    group = {
    { 'MGI', 'MGI', 231, 'n', 0 },
    { 'HomoloGene', '[[HomoloGene]]', 593, 'n', 0 },
    { 'UniProt', '[[UniProt]]', 352, 'n', 0 },
    }
    },
    {
    title = 'Identificadores astronómicos',
    group = {
    { 'ARINCS', '[[:d:Q4033069|ARINCS]]', 999, 'n', 0 },
    { 'COSPAR', 'COSPAR', 247, 'n', 0 },
    { 'SCN', '[[Satellite Catalog Number|SCN]]', 377, 'n', 0 },
    { 'NSSDCA', 'NSSDCA', 8913, 'n', 0 },

    { 'GazPlaNom', 'Gazetteer of Planetary Nomenclature', 2824, 'n', 0 },
    { 'JPL-Small-Body-Database', '[[JPL Small-Body Database|JPL]]', 716, 'n', 0 },
    { 'MPC', '[[:es:Centro de Planetas Menores|MPC]]', 5736, 'n', 0 },
    { 'NASA-Exoplanet-Archive', '[[NASA Exoplanet Archive]]', 5667, 'n', 0 },
    { 'Simbad', '[[SIMBAD]]', 3083, 'n', 0 },
    }
    },
    {
    title = 'Ontologias',
    group = {
    { 'IEV', 'Número IEV', 8855, 'n', 0 },
    { 'OUM2', 'OUM 2.0', 8769, 'n', 0 },
    { 'CWGC', 'CWGC', 1908, p.cwgcLink, 0 }
    }
    }
}
-- -- Example row: --
-- conf.databases[2] = {}
-- conf.databases[2].name = 'External links'
-- conf.databases[2].list = {
--     {
--         title = '',
--         group = {
--     { 'Website', 'Website', 856, 'n', 0 },
--         },
--     },
-- }

--In this order: alternate name, name of parameter from databases table
conf.aliases = {
    { 'Wd', 'Wikidata' },
    { 'PND', 'GND' },
    { 'Commonscat', 'Commons' },
}

function p.getCatForId( parameter, category )
    local title = mw.title.getCurrentTitle()
    local namespace = title.namespace
    if category == 0 then
        return ''
    elseif category == 1 then
        category = parameter
    end
    if namespace == 0 then
        return '[[Categoria:!Artigos enciclopédicos com identificadores ' .. category .. ']]\n'
    --elseif namespace == 2 and not title.isSubpage then
    --    return '[[!Páginas de usuário com identificadores ' .. category .. ']]\n'
    else
    --    return '[[Categoria:!Páginas de teor misto com identificadores ' .. category .. ']]\n'
          return ''
    end
end

function p.createRow( id, label, rawValue, link, withUid )
    if link then
        if label and label ~= '' then label = '<span style="white-space:nowrap;">'..label  .. ':</span> ' end
        if withUid then
            return '* ' .. label .. '<span class="uid">' .. link .. '</span>\n'
        else
            return '* ' .. label .. link .. '\n'
        end
    else
        return '* <span class="error">O ' .. id .. ' id ' .. rawValue .. ' não é válido</span>[[Categoria:!Páginas com problemas em controle de autoridade]]\n'
    end
end

local function copyTable(inTable)
    if type(inTable) ~= 'table' then return inTable end
    local outTable = setmetatable({}, getmetatable(inTable))
    for key, value in pairs (inTable) do outTable[copyTable(key)] = copyTable(value) end
    return outTable
end

function p.splitLccn( id )
    --P244's format regex: (n|nb|nr|no|ns|sh)([4-9][0-9]|00|20[0-1][0-9])[0-9]{6} (e.g. n78039510)
    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

function p.authorityControl( frame )
    local pArgs = frame:getParent().args
    local parentArgs = copyTable(pArgs)
    local stringArgs = false
    local fromForCount, itemCount, rowCount = 1, 0, 0
    local mobileContent = ''
    local title = mw.title.getCurrentTitle()
    local namespace = title.namespace
    --Cleanup args
    for k, v in pairs( pArgs ) do
        if type(k) == 'string' then
            --make args case insensitive
            local lowerk = mw.ustring.lower(k)
            if not parentArgs[lowerk] or parentArgs[lowerk] == '' then
                parentArgs[lowerk] = v
                parentArgs[k] = nil
            end
            --remap abc to abc1
            if not mw.ustring.find(lowerk, '%d$') then --if no number at end of param
                if not parentArgs[lowerk..'1'] or parentArgs[lowerk..'1'] == '' then
                    parentArgs[lowerk..'1'] = v
                    parentArgs[lowerk] = nil
                end
            end
            if v and v ~= '' then
                --find highest from param
                if mw.ustring.sub(lowerk,1,4) == 'from' then
                    local fromNumber = tonumber(mw.ustring.sub(lowerk,5,-1))
                    if fromNumber and fromNumber >= fromForCount then fromForCount = fromNumber end
                elseif mw.ustring.sub(lowerk,1,3) == 'for' then
                    local forNumber = tonumber(mw.ustring.sub(lowerk,4,-1))
                    if forNumber and forNumber >= fromForCount then fromForCount = forNumber end
                elseif mw.ustring.lower(v) ~= 'no' and lowerk ~= 'for' then
                    stringArgs = true
                end
            end
        end
    end

    --Setup navbox
    local navboxParams = {
        name  = 'Controle de autoridade',
    bodyclass = 'hlist',
        groupstyle = 'width: 12%; text-align:center;',
    }
    for f = 1, fromForCount, 1 do
        local title = {}
        --cleanup parameters
        if parentArgs['from'..f] == '' then parentArgs['from'..f] = nil end
        if parentArgs['for'..f] == '' then parentArgs['for'..f] = nil end
        --remap aliases
        for _, a in pairs( conf.aliases ) do
            local alias, name = mw.ustring.lower(a[1]), mw.ustring.lower(a[2])
            if parentArgs[alias..f] and not parentArgs[name..f] then
                parentArgs[name..f] = parentArgs[alias..f]
                parentArgs[alias..f] = nil
            end
        end

        --Fetch Wikidata item
        local itemId = parentArgs['from'..f] or mw.wikibase.getEntityIdForCurrentPage()
        local label = itemId and (mw.wikibase.getSitelink(itemId) or mw.wikibase.getLabel(itemId)) or ''
        if label and label ~= '' then
            title = mw.title.new(label)
            if not title then title = mw.title.getCurrentTitle() end
        else
            title = mw.title.getCurrentTitle()
        end

        if (not parentArgs['wikidata'..f] or parentArgs['wikidata'..f] == '') and (title.namespace == 0 or title.namespace == 104) then
            parentArgs['wikidata'..f] = parentArgs['from'..f] or itemId or ''
        end
        if title.namespace == 0 or title.namespace == 104 or stringArgs then --Only in the main namespaces or if there are manual overrides

            if fromForCount > 1 and #conf.databases > 1 then
                if parentArgs['for'..f] and parentArgs['for'..f] ~= '' then
                    navboxParams['list'..(rowCount + 1)] = "'''" .. parentArgs['for'..f] .. "'''"
                else
                    navboxParams['list'..(rowCount + 1)] = "'''" .. title.text .. "'''"
                end
                navboxParams['list'..(rowCount + 1)..'style'] = 'background-color: #ddf;'
                rowCount = rowCount + 1
            end
            for _, db in pairs( conf.databases ) do
                if db.list and #db.list > 0 then
                    local listElements = {}
                    for n, gr in pairs( db.list ) do
                        local groupElements = {}
                        if gr.group and #gr.group > 0 then
                            for _, params in pairs( gr.group ) do
                                local id = mw.ustring.lower( params[1] )
                                -- Wikidata fallback if requested
                                if itemId and params[3] ~= 0 and (not parentArgs[id..f] or parentArgs[id..f] == '') then
                                    local wikidataIds = {}
                                    if type( params[3] ) == 'function' then
                                        wikidataIds = params[3]( itemId )
                                    elseif type( params[3] ) == 'string' then
                                        wikidataIds = p.getIdsFromSitelinks(itemId, params[3] )
                                    else
                                        wikidataIds = p.getIdsFromWikidata( itemId, 'P' .. params[3] )
                                    end
                                    if wikidataIds[1] then
                                        parentArgs[id..f] = wikidataIds[1]
                                    end
                                end
                                -- Worldcat
                                if id == 'issn' and parentArgs['worldcatid'..f] and parentArgs['worldcatid'..f] ~= '' then -- 'issn' is the first element following the 'wikidata' item
                                    table.insert( groupElements, p.createRow( id, '', parentArgs['worldcatid'..f], '[//www.worldcat.org/identities/' .. parentArgs['worldcatid'..f] .. ' WorldCat]', false ) ) --Validation?
                                elseif id == 'viaf' and parentArgs[id..f] and string.match( parentArgs[id..f], '^%d+$' ) and not parentArgs['worldcatid'..f] then -- Hackishly copy the validation code; this should go away when we move to using P1793 and P1630
                                    table.insert( groupElements, p.createRow( id, '', parentArgs[id..f], '[//www.worldcat.org/identities/containsVIAFID/' .. parentArgs[id..f] .. ' WorldCat]', false ) )
                                elseif id == 'lccn' and parentArgs[id..f] and parentArgs[id..f] ~= '' and not parentArgs['viaf'..f] and not parentArgs['worldcatid'..f] then
                                    local lccnParts = p.splitLccn( parentArgs[id..f] )
                                    if lccnParts and lccnParts[1] ~= 'sh' then
                                        table.insert( groupElements, p.createRow( id, '', parentArgs[id..f], '[//www.worldcat.org/identities/lccn-' .. lccnParts[1] .. lccnParts[2] .. '-' .. lccnParts[3] .. ' WorldCat]', false ) )
                                    end
                                end

                                local val = parentArgs[id..f]
                                if val and val ~= '' and mw.ustring.lower(val) ~= 'no' and params[3] ~= 0 then
                                    local link
                                    if type( params[3] ) == 'function' then
                                        link = val
                                    else
                                        link = p.getLink( params[3], val, params[4] )
                                    end
                                    if link and link ~= '' then
                                        table.insert( groupElements, p.createRow( id, params[2], val, link, true ) .. p.getCatForId( params[1], params[5] or 0 ) )
                                        itemCount = itemCount + 1
                                    end
                                end
                            end
                            if #groupElements > 0 then
                                if gr.title and gr.title ~= '' then
                                    table.insert( listElements, "* '''"..gr.title.."'''\n" )
                                end
                                table.insert( listElements, table.concat( groupElements ) )
                                if n == 1 and #groupElements > 1 then
                                    table.insert( listElements, "\n----\n" )
                                end
                                -- mobile version
                                if n == 1 then
                                    mobileContent = table.concat( groupElements )
                                end
                            end
                        end
                    end
                    -- Generate navbox title
                    if #listElements > 0 then
                        if fromForCount > 1 and #conf.databases == 1 then
                            if parentArgs['for'..f] and parentArgs['for'..f] ~= '' then
                                navboxParams['group'..(rowCount + 1)] = "''" .. parentArgs['for'..f] .. "''"
                            else
                                navboxParams['group'..(rowCount + 1)] = "''" .. title.text .. "''"
                            end
                        else
                            navboxParams['group'..(rowCount + 1)] = db.name or ''
                        end
                        navboxParams['list'..(rowCount + 1)] = table.concat( listElements )
                        rowCount = rowCount + 1
                    end
                end
            end
        end
    end
    if rowCount > 0 then
        local Navbox = require('Módulo:Navbox')
        if fromForCount > 1 then
            --add missing names
            for r = 1, rowCount, 1 do
                if navboxParams['group'..r] == '' then
                    navboxParams['group'..r] = "''" .. mw.wikibase.getEntity(parentArgs['wikidata'..r]):getLabel().."''"
                end
            end
            if fromForCount > 2 then
                navboxParams['navbar'] = 'plain'
            else
                navboxParams['state'] = 'off'
                navboxParams['navbar'] = 'off'
            end
        end
        local mainCategories = ''
        --if stringArgs then
        --    mainCategories = mainCategories .. '[[Categoria:!Páginas que utilizam controle de autoridade com parâmetros]]\n'
        --end
        if itemCount > 13 then
            if itemCount > 34 then
                itemCount = 'mais de 30'
            end
            mainCategories = mainCategories .. '[[Categoria:!CA com ' .. itemCount .. ' elementos]]\n'
    end
        navboxParams['style'] = 'width: inherit';
        return frame:extensionTag{ name = 'templatestyles', args = { src = 'Predefinição:Controle de autoridade/styles.css' } }
            .. tostring(
                mw.html.create( 'div' )
                    :addClass( 'mw-authority-control' )
                    :wikitext( Navbox._navbox( navboxParams ) )
                    :done()
                :tag('div')
                    :addClass( 'mw-mf-linked-projects' )
                    :addClass( 'hlist' )
                    :newline()
                    :wikitext( mobileContent )
                    :done()
                :done()
            )
            .. mainCategories
    else
        return ''
    end
end

return p