Module:Copied: Difference between revisions

Content deleted Content added
Apparently Copied multi has had logic bugs for a decade
Handle missing to_diff better (feature not in original template but obviously an improvement tell me if it's a problem)
Line 7:
local from_oldid = args["from_oldid"] or args["from_oldid1"] or ""
local from = args["from"] or args["from1"] or ""
local to_diff = args["to_diff"] or args["to_diff1"] or ""
local diff = args["diff"] or args["diff1"] or ""
local to_oldid = args["to_oldid"] or args["to_oldid1"] or ""
local to = args["to"] or args["to1"] or ""
local date = args["date"] or args["date1"] or ""
Line 29 ⟶ 26:
text = string.format("%s [[%s]]",text,to)
end
iflocal not (diff == args["diff")] thenor args["diff1"]
local to_diff = args["to_diff"] or args["to_diff1"] or ""
local to_oldid = args["to_oldid"] or args["to_oldid1"] or ""
if (diff) then
text = string.format("%s with [%s this edit]",text,diff)
elseif not (to_oldid == "") or not (to_diff == "") then
local to_diff2 = args["to_diff"] or args["to_diff1"] or "prev"
text = string.format("%s with [%s this edit]",text,tostring(mw.uri.fullUrl(to, {diff=to_diff, oldid = to_oldid} )))
local diffto_oldid2 = args["diffto_oldid"] or args["diff1to_oldid1"] or ""
text = string.format("%s with [%s this edit]",text,tostring(mw.uri.fullUrl(to, {diff=to_diff or "prev", oldid = to_oldid or ""} )))
end
if not (date == "") then
Line 70 ⟶ 72:
local diff = args["diff" .. i]
local to_oldid = args["to_oldid" .. i]
local to_diff = args["to_diff".. i] or ""
if (diff) then
text = string.format("%s ([%s diff])",text,diff)
elseif (args["to_oldid" .. i] or args["to_diff".. i]) then
local to_diff = args["to_diff".. i] or "prev"
text = string.format("%s ([%s diff])",text,tostring(mw.uri.fullUrl(to, {diff=to_diff or "", oldid = to_oldid or ""} )))
local to_oldid = args["to_oldid" .. i] or ""
text = string.format("%s ([%s diff])",text,tostring(mw.uri.fullUrl(to, {diff=to_diff or "", oldid = to_oldid or ""} )))
end
local date = args["date" .. i]
Line 89 ⟶ 91:
end
end
if ((not from_oldid)(args["to_oldid" .. i] or (notargs["to_diff".. to_oldidi])) then
text = string.format("%s[[Category:Wikipedia pages using copied template without oldid]]",text)
end