Module:Internet Archive small links

require('strict')

local p = {} --p stands for package

local getArgs = require('Module:Arguments').getArgs local yesno = require('Module:Yesno') local make_style_string = require('Module:Optional style').make_style_string

local function IAlink(id, suffix) local add if suffix then add = " " .. suffix else add = "" end return "[https://archive.org/details/" .. (id or "") .. " IA" .. add .. "]" end

function p.links(frame) local args = getArgs(frame) -- make links local start = tonumber(args.start) or 1 local prefix = args.prefix or '' local suffix = args.suffix or '' local numbers = yesno(args.numbers or 'yes') local display = args.display local style = make_style_string({['font-size'] = '83%', ['style'] = args.style}) local links = {} for k, id in pairs(args) do		if tonumber(k) then if numbers then table.insert(links, IAlink(id, k + start - 1)) else table.insert(links, IAlink(id, args.display)) end end end local link_string = ' ' .. prefix .. table.concat(links, ", ") .. suffix .. ' '	-- tracking cat local cat local page = mw.title.getCurrentTitle if (page.nsText == 'Template' or page.nsText == 'Module') and page.rootText == 'Internet Archive small links' then cat = '' else cat = '' end return link_string .. cat end

return p