Module:BionicleWebsiteCitation
From BIONICLEsector01
Documentation for this module may be created at Module:BionicleWebsiteCitation/doc
local websiteCitation = require("Module:WebsiteCitation")
local p = {}
-- The title of BIONICLE.com as it should appear in the desired citation.
local WEBSITE_TITLE = "[[BIONICLE.com]]"
-- Build and return the desired citation.
-- Asserts that mainLinkText is not nil,
-- and that at least one of archiveUrl or brokenUrl is not nil.
function p.getBionicleWebsiteCitation(mainLinkText, archiveUrl, brokenUrl)
assert(mainLinkText ~= nil)
assert(archiveUrl ~= nil or brokenUrl ~= nil)
return websiteCitation.getWebsiteCitation(WEBSITE_TITLE, mainLinkText, nil, archiveUrl, brokenUrl)
end
-- Pull out the relevant args for use.
function p.bionicleWebsiteCitation(frame)
local pageTitle = frame.args["pagetitle"]
local archiveUrl = frame.args["archiveurl"]
if archiveUrl == "" then
archiveUrl = nil
end
local brokenUrl = frame.args["brokenurl"]
if brokenUrl == "" then
brokenUrl = nil
end
assert(pageTitle ~= nil,
[[BionicleWebsiteCitation received no page title;
all BionicleWebsiteCitations must have a title specified
through the `pagetitle` parameter]])
assert(archiveUrl ~= "",
[[BionicleWebsiteCitation received no page URL;
all BionicleWebsiteCitations must have a URL specified through
the `archiveurl` or `brokenurl` parameters]])
local mainLinkText = "\"" .. pageTitle .. "\""
return p.getBionicleWebsiteCitation(mainLinkText, archiveUrl, brokenUrl)
end
return p