More languages
More actions
No edit summary |
mNo edit summary |
||
Line 45: | Line 45: | ||
if is_set(ArchiveURL) then | if is_set(ArchiveURL) then | ||
if is_set(ArchiveDate) then | if is_set(ArchiveDate) then | ||
x4 = "[" .. ArchiveURL .. " " .. "Archived" .. "]" .. "from the original on" .. " " .. ArchiveDate | x4 = "[" .. ArchiveURL .. " " .. "Archived" .. "]" .. " " .. "from the original on" .. " " .. ArchiveDate | ||
else | else | ||
x4 = "[" .. ArchiveURL .. " " .. "Archived" .. "]" .. "from the original." | x4 = "[" .. ArchiveURL .. " " .. "Archived" .. "]" .. "from the original." | ||
Line 54: | Line 54: | ||
if is_set (Retrieved) then | if is_set (Retrieved) then | ||
x5 = "Retrieved" .. Retrieved .. "." | x5 = "Retrieved" .. " " .. Retrieved .. "." | ||
else | else | ||
x5 = "" | x5 = "" |
Revision as of 03:13, 3 November 2021
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 URL = pframe.args.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 (URL) then
Title = "[" .. URL .. " " .. "\"" .. Title .. "\"" .. "]."
end
x2 = Title
else
x2 = ""
end
if is_set(Newspaper) then
x3 = "''" .. Newspaper .. "''."
else
x3 = ""
end
if is_set(ArchiveURL) then
if is_set(ArchiveDate) then
x4 = "[" .. ArchiveURL .. " " .. "Archived" .. "]" .. " " .. "from the original on" .. " " .. ArchiveDate
else
x4 = "[" .. ArchiveURL .. " " .. "Archived" .. "]" .. "from the original."
end
else
x4 = ""
end
if is_set (Retrieved) then
x5 = "Retrieved" .. " " .. Retrieved .. "."
else
x5 = ""
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
if is_set (x4) then
x4 = x4 .. " "
end
return x1 .. x2 .. x3 .. x4 .. x5
end
return p