Content deleted Content added
fix crash |
simply and clean up code |
||
Line 1:
local MessageBox = require('Module:Message box')
local getArgs = require('Module:Arguments').getArgs▼
local p = {}
local function singleText(args)
local from_oldid = args["from_oldid"] or args["from_oldid1"] or ""
Line 52 ⟶ 54:
local function row(args, i)
local text▼
local from_oldid = args["from_oldid"..i] or ""▼
local from = args["from"..i] or ""▼
local to_diff = args["to_diff"..i] or ""▼
local diff = args["diff"..i] or ""▼
local afd = args["afd"..i] or ""▼
local text = ""
text = text .. "\n*Merged"
else
text = text .. "\n*Copied"
end
text = text .. " [" .. tostring(mw.uri.fullUrl(from,{redirect="no"} )) .. " " .. from .. "]"▼
▲ text = text .. " [" .. tostring(mw.uri.fullUrl(from, {redirect = "no"} )) .. " " .. from .. "] ("
if not (from_oldid == "") then▼
text = text .. "[" .. tostring(mw.uri.fullUrl(from, {oldid=from_oldid} )) .. " oldid], "▼
▲ text = text .. "[" .. tostring(mw.uri.fullUrl(from, {oldid = from_oldid} )) .. " oldid], "
end
text = text .. "[" .. tostring(mw.uri.fullUrl(from, {action = "history"} )) .. " history]) → [[" .. to .. "]]"
if not (diff == "") then▼
text = text .. "([" .. diff .. " diff])"
elseif
local to_diff = args["to_diff".. i] or ""
text = text .. " ([" .. tostring(mw.uri.fullUrl(to, {diff=to_diff, oldid = to_oldid} )) .. " diff])" end
if not (date == "") then▼
text = text .. " on " .. date
end
if
text = text .. " after being [["
if (not mw.ustring.match(afd, "Wikipedia:", 1
text = text .. "Wikipedia:Articles for deletion/"
end
text = text .. afd .. "|after being nominated for deletion]]"
end
end
local function list(args)
local text = ""
local from1 = args["from1"]
if
text = text .. row(args, 1)
else
text = text .. row(args, "")
end
local i = 2
while i > 0 do
if (args["from" .. i]) then
text = text .. row(args, i)
i = i + 1
else
i = - 1
end
end
Line 115 ⟶ 119:
local function multiText(args)
local text =
local pageType
if
else
end
▲ text = text .. "see the list below. The source pages now serve to [[WP:Copying within Wikipedia|provide attribution]] for the content in the destination pages and must not be deleted so long as the copies exist. For attribution and to access older versions of the copied text, please see the history links below."
local historyList = list(args)
if (args["collapse"] == 'yes') then
historyList = string.format(collapsedText, historyList)
text = text .. list(args)▼
end
text = string.format(text, pageType, historyList)
return text
end
Line 136 ⟶ 140:
local function BannerText(args)
local text
local from2 = (args["from2"]
if (from2
elseif not (from2 == "") then▼
text = multiText(args)
end
return text
Line 159 ⟶ 163:
local from_oldid = args["from_oldid"]
local text = "[[Category:Wikipedia pages using copied template]]"
if ((not from_oldid) or (not to_oldid)) then
text = text .. [[Category:Wikipedia pages using copied template without oldid]]
end
return text
end
function p.main(frame)
▲ local getArgs = require('Module:Arguments').getArgs
local args = getArgs(frame)
return renderBanner(args) .. categories(args)
|