Module:Cite tweet

From Sekaipedia

Documentation for this module may be created at Module:Cite tweet/doc

local p = {}

function p.main(frame)
	local args = frame:getParent().args
	
	return p._main(args)
end

function p._main(args)
	
	local content = ' (%s). "[https://twitter.com/%s/status/%s %s]" (Tweet) – via Twitter.'
	
	content = string.format(
		content,
		args['date'] or '',
		args['handle'] or '',
		args['snowflake'] or '',
		args['title'] or ''
	)
	
	if args['author'] then
		content = string.format(
			'%s [@%s]' .. content,
			args['author'] or '',
			args['handle'] or ''
		)
	else
		content = string.format(
			'@%s' .. content,
			args['handle'] or ''
		)
	end
	
	local ref = mw.getCurrentFrame():extensionTag{
		name = 'ref',
		content = content,
		args = {
			name = args['ref name'],
			group = args['ref group']
		}
	}
	
	return ref
end

return p
Cookies help us deliver our services. By using our services, you agree to our use of cookies.