Module:AmCyc
Appearance
This module depends on the following other modules: |
Implements {{AmCyc}}.
require('strict')
local p = {}
local getArgs = require('Module:Arguments').getArgs
local header = require('Module:Header')._header
function p.AmCyc(frame)
local args = getArgs(frame)
local current_title = mw.title.getCurrentTitle()
local cats = {}
local year = args.year or '1879'
local title_base = 'The American Cyclopædia (' .. year .. ')'
args.title = '[[' .. title_base .. '|The American Cyclopædia]]'
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 [[' .. title_base .. '/Project Disclaimer|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 = 'Edition of ' .. year .. ". \'\'\'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