Module:Backwards copy: Difference between revisions

Content deleted Content added
+
basic args logic
Line 49:
end
local citations = {}
local i = 1
while args[tostring(i)] or args["articlename" .. i] or args["title" .. i] or (i == 1 and (args["articlename"] or args["title"])) do
if args[tostring(i)] then
citations.insert(i)
else
local date = (args["date" .. i] or (i == 1 and args["date"])) or
-- legacy way of providing dates
string.format(
"%s %s",
args["monthday" .. i] or (i == 1 and args["monthday"]),
args["year" .. i] or (i == 1 and args["year"])
)
citations.insert(frame:expandTemplate{ title = "Citation", args = {
ref = "none",
author = args["author" .. i] or (i == 1 and args["author"]),
authorlist = args["authorlist" .. i] or (i == 1 and args["authorlist"]),
["display-authors"] = args["display-authors" .. i] or (i == 1 and args["display-authors"]),
date = date,
url = args["url" .. i] or (i == 1 and args["url"]),
title = (args["articlename" .. i] or (i == 1 and args["articlename"]))
or args["title" .. i] or (i == 1 and args["title"]),
publisher = (args["title" .. i] or (i == 1 and args["title"]))
or args["publisher" .. i] or (i == 1 and args["publisher"])
} })
-- end
i = i + 1
end
 
text = string.format(
"%s article is substantially duplicated by a piece in an external publication. " ..
Line 54 ⟶ 85:
text
)
-- if count of citations.getn() > 10 then
return showError(
-- text = text .. "s"
"No citations were provided. Provide at least one citation using <code>title</code>.",
-- end
demoCheck(args)
)
elseif citations.getn() > 1 then
text = string.format("%ss:", text)
else
text = string.format("%s:", text)
end
local ul = mw.html.create("ul")
for k, v in pairs(citations) do
ul:node(mw.html.create("li"):wikitext(v))
end
text = text .. " " .. tostring(ul)
Line 71 ⟶ 112:
image = '[[File:Newspaper Cover.svg|50px]]',
text = bannerText(args)
}) .. (demoCheck(args) and "[[Category:Wikipedia article talk pages incorporating the backwardscopy template]]" or "")
})
end