Jump to content

Module:EB1922

From Wikisource

require('strict')

local p = {}

local getArgs = require('Module:Arguments').getArgs
local header = require('Module:Header')._header

function p._EB1922(args, argsWithBlanks)
	argsWithBlanks = argsWithBlanks or {}
	
	local tracking_cats = {}
	
	args.title = '[[1922 Encyclopædia Britannica]]'
	if args.volume then
		args.title = args.title .. ', [[1922 Encyclopædia Britannica/Volume ' .. args.volume .. '|Volume ' .. args.volume .. ']]'
	end
	
	args.section = args.section or mw.title.getCurrentTitle().subpageText
	
	if args.previous then
		args.previous = '[[1922 Encyclopædia Britannica/' .. args.previous .. '|' .. args.previous .. ']]'
	end
	if args['next'] then
		args['next']  = '[[1922 Encyclopædia Britannica/' .. args['next']  .. '|' .. args['next']  .. ']]'
	end
	
	args.notes = args['override-notes'] or args.override_notes
	if not args.notes then
		args.wikipedia = args.wikipedia or argsWithBlanks.wikipedia
		args['other-projects'] = args['other-projects'] or args.other_projects
		args.other_projects = nil
		
		args.notes = '\'\'\'See also\'\'\' '
		if args.wikipedia == '' then
		elseif args.wikipedia then
			args.notes = args.notes .. '[[w:' .. args.wikipedia .. '|' .. args.wikipedia .. ']]'
			if args.wikipedia2 then
				args.notes = args.notes .. ' and [[w:' .. args.wikipedia2 .. '|' .. args.wikipedia2 .. ']]'
			end
			args.notes = args.notes .. ' on [[w:Main_Page|Wikipedia]], '
		end
		if args['other-projects'] then
			args.notes = args.notes .. args['other-projects'] .. ', and '
		elseif args.wikipedia and args.wikipedia ~= '' then
			args.notes = args.notes .. 'and '
		end
		args.notes = args.notes .. 'the [[1922 Encyclopædia Britannica/Project Disclaimer|disclaimer]].'
	end
	
	if args['extra-notes'] then
		args.notes = args.notes .. ' ' .. args['extra-notes']
	end
	
	return header(args) .. table.concat(tracking_cats)
end

function p.EB1922(frame)
	return p._EB1922(getArgs(frame), getArgs(frame, {removeBlanks = false}))
end

return p