Toggle menu
Toggle personal menu
Not logged in
Your IP address will be publicly visible if you make any edits.

Module:Video citation: Difference between revisions

From ProleWiki, the proletarian encyclopedia
(Very rough sketch of YouTube citation template)
 
m (Improvements)
Line 29: Line 29:
Title = '[' .. URL .. " " .. Title .. ']'
Title = '[' .. URL .. " " .. Title .. ']'
end
end
second_part = second_part .. italics(Title)
second_part = second_part .. '"' .. Title .. '"'
end
end
if is_set(Date) then
if is_set(Date) then
if is_set(Channel) then
if is_set(Channel) then
first_part = first_part .. '(' .. Date .. ')'
first_part = first_part .. ' (' .. Date .. ')'
else
else
second_part = second_part .. '(' .. Date .. ')'
second_part = second_part .. ' (' .. Date .. ')'
end
end
end
end
return first_part .. ". " .. second_part .. "''YouTube''"
return first_part .. ". " .. second_part .. ". " .. "''[[YouTube]]''"
end
end
return p
return p

Revision as of 01:53, 5 October 2022

local p = {}

local function is_set (var)
	return not (var == nil or var == '');
end

local function italics (var)
	return "<i>" .. var .. "</i>"
end

function p.cite(frame)
	local parent = frame:getParent()
	
	local Title = parent.args.title
	local Channel = parent.args.channel
	local Date = parent.args['date']
	local Timestamp = parent.args.timestamp
	local URL = parent.args.url

	local first_part = ''
	local second_part = ''

	if is_set(Channel) then
		first_part = first_part .. Channel
	end
	
	if is_set(Title) then
		if is_set(URL) then
			Title = '[' .. URL .. " " .. Title .. ']'
		end
		second_part = second_part .. '"' .. Title .. '"'
	end
	
	if is_set(Date) then
		if is_set(Channel) then
			first_part = first_part .. ' (' .. Date .. ')'
		else
			second_part = second_part .. ' (' .. Date .. ')'
		end
	end
	
return first_part .. ". " .. second_part .. ". " .. "''[[YouTube]]''"
end
return p