Module:Citation: Difference between revisions

From ProleWiki, the proletarian encyclopedia
mNo edit summary
No edit summary
Line 8: Line 8:
local pframe = frame:getParent()
local pframe = frame:getParent()
Author = pframe.args.author
Author = pframe.args.author
Title = pframe.args.title
Totle = pframe.args.title
Year = pframe.args.year
Year = pframe.args.year
if is_set (Author) then
if is_set (Author) then
if is_set (Year) then
if is_set (Year) then
return Author .. " (" .. Year .. ")" .. ". " .. "''" .. Title "''"
return Author .. " (" .. Year .. ")" .. ". " .. "''" .. Totle "''"
else
else
return Author .. ". " .. "''" .. Title "''"
return Author .. ". " .. "''" .. Totle "''"
end
end
end
end
end
end
return p
return p

Revision as of 19:32, 27 October 2021

local p = {}

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

function p.cite( frame )
	local pframe = frame:getParent()
	Author = pframe.args.author
	Totle = pframe.args.title
	Year = pframe.args.year
	if is_set (Author) then
		if is_set (Year) then
			return Author .. " (" .. Year .. ")" .. ". " .. "''" .. Totle "''"
			else
				return Author .. ". " .. "''" .. Totle "''"
		end
	end
end
return p