Module:Pages with authority control identifiers
Appearance
![]() | This module depends on the following other modules: |
Usage
{{#invoke:Pages with authority control identifiers|autoDetect}}
See also
- {{Pages with authority control identifiers}}
- {{Miscellaneous pages with authority control identifiers}}
- {{User pages with authority control identifiers}}
- {{Wikipedia articles with authority control identifiers}}
- {{Wikipedia articles with faulty authority control identifiers}}
- {{CatAutoTOC}}
Tracking categories
require('Module:No globals')
local p = {}
local ac = require('Module:Authority control')
local currentTitle = mw.title.getCurrentTitle()
local title = currentTitle.text
local isCat = (currentTitle.namespace == 14)
local function misc( frame, id )
if isCat and id then
for _, conf in pairs( ac.conf ) do
if conf[1] == id then
local link = conf[2]
local texCatExplain = frame:expandTemplate{ title = 'Category explanation',
args = { 'pages, other than main user pages or Wikipedia articles, using {{[[Template:Authority control|Authority control]]}} with '..link..' identifiers.' } }
local texCatMore = frame:expandTemplate{ title = 'Cat more', args = {'Wikipedia:Authority control'} }
local texEmptyCat = frame:expandTemplate{ title = 'Possibly empty category' }
local texWPCat = frame:expandTemplate{ title = 'Wikipedia category', args = { hidden = 'yes', tracking = 'yes' } }
local texTOC = ''
if mw.site.stats.pagesInCategory(title, 'pages') > 400 then
texTOC = frame:expandTemplate{ title = 'Category TOC', args = { align = 'center' } }
end
local outString = texCatExplain..texCatMore..texEmptyCat..texWPCat..texTOC..'\n'..
'Pages in this category should only be added by [[Module:Authority control]].'..
'[[Category:Pages with '..id..' identifiers]]'..
'[[Category:Miscellaneous pages with authority control information|'..id..']]'
return outString
end
end
end
return ''
end
local function pages( frame, id ) --i.e. [[Category:Pages with VIAF identifiers]]
if isCat then
for _, conf in pairs( ac.conf ) do
if conf[1] == id then
local link = conf[2]
local texCatMore = frame:expandTemplate{ title = 'Cat more', args = {'Wikipedia:Authority control'} }
local texWPCat = frame:expandTemplate{ title = 'Wikipedia category' }
local outString = texCatMore..texWPCat..'\n'..
'[[Category:Pages with authority control information|'..id..']]'
return outString
end
end
end
return ''
end
function p.autoDetect( frame )
local pagesID = mw.ustring.match(title, 'Pages with ([%w%.%-]+) identifiers')
local miscID = mw.ustring.match(title, 'Miscellaneous pages with ([%w%.%-]+) identifiers')
local userID = mw.ustring.match(title, 'User pages with ([%w%.%-]+) identifiers')
local wpID = mw.ustring.match(title, 'Wikipedia articles with ([%w%.%-]+) identifiers')
local wpfaultyID = mw.ustring.match(title, 'Wikipedia articles with faulty authority control identifiers %(([%w%.%-]+)%)')
if pagesID then pages( frame, pagesID )
elseif miscID then misc( frame, miscID )
elseif userID then
elseif wpID then
elseif wpfaultyID then
else return ''
end
end
return p