Module:Citation: Difference between revisions

From ProleWiki, the proletarian encyclopedia
No edit summary
mNo edit summary
Line 7: Line 7:
function p.cite( frame )
function p.cite( frame )
local pframe = frame:getParent()
local pframe = frame:getParent()
local Author = pframe.args.author
local Author = pframe.args.author
local Year = pframe.args.year
local Chapter = pframe.args.chapter
local Title = pframe.args.title
local Title = pframe.args.title
local Year = pframe.args.year
local Page = pframe.args.page
local PDF = pframe.args.pdf
local City = pframe.args.city
local Publisher = pframe.args.publisher
local ISBN = pframe.args.isbn
local DOI = pframe.args.doi
local LG = pframe.args.lg
 
if is_set (Author) then
if is_set (Author) then
if is_set (Year) then
if is_set (Year) then
return Author .. " (" .. Year .. ")" .. ". " .. "''" .. Title .. "''"
x1 = Author .. " (" .. Year .. ")" .. ". "
else
else
return Author .. ". " .. "''" .. Title .. "''"
x1 = Author .. ". "
end
end
else
x1 = ""
end
end
return x1
end
end
return p
return p

Revision as of 19:48, 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()

	local Author = pframe.args.author
	local Year = pframe.args.year
	local Chapter = pframe.args.chapter
	local Title = pframe.args.title
	local Page = pframe.args.page
	local PDF = pframe.args.pdf
	local City = pframe.args.city
	local Publisher = pframe.args.publisher
	local ISBN = pframe.args.isbn
	local DOI = pframe.args.doi
	local LG = pframe.args.lg

	if is_set (Author) then
		if is_set (Year) then
			x1 = Author .. " (" .. Year .. ")" .. ". "
			else
				x1 = Author .. ". "
		end
		else
			x1 = ""
	end
	return x1
end
return p