Module:Authority control
Related pages |
---|
|
This module contains the code of the {{Authority control}} template. See its documentation.
Parameters, Wikidata properties, and tracking categories
Identifier | Remark | Section | Appears as | Wikidata property | Tracking categories and page counts | |
---|---|---|---|---|---|---|
Articles | Faulty IDs | |||||
AAG | Art galleries and museums | Auckland | P3372: Auckland Art Gallery artist ID | 1,828 | 0 | |
ACM-DL | Scientific databases | Association for Computing Machinery | P864: ACM Digital Library author ID | 1,736 | 0 | |
ADB | Biographical dictionaries | Australia | P1907: Australian Dictionary of Biography ID | 7,660 | 0 | |
admiralty | Lighthouse identifiers | D1204.1 | P3562: Admiralty number | 2,002 | 0 | |
AGSA | Art galleries and museums | South Australia | P6804: Art Gallery of South Australia creator ID | 2,206 | 0 | |
ARLHS | Lighthouse identifiers | ARLHS | P2980: ARLHS lighthouse ID | 2,345 | 0 | |
autores.uy | autores.uy is an author's database, that focus on Uruguayan authors. It was created and maintained by the Uruguayan chapter of Creative Commons. It also provides access to digitized works of the authors in public domain. | Biographical dictionaries | Uruguay | P2558: autores.uy ID | 812 | 0 |
AWR | Biographical dictionaries | Australian Women's Register | P4186: Australian Women's Register ID | 2,565 | 0 | |
BIBSYS | BIBSYS is a supplier of library and information systems for all Norwegian university Libraries, the National Library of Norway, college libraries, and a number of research libraries and institutions. | National libraries | Norway | P1015: NORAF ID | 89,019 | 0 |
Bildindex | Art research institutes | Bildindex (Germany) | P2092: Bildindex der Kunst und Architektur ID | 273 | 0 | |
BNC | National libraries | Chile | P1890: CCAB ID | 3,234 | 0 | |
BNE | National Library of Spain (BNE: Biblioteca Nacional de España) is a major public library, the largest in Spain. | National libraries | Spain | P950: Biblioteca Nacional de España ID | 95,564 | 0 |
BNF | Authority data of people listed in the general catalogue of the National Library of France | National libraries | France (data) | P268: Bibliothèque nationale de France ID | 310,585 | 0 |
BNMM | National libraries | Argentina | P3788: BNMM authority ID | 3,628 | 0 | |
Botanist | Author citation (botany): standard form (official abbreviation) of a personal name for use in an author citation (only for names of algae, fungi and plants). Links to page at International Plant Names Index (IPNI). | Scientific databases | International Plant Names Index | P428: botanist author abbreviation | 5,973 | 0 |
BPN | Dutch project with material for 40,000 digitized biographies, including former colonies of the Netherlands. | Biographical dictionaries | Netherlands | P651: Biografisch Portaal van Nederland ID | 7,553 | 0 |
CANTICN | National libraries | Catalonia | P9984: CANTIC ID | 32,541 | 0 | |
CCG | Lighthouse identifiers | A1761 | P3920: Canadian Coastguard Lighthouse ID | 140 | 0 | |
CINII | CiNii is a bibliographic database service for material in Japanese academic libraries. It is maintained by the National Institute of Informatics. | Scientific databases | CiNii (Japan) | P271: CiNii Books author ID | 47,704 | 0 |
CWGC | Other | Commonwealth War Graves Commission | P1908: CWGC person ID | 1,999 | 0 | |
DAAO | Art research institutes | Australian Artists | P1707: DAAO ID | 1,120 | 0 | |
DBI | Biographical dictionaries | Italian People | P1986: Biographical Dictionary of Italian People ID | 10,982 | 1 | |
DBLP | Scientific databases | DBLP (computer science) | P2456: DBLP author ID | 7,989 | 0 | |
DIB | Biographical dictionaries | Ireland | P6829: Dictionary of Irish Biography ID | 5,426 | 0 | |
DSI | Art research institutes | Scientific illustrators | P2349: Stuttgart Database of Scientific Illustrators ID | 3,492 | 0 | |
DTBIO | Biographical dictionaries | Germany | P7902: Deutsche Biographie (GND) ID | 120,877 | 0 | |
EMU | National libraries | Ukraine | P4613: Encyclopedia of Modern Ukraine ID | 4,460 | 0 | |
FAST | Other | FAST | P2163: FAST ID | 238,613 | 0 | |
FNZA | Art research institutes | New Zealand Artists | P6792: Find NZ Artists ID | 1,130 | 0 | |
GND | Authority data on people, corporations and subjects from the German National Library (DNB) | National libraries | Germany | P227: GND ID | 429,351 | 1 |
Google Scholar | Scientific databases | Google Scholar | P1960: Google Scholar author ID | 12,127 | 0 | |
HDS | Historical Dictionary of Switzerland is an encyclopedia on the history of Switzerland. | Other | Historical Dictionary of Switzerland | P902: HDS ID | 10,076 | 0 |
IAAF | The IAAF athlete database lists information about sport of athletics competitors. | Other | World Athletics | P1146: World Athletics athlete ID | 20,686 | 0 |
ICCU | Central Institute for the Union Catalogue (ICCU: Istituto Centrale per il Catalogo Unico) is an Italian government agency created to build a single catalog of all the libraries in the nation. It manages National Library Service (Servizio bibliotecario nazionale). | National libraries | Italy | P396: SBN author ID | 31,113 | 0 |
ICIA | Art research institutes | ICIA (Israel) | P1736: Information Center for Israeli Art artist ID | 486 | 0 | |
IEU | Other | Internet Encyclopedia of Ukraine | P9070: Internet Encyclopedia of Ukraine ID | 657 | 0 | |
ISNI | ISNI is a method for uniquely identifying the public identities of contributors to media content such as books, TV programmes, and newspaper articles. Please take care not to confuse ISNI and ORCID identifiers. | General | 1 | P213: ISNI | 550,940 | 0 |
J9U | National libraries | Israel | P8189: National Library of Israel J9U ID | 338,489 | 0 | |
Joconde | Art research institutes | Joconde (France) | P347: Joconde work ID | 532 | 0 | |
KULTURNAV | KulturNav is a Norwegian cloud-based software service, allowing users to create, manage and distribute name authorities and terminology, focusing on the needs of museums and other cultural heritage institutions. The software is developed by KulturIT ANS and the development project is funded by the Arts Council Norway. | Art research institutes | KulturNav (Norway) | P1248: KulturNav-ID | 5,594 | 0 |
LCCN | See Wikipedia:Authority control#LCCN for formatting instructions | National libraries | United States | P244: Library of Congress authority ID | 698,304 | 0 |
LIR | Lexicon Istoric Retic (LIR) is a two volume version with a selection of articles published in Romansh. | Other | Lexicon Istoric Retic (Switzerland) | P886: Lexicon istoric retic ID | 133 | 0 |
LNB | National libraries | Latvia | P1368: National Library of Latvia ID | 26,400 | 0 | |
Marina Militare | Lighthouse identifiers | Italy | P3863: Italian Navy Lighthouses and Beacons ID | 133 | 0 | |
MarineTraffic | Lighthouse identifiers | MarineTraffic | P3601: MarineTraffic Lighthouse ID | 1,115 | 0 | |
MATHSN | Scientific databases | MathSciNet | P4955: MR Author ID | 11,066 | 0 | |
MBA | MusicBrainz is an open music encyclopedia that collects music metadata and makes it available to the public. | Other | artist | P434: MusicBrainz artist ID | 149,710 | 0 |
MBAREA | Other | area | P982: MusicBrainz area ID | 31,666 | 0 | |
MBI | Other | instrument | P1330: MusicBrainz instrument ID | 754 | 0 | |
MBL | Other | label | P966: MusicBrainz label ID | 4,871 | 0 | |
MBP | Other | place | P1004: MusicBrainz place ID | 6,679 | 0 | |
MBRG | Other | release group | P436: MusicBrainz release group ID | 122,759 | 0 | |
MBS | Other | series | P1407: MusicBrainz series ID | 880 | 0 | |
MBW | Other | work | P435: MusicBrainz work ID | 29,958 | 0 | |
MGP | Mathematics Genealogy Project is a web-based database for the academic genealogy of mathematicians. | Scientific databases | Mathematics Genealogy Project | P549: Mathematics Genealogy Project ID | 16,161 | 0 |
NARA | National Archives and Records Administration (NARA) is an independent agency of the United States government charged with preserving and documenting government and historical records. | Other | National Archives (US) | P1225: U.S. National Archives Identifier | 21,734 | 0 |
NCL | National Central Library is the national library of Taiwan, Republic of China. | National libraries | Taiwan | P1048: NCL ID | 785 | 0 |
NDL | Authority data listed in the catalog of the national library of Japan. Search also available via VIAF. | National libraries | Japan | P349: NDL Authority ID | 60,714 | 0 |
NGA | Lighthouse identifiers | NGA | P3563: NGA lighthouse ID | 1,541 | 0 | |
NGV | Art galleries and museums | Victoria | P2041: National Gallery of Victoria artist ID | 2,972 | 0 | |
NKC | National Library of the Czech Republic (Národní knihovna České republiky) is the central library of the Czech Republic. | National libraries | Czech Republic | P691: NKCR AUT ID | 193,189 | 0 |
NLA | NLA Trove's People and Organisation view allows the discovery of biographical and other contextual information about people and organisations. Search also available via VIAF. | National libraries | Australia | P409: Libraries Australia ID | 50,930 | 0 |
NLG | National libraries | Greece | P3348: National Library of Greece ID | 22,366 | 0 | |
NLK | National libraries | Korea | P5034: National Library of Korea ID | 36,453 | 0 | |
NLR | National libraries | Romania | P1003: National Library of Romania ID | 163 | 0 | |
NSK | National libraries | Croatia | P1375: NSK ID | 15,701 | 0 | |
NTA | National libraries | Netherlands | P1006: Nationale Thesaurus voor Auteurs ID | 229,291 | 0 | |
ORCID | Authority data on researchers, academics, etc. The ID range is a subset of the ISNI range. For free text links (for example when mentioning a person on page which is not about them), it is also possible to use {{ORCID}}. Authors—including Wikipedia editors—may obtain an ORCID by signing up at orcid.org/register. Please take care not to confuse ORCID and ISNI identifiers. | General | 1 | P496: ORCID iD | 18,864 | 1 |
PIC | PIC is a photographer's database. It is maintained by the New York Public Library. | Art research institutes | Photographers' Identities | P2750: Photographers’ Identities Catalog ID | 10,394 | 0 |
PLWABN | National libraries | Poland | P7293: PLWABN ID | 134,039 | 0 | |
NLP | National libraries | Poland | P1695: NLP ID (old) | 487 | 0 | |
Publons | Scientific databases | Publons (researchers) | P3829: Publons author ID | 2,495 | 0 | |
RID | An identifying system for scientific authors. The system was introduced in January 2008 by Thomson Reuters. The combined use of the digital object identifier with the ResearcherID allows for a unique association of authors and scientific articles. | Scientific databases | ResearcherID | P1053: ResearcherID | 3,750 | 0 |
RISM | Other | 1 | P5504: RISM ID | 11,539 | 0 | |
RERO | Other | 1 | P3065: RERO ID | 43,182 | 0 | |
RKDartists | RKDartists is an online database using a controlled vocabulary currently containing around 200,000+ names and other information about artists. Names in RKDartists may include given names, pseudonyms, variant spellings, names in multiple languages, and names that have changed over time (e.g., married names). | Art research institutes | RKD Artists (Netherlands) | P650: RKDartists ID | 36,325 | 0 |
RKDID | Art research institutes | RKD ID (Netherlands) | P350: RKDimages ID | 1,050 | 0 | |
RSL | Russian State Library (Российская государственная библиотека) is the national library of Russia. | National libraries | Russia | P947: RSL ID (person) | 923 | 0 |
Scopus | SciVerse Scopus is a bibliographic database containing abstracts and citations for academic journal articles. It covers nearly 19,500 titles from over 5,000 international publishers, of which 16,500 are peer-reviewed journals in the scientific, technical, medical, and social sciences (including arts and humanities). | Scientific databases | Scopus author | P1153: Scopus author ID | 10,928 | 0 |
SELIBR | Authority data from the National Library of Sweden | National libraries | Sweden | P906: SELIBR ID | 39,640 | 0 |
SIKART | SIKART is a biographical dictionary and a database on visual art in Switzerland and Liechtenstein. It is published online by the Swiss Institute for Art Research (SIAR). | Art research institutes | SIKART (Switzerland) | P781: SIKART ID | 1,200 | 0 |
SNAC-ID | Other | Social Networks and Archival Context | P3430: SNAC ARK ID | 132,340 | 0 | |
SUDOC | Authority data of people listed in the general catalogue of the University Documentation System of France. Also available from English-speaking catalog (search author, click one book, click author name, take PPN= value of the URL) | Other | 1 | P269: IdRef ID | 280,042 | 0 |
TA98 | Scientific databases | Terminologia Anatomica | P1323: Terminologia Anatomica 98 ID | 3,296 | 0 | |
TDVİA | Other | İslâm Ansiklopedisi | P7314: TDV İslam Ansiklopedisi ID | 2,843 | 0 | |
TePapa | Art galleries and museums | Te Papa (New Zealand) | P3544: Te Papa agent ID | 3,730 | 0 | |
TLS | Theaterlexikon der Schweiz (TLS) is an encyclopedia about theatre in Switzerland. It was developed by the Institute of Theatre Studies of the University of Berne. | Other | Theaterlexikon (Switzerland) | P1362: Theaterlexikon der Schweiz ID | 586 | 0 |
Trove | Other | 1 | P1315: NLA Trove people ID | 70,477 | 0 | |
UKPARL | UK parliament member data | Other | UK Parliament | P6213: UK Parliament identifier | 3,797 | 0 |
ULAN | ULAN is an online database using a controlled vocabulary currently containing around 293,000 names and other information about artists. Names in ULAN may include given names, pseudonyms, variant spellings, names in multiple languages, and names that have changed over time (e.g., married names). | Art research institutes | Artist Names (Getty) | P245: Union List of Artist Names ID | 48,530 | 0 |
USCG | Lighthouse identifiers | 6-0695 | P3723: USCG lighthouse ID | 608 | 0 | |
USCongress | Biographical Directory of the United States Congress is a biographical dictionary of all present and former members of the United States Congress and its predecessor, the Continental Congress. Also included are Delegates from territories and the District of Columbia and Resident Commissioners from the Philippines and Puerto Rico. | Other | US Congress | P1157: US Congress Bio ID | 12,869 | 0 |
VcBA | Vatican Library document data | National libraries | Vatican | P8034: Vatican Library VcBA ID | 43,935 | 0 |
VIAF | International authority data from the Online Computer Library Center (OCLC) | General | 1 | P214: VIAF ID | 929,816 | 0 |
WORLDCATID | General | WorldCat | P7859: WorldCat Identities ID | 772,894 | 0 | |
VIAF | General | WorldCat (via VIAF) | P214: VIAF ID | 158,385 | 0 | |
ZBMATH | Scientific databases | zbMATH | P1556: zbMATH author ID | 14,843 | 0 | |
Totals | 97 | 6,943,742 | 3 |
Additional tracking categories
This module also implements the following hidden tracking categories:
- Category:Pages with red-linked authority control categories (0) – error category to identify missing categories
- Category:Articles with deprecated authority control identifiers (0) – fix/migrate/remove deprecated IDs
- Category:Articles with suppressed authority control identifiers (42) – tracking only (no error)
- Category:Articles with multiple identifiers (46,535) – tracking only (no error)
- Category:Pages using authority control with parameters (3) – migrate IDs to Wikidata, if possible (no error)
- Category:Pages using authority control with parameters different on Wikidata (0) – determine/remove incorrect IDs & migrate to Wikidata
- Category:Pages using authority control with parameters all matching Wikidata (0) – template parameters may safely be removed
Number of identifiers
- Category:AC with 0 elements (676,639)
- Category:AC with 25 elements (1,573)
- Category:AC with 26 elements (1,185)
- Category:AC with 27 elements (982)
- Category:AC with 28 elements (753)
- Category:AC with 29 elements (580)
- Category:AC with 30 elements (467)
- Category:AC with 31 elements (388)
- Category:AC with 32 elements (295)
- Category:AC with 33 elements (214)
- Category:AC with 34 elements (173)
- Category:AC with 35 elements (92)
- Category:AC with 36 elements (71)
- Category:AC with 37 elements (46)
- Category:AC with 38 elements (17)
- Category:AC with 39 elements (10)
- Category:AC with 40 elements (7)
- Category:AC with 41 elements (2)
- Category:AC with 42 elements (1)
- Category:AC with 43 elements (2)
- Category:AC with 44 elements (1)
- Category:AC with 45 elements (1)
State parameter
- Category:AC using state parameter: collapsed (1,307)
- Category:AC using state parameter: expanded (549)
- Category:AC using state parameter: autocollapse (32)
- Category:AC using state parameter: other (1)
See also
- m:Interwiki map – definition of global custom interwiki prefixes
require('strict')
local p = {}
local title = mw.title.getCurrentTitle()
local namespace = title.namespace
local testcases = (string.sub(title.subpageText,1,9) == 'testcases')
local function addCat(cat)
if cat and cat ~= '' then
local redlinkcat = ''
if testcases == false and mw.title.new(cat, 14).exists == false then
redlinkcat = '[[Category:Pages with red-linked authority control categories]]'
end
return '[[Category:'..cat..']]'..redlinkcat
else
return ''
end
end
local function getCatForId(id)
local cat = ''
if namespace == 0 then
cat = 'Articles with '..id..' identifiers'
end
return addCat(cat)
end
local function getIdsFromWikidata(qid,property)
local ids = {}
if not mw.wikibase or not qid then
return ids
end
local statements = mw.wikibase.getBestStatements(qid,property)
if statements then
for _, statement in ipairs( statements ) do
if statement.mainsnak.datavalue then
table.insert( ids, statement.mainsnak.datavalue.value )
end
end
end
return ids
end
local function makelink(conf,val,nextid) --validate values and create a link
local link
if conf.link2 then -- use function to validate and generate link
link = conf.link2(val)
else
local valid_value
if conf.pattern then -- use pattern to determine validity if defined
valid_value = val:match(conf.pattern)
elseif conf.patterns then
for i = 1,#conf.patterns do
valid_value = val:match(conf.patterns[i])
if valid_value then break end
end
elseif conf.valid then -- otherwise use function to determine validity
valid_value = conf.valid(val)
else -- no validation possible
valid_value = val
end
if valid_value then
local label = conf.label
if not label or nextid>1 then
label = tostring(nextid)
end
if conf.link then
valid_value = valid_value:gsub('%%', '%%%%')
link = '[' .. mw.ustring.gsub(conf.link,'%$1',valid_value) .. ' ' .. label .. ']'
else
link = valid_value
end
else
link = false
end
end
if link then
link = '<span class="uid">'..link..'</span>'
else
local faultyCat = 'Articles with faulty '..(conf.errorcat or conf.category or conf[1])..' identifiers'
link = '<span class="error">The '..conf[1]..' id '..val..' is not valid.</span>'..addCat(faultyCat)
end
return link
end
--[[==========================================================================]]
--[[ Main ]]
--[[==========================================================================]]
function p.authorityControl(frame)
local config = require("Module:Authority control/config")
local conf = config.config
local sectionNames = config.sectionNames
local resolveEntity = require( 'Module:ResolveEntityId' )
local parentArgs = frame:getParent().args --WD IDs added here later
local iParentArgs = 0 --count original/manual parent args only later
local iMatches,suppressedIdCount = 0,0
local auxCats = ''
local rct = 0 -- total number of links returned
local numqids = 4 -- support for 4 additional qids
local totsect = #sectionNames + numqids
local sections = {}
for _ = 1,totsect do table.insert(sections,{}) end
-- check for suppressed identifiers
local suppress = {}
if parentArgs.suppress then
local suppresslist = mw.text.split(parentArgs.suppress,"%s*,%s*") -- split parameter by comma
for _,v in ipairs(suppresslist) do
if v:match("^%d+$") then
v = "P"..tostring(v)
else
v = string.upper(v)
end
suppress[v] = true -- index table by identifier name
end
end
local function makeSections(qid,additional)
local tval = {}
local function parameter_is_used(property)
local used = false
if property then
if tval[property] then
if tval[property][1] then
used = true
end
elseif tval[property] == false then -- property has been manually suppressed
used = true
end
end
return used
end
for _, params in ipairs(conf) do
tval[params.property] = getIdsFromWikidata(qid, 'P' .. params.property) -- setup table for values with property number as key
if additional then
if suppress["P"..tostring(params.property)] or suppress[string.upper(params[1])] then
tval[params.property] = false -- indicates the identifier is suppressed
end
else
local val = parentArgs[mw.ustring.lower(params[1])] or parentArgs[params[1]]
if suppress["P"..tostring(params.property)] or suppress[string.upper(params[1])] or val == '' then
if tval[params.property][1] and (namespace == 0 or testcases) then
suppressedIdCount = suppressedIdCount + 1
if parentArgs['arts'] ~= 'arts' then
auxCats = auxCats .. '[[Category:Articles with suppressed authority control identifiers|'..params[1]..']]'
end
end
tval[params.property] = false -- indicates the identifier is suppressed
elseif val then -- add local parameter to wikidata
iParentArgs = iParentArgs + 1
local bnew = true
for _, w in pairs(tval[params.property]) do
if val == w then
bnew = false
end
end
if bnew then -- add new value to table
if tval[params.property][1] then
auxCats = auxCats .. '[[Category:Pages using authority control with parameters different on Wikidata|'..params[1]..']]'
end
table.insert(tval[params.property],val)
else
iMatches = iMatches+1
end
end
end
local suppress = false
if params.suppressedbyproperty then
for _,sc in ipairs(params.suppressedbyproperty) do
if parameter_is_used(sc) then
suppress = true
end
end
end
if not tval[params.property] == false and not suppress then
local tlinks = {} -- setup table for links
local nextIdVal = 1
for _,val in ipairs(tval[params.property]) do
local link = makelink(params,val,nextIdVal)
local cat = params.category or params[1]
if link then -- add category unless link==false
link = link .. getCatForId(cat)
end
table.insert(tlinks,link)
nextIdVal = nextIdVal + 1
end
if tval[params.property][1] then -- assemble
local row = ''
if params.prefix then
row = row..'*'..params.prefix
end
for i, l in ipairs(tlinks) do
if i==1 and not params.prefix then
row = row..'*'
else
row = row..'\n**'
end
row = row .. l
end
row = row..'\n'
local sec = additional or params.section -- uses section 9 for qid2, section 10 for qid3, etc.
table.insert(sections[sec],row)
rct = rct + 1
end
end
end
end
local function pencil(qid)
if not qid then
return ''
end
local args = { pid = 'identifiers' } -- #target the list of identifiers
args.qid = qid
return require('Module:EditAtWikidata')._showMessage(args)
end
local function resolveQID(qid)
if qid then
qid = 'Q'..mw.ustring.gsub(qid, '^[Qq]', '')
qid = resolveEntity._id(qid) --nil if unresolvable
end
return qid
end
local qids = {}
qids[1] = mw.wikibase.getEntityIdForCurrentPage()
if not qids[1] then
qids[1] = resolveQID(parentArgs['qid']) --use qid parameter if no wikidata item is connected
end
makeSections(qids[1],false)
for c = 2,5 do
qids[c] = resolveQID(parentArgs['qid' .. c])
if qids[c] then makeSections(qids[c],totsect-numqids+c-1) end
end
if iMatches > 0 and iMatches == iParentArgs then
auxCats = auxCats .. '[[Category:Pages using authority control with parameters all matching Wikidata]]'
end
if parentArgs['arts'] == 'arts' and suppressedIdCount > 0 then
if namespace == 0 or testcases then
local s = 's'
if suppressedIdCount == 1 then s = '' end
auxCats = auxCats .. addCat('ACArt with '..suppressedIdCount..' suppressed element'..s)
end
end
--configure Navbox
local outString = ''
if rct > 0 then -- there is at least one link to display
local Navbox = require('Module:Navbox')
local sect,lastsect = 0,0
local navboxArgs = {
name = 'Authority control',
navboxclass = 'authority-control',
bodyclass = 'hlist',
state = parentArgs.state or 'autocollapse',
navbar = 'off'
}
for c=1,totsect do
if #sections[c] ~= 0 then -- section is non-empty
sect = sect + 1
lastsect = c
local sectname
if c <= totsect - numqids then -- regular section
sectname = sectionNames[c]
else -- section from additional qid
sectname = mw.wikibase.getLabel(qids[c-totsect+numqids+1]) .. pencil(qids[c-totsect+numqids +1])
end
navboxArgs['group' .. c] = sectname
navboxArgs['list' .. c] = table.concat(sections[c])
end
end
local aclink = '[[Help:Authority control|Authority control]]'
if sect == 1 then -- special display when only one section
if lastsect == 1 or lastsect == 8 then -- no special label when only general or other IDs are present
navboxArgs['group' .. lastsect] = aclink .. pencil(qids[1])
elseif lastsect <= totsect - numqids then -- other regular section
navboxArgs['group' .. lastsect] = aclink .. ': ' .. sectionNames[lastsect] .. pencil(qids[1])
else -- section from additional qid
navboxArgs['group' .. lastsect] = aclink .. ': ' .. navboxArgs['group' .. lastsect]
end
else -- add title to navbox
navboxArgs.title = aclink .. pencil(qids[1])
end
outString = Navbox._navbox(navboxArgs)
end
--auxCats
if rct == 0 or rct >= 25 then
if namespace == 0 or testcases then
auxCats = auxCats .. addCat('AC with '..rct..' elements')
end
end
if parentArgs.state then
if namespace == 0 or testcases then
local sCat
if parentArgs.state == 'collapsed' then sCat = 'AC using state parameter: collapsed'
elseif parentArgs.state == 'expanded' then sCat = 'AC using state parameter: expanded'
elseif parentArgs.state == 'autocollapse' then sCat = 'AC using state parameter: autocollapse'
else sCat = 'AC using state parameter: other'
end
auxCats = auxCats .. addCat(sCat)
end
end
if testcases then
auxCats = mw.ustring.gsub(auxCats, '(%[%[)(Category)', '%1:%2') --for easier checking
end
--out
outString = outString..auxCats
if namespace ~= 0 then
outString = mw.ustring.gsub(outString, '(%[%[)(Category:Articles)', '%1:%2') --by definition
end
return outString
end
-- Creates a human-readable standalone wikitable version of conf, and tracking categories with page counts, for use in the documentation
function p.docConfTable(frame)
local wikiTable = '<table class="wikitable sortable">'..
'<tr><th rowspan=2>Identifier</th>'..
'<th rowspan=2>Remark</th>'..
'<th rowspan=2>Section</th>'..
'<th rowspan=2>Appears as</th>'..
'<th rowspan=2 data-sort-type=number>Wikidata property</th>'..
'<th colspan=2>Tracking categories and page counts</th></tr>'..
'<tr><th>[[:Category:Articles with authority control information|Articles]]</th>'..
'<th>[[:Category:Articles with faulty authority control information|Faulty IDs]]</th></tr>'
local lang = mw.getContentLanguage()
local a, f, P = 0, 0, 0 --cumulative sums
local config = require("Module:Authority control/config")
local conf = config.config
local sectionNames = config.sectionNames
local function checkcat(category,label)
local ret='[[:Category:'..category..'|'..label..']]'
if mw.title.new(category, 14).exists == false then
ret = ret..' <span class="plainlinks" style="font-size:85%;">[['..tostring(mw.uri.fullUrl('Category:'..category,'action=edit&preload=Template:Authority_control/preload'))..' create]]</span>'
end
return ret
end
for _, conf in pairs(conf) do
local category = conf.category or conf[1]
local wpl = frame:expandTemplate{ title = 'Wikidata property link', args = { id = 'f', conf.property } }
local articleCat = 'Articles with '..category..' identifiers'
local faultyCat = 'Articles with faulty '.. (conf.errorcat or category) ..' identifiers'
local articleCount = lang:formatNum( mw.site.stats.pagesInCategory(articleCat, 'pages') )
local faultyCount = lang:formatNum( mw.site.stats.pagesInCategory(faultyCat, 'pages') )
P = P + 1 --property count
a = a + lang:parseFormattedNumber(articleCount)
f = f + lang:parseFormattedNumber(faultyCount)
wikiTable = wikiTable..'<tr><td>[['..(conf.idlink or conf[1]..' (identifier)')..'|'..conf[1]..']]</td>'..
'<td>'..(conf.remark or '')..'</td>'..
'<td>'..sectionNames[conf.section]..'</td>'..
'<td>'..makelink(conf,conf.example,1)..'</td>'..
'<td data-sort-value='..conf.property..'>'..wpl..'</td>'..
'<td style="text-align: right;">'..checkcat(articleCat,articleCount)..'</td>'..
'<td style="text-align: right;">'..checkcat(faultyCat,faultyCount)..'</td></tr>'
end
wikiTable = wikiTable..'<tr><th style="text-align: right;" colspan=4>Totals</th>'..
'<th style="text-align: right;">'..lang:formatNum(P)..'</th>'..
'<th style="text-align: right;">'..lang:formatNum(a)..'</th>'..
'<th style="text-align: right;">'..lang:formatNum(f)..'</th></tr></table>'
return require('Module:Suppress categories').main(wikiTable)
end
return p