Module:Proofreadpage header template
![]() | This module depends on the following other modules: |
Logic for MediaWiki:Proofreadpage header template.
require('strict')
local p = {}
local getArgs = require('Module:Arguments').getArgs
local header = require('Module:Header')._header
local attr_data = require('Module:Header/attribution').attr_data
local function _pp_header(args)
for k, v in pairs(attr_data) do
args[v['param_name'] .. '-nolink'] = true
end
args['allow-explicit-formatting'] = true
args['section'] = args['current'] or args['section']
args['previous'] = args['prev'] or args['previous']
local publisher_content = ''
if args['publisher'] then
if args['address'] then
publisher_content = args['notes_content'] .. ': ;'
end
publisher_content = publisher_content .. args['publisher']
if args['yeardate'] then
publisher_content = publisher_content .. ' (' .. args['yeardate'] .. ')'
end
end
local pagecontent = ''
if args['from'] and args['to'] then
local septext = 'Page'
if args['publisher'] then
septext = ', page'
end
if args['from'] == args['to'] then
pagecontent = septext .. ' ' .. args['from']
else
pagecontent = septext .. 's ' .. args['from'] .. '–' .. args['to']
end
end
local auto_notes = publisher_content .. pagecontent
if auto_notes ~= '' and args['notes'] then
args['notes'] = auto_notes .. '. ' .. args['notes']
elseif auto_notes ~= '' then
args['notes'] = auto_notes
end
local postheader = '[[Category:' .. 'Pages using automatic headers' .. ']]'
if args['value'] == 'toc' then
postheader = postheader .. (args['remarks'] or '') .. '[[Category:' .. 'Pages using automatic headers with value parameter' .. ']]'
end
return header(args) .. postheader
end
function p.pp_header(frame)
return _pp_header(getArgs(frame))
end
return p