FANDOM


local links = {}
local Icon = require('Module:Icon')
local IMDb = require('Module:IMDb')
local getArgs = require('Module:Arguments').getArgs
 
local function makeInvokeFunc(funcName)
	return function (frame)
		local args = getArgs(frame)
		return links[funcName](args)
	end
end
 
links.wikipedia = makeInvokeFunc('_wikipedia')
links.twitter = makeInvokeFunc('_twitter')
links.imdbname = makeInvokeFunc('_imdbname')
 
function links._wikipedia( args )
	local id = args['id'] or args[1] or ''
	local label = args['label'] or args[2] or 'Wikipedia'
	local icon = args['icon'] or Icon._icon( { common = 'wikipedia', size = '15px', link = 'wikipedia:'..id } )
	return icon..' [[wikipedia:'..id..'|'..label..']]'
end
 
function links._twitter( args )
	local id = args['id'] or args[1] or ''
	local label = args['label'] or args[2] or 'Twitter'
	local post = args['post'] or args[3]
	if post then post = '/status/' .. post else post = '' end
	local iconargs = { common = 'twitter', size = '10px', link = 'https://twitter.com/'..id..post}
	local icon = args['icon'] or Icon._icon( iconargs )
	return icon..tostring( mw.html.create('span'):addClass('plainlinks'):wikitext(' [https://twitter.com/'..id..post..' '..label..']'):allDone() )
end
 
function links._facebook( args )
	local id = args['id'] or args[1] or ''
	local label = args['label'] or args[2] or 'Facebook'
	local post = args['post'] or args[3]
	local pageid = args['pageid']
	if pageid then id = 'pages/' .. pageid end
	if post then post = '/posts/' .. post else post = '' end
	local iconargs = { common = 'facebook', size = '15px', link = 'https://facebook.com/'..id..post}
	local icon = args['icon'] or Icon._icon( iconargs )
	return icon..tostring( mw.html.create('span'):addClass('plainlinks'):wikitext(' [https://facebook.com/'..id..post..' '..label..']'):allDone() )
end
 
function links._imdbname( args )
	local id = args['id'] or args[1] or ''
	local label = args['label'] or args[2] or 'IMDb'
	local iconargs = { common = 'imdb', size = '15px', link = 'imdb:nm'..id}
	local icon = args['icon'] or Icon._icon( iconargs )
	return icon..' [[imdb:nm'..id..'|'..label..']]'
end
 
function links._tumblr( args )
--
end
 
function links._instagram( args )
--
end
 
-- Eventually, this might include video tags. For now, let's not.
 
return links

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.