Module:Blog

-- -- This module implements Template:Blog.

local p = {}

function p._main(args) local ret = {} local function add(v) ret[#ret + 1] = v	end

-- Validate positional args for i = 1, 5 do		args[i] = args[i] or string.format('', i)	end

-- Build the citation if args.official then add('') else add('') end add(' ') if args.official then if args.int then add(string.format( "\"%s,\" The Official Star Wars Blog " .. ' (link) ', args.int, args[2], args[1] ))		else add(string.format( '"%s," ' .. "The Official Star Wars Blog", args[1], args[2] ))		end else if args.listing then add(string.format( "%s, %s's", args.archivedate and args.archivedate .. '/' or '', args[1], args[2], args[3] ))		elseif args.webcite then add(string.format( '"%s" – ' .. "%s, [[%s]'s",				args.webcite, args[3],				args[1], args[4], args[5]			))		else			add(string.format(				'"%s" – ' ..				"%s, [[%s]]'s",				args.archivedate and args.archivedate .. '/' or '',				args[1], args[2], args[3],				args[1], args[4], args[5]			))		end		local archiveService = args.webcite			and 'WebCite'			or 'Archive.org'		add(string.format(			' StarWars.com Blog ' ..			' (content now obsolete; backup link on %s) ',			archiveService		))	end

return table.concat(ret) end

function p.main(frame) local args = {} for k, v in pairs(frame:getParent.args) do		v = v:match('^%s*(.-)%s*$') -- trim whitespace if v ~= '' then args[k] = v		end end return p._main(args) end

return p

--