Module:EB9
Jump to navigation
Jump to search
This module depends on the following other modules: |
Implements {{EB9}}.
require('strict')
local p = {}
local getArgs = require('Module:Arguments').getArgs
local header = require('Module:Header')._header
function p.EB9(frame)
local args = getArgs(frame)
local current_title = mw.title.getCurrentTitle()
local cats = {'[[Category:' .. 'Encyclopædia Britannica, Ninth Edition' .. ']]'}
args.title = '[[' .. current_title.rootText .. ']]'
if args.volume then
args.title = args.title .. ', [[' .. current_title.rootText .. '/Volume ' .. args.volume .. '|Volume ' .. args.volume .. ']]'
else
table.insert(cats, '[[Category:' .. 'EB9 no volume' .. ']]')
end
args.section = args.section or current_title.subpageText
args.contributor = args.contributor or args.author
args.author = nil
if args.previous then
args.previous = '[[../' .. args.previous .. '/]]'
end
if args['next'] then
args['next'] = '[[../' .. args['next'] .. '/]]'
end
args.notes = args.override_notes
if not args.notes then
local notes_table = {}
if args.edition then
table.insert(notes_table, 'Edition of ' .. args.edition .. '.')
end
local see_also_table = {}
if args.wikipedia or args.wikipedia2 then
local wikipedia_table = {}
if args.wikipedia then
table.insert(wikipedia_table, '[[w:' .. args.wikipedia .. '|' .. args.wikipedia .. ']]')
end
if args.wikipedia2 then
table.insert(wikipedia_table, '[[w:' .. args.wikipedia2 .. '|' .. args.wikipedia2 .. ']]')
end
table.insert(see_also_table, table.concat(wikipedia_table, ' and ') .. ' on [[w:Main_Page|Wikipedia]]')
end
args.wikipedia = nil
if args.other_projects then
table.insert(see_also_table, args.other_projects)
end
table.insert(see_also_table, 'the [[' .. 'Wikisource:Project disclaimers/Encyclopædia Britannica, Ninth Edition|disclaimer]]')
local see_also_text = see_also_table[#see_also_table]
if #see_also_table > 1 then
see_also_text = table.concat(see_also_table, '; ', 1, #see_also_table - 1) .. '; and ' .. see_also_table[#see_also_table]
end
see_also_text = "\'\'\'See also\'\'\' " .. see_also_text .. '.'
table.insert(notes_table, see_also_text)
args.notes = table.concat(notes_table, ' ')
end
if args.extra_notes then
args.notes = args.notes .. ' ' .. args.extra_notes
end
if not current_title:inNamespace(0) then
cats = {}
end
return header(args) .. table.concat(cats)
end
return p