FANDOM


-- <nowiki>
-- This module implements [[Templat: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('{{{%d}}}', i)
	end
 
	-- Build the citation
	if args.official then
		add('[[Berkas:Star_Wars_Blog.jpeg|x15px|link=Star Wars Blog]]')
	else
		add('[[Berkas:StarWarsDotComBlogsLogoStacked.jpeg|link=Star Wars: Blogs]]')
	end
	add('&nbsp;')
	if args.official then
		if args.int then
			add(string.format(
				"\"[[%s|%s]],\" [[Star Wars Blog|The Official ''Star Wars'' Blog]] " ..
				'<small>([http://starwarsblog.starwars.com/%s link])</small>',
				args.int, args[2], args[1]
			))
		else
			add(string.format(
				'"[http://starwarsblog.starwars.com/%s %s]," ' ..
				"[[Star Wars Blog|The Official ''Star Wars'' Blog]]",
				args[1], args[2]
			))
		end
	else
		if args.listing then
			add(string.format(
				"''[http://web.archive.org/web/%shttp://blogs.starwars.com/%s %s]'', [[%s]]'s",
				args.archivedate and args.archivedate .. '/' or '',
				args[1],
				args[2],
				args[3]
			))
		elseif args.webcite then
			add(string.format(
				'"[http://www.webcitation.org/query?id=%s %s]" &ndash; ' ..
				"''[http://web.archive.org/web/http://blogs.starwars.com/%s %s]'', [[%s]]'s",
				args.webcite, args[3],
				args[1], args[4], args[5]
			))
		else
			add(string.format(
				'"[http://web.archive.org/web/%shttp://blogs.starwars.com/%s/%s %s]" &ndash; ' ..
				"''[http://web.archive.org/web/http://blogs.starwars.com/%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 '[[wikipedia:WebCite|WebCite]]'
			or '[[wikipedia:Internet Archive|Archive.org]]'
		add(string.format(
			' [[StarWars.com]] [[Star Wars: Blogs|Blog]] ' ..
			'<small>(content now obsolete; backup link on %s)</small>',
			archiveService
		))
	end
 
	return string.format(
		'<span class="plainlinks">%s</span>',
		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
 
-- </nowiki>

Ad blocker interference detected!


Wikia is a free-to-use site that makes money from advertising. We have a modified experience for viewers using ad blockers

Wikia is not accessible if you’ve made further modifications. Remove the custom ad blocker rule(s) and the page will load as expected.

Also on FANDOM

Random Wiki