local p = {}
local function is_set (var)
return not (var == nil or var == '');
end
function p.cite( frame )
local pframe = frame:getParent()
local Journalist = pframe.args.journalist
local Date = pframe.args['date']
local Title = pframe.args.title
local TitleURL = pframe.args['title-url']
local Newspaper = pframe.args.newspaper
local ArchiveURL = pframe.args['archive-url']
local ArchiveDate = pframe.args['archive-date']
local Retrieved = pframe.args.retrieved
if is_set (Journalist) then
if is_set (Date) then
x1 = Journalist .. " (" .. Date .. ")" .. ". "
else
x1 = Journalist .. "."
end
else
x1 = ""
end
if is_set (Title) then
if is_set (TitleURL) then
Title = "[" .. TitleURL .. " " .. "\"" .. Title .. "\"" .. "]"
end
x2 = Title
else
x2 = ""
end
if is_set(Newspaper) then
x3 = "''" .. Newspaper .. "''" .. "."
else
x3 = ""
end
if is_set (x1) then
x1 = x1 .. " "
end
if is_set (x2) then
x2 = x2 .. " "
end
if is_set (x3) then
x3 = x3 .. " "
end
return x1 .. x2 .. x3 .. x4
end
return p