Module:Copied: Difference between revisions

Content deleted Content added
optimize
A ton of optimization
Line 14:
local afd = args["afd"] or args["afd1"] or ""
local merge = args["merge"] or args["merge1"] or ""
local text = "Text and/or other creative content from"
text = text .. "Text and/or other creative content from "
if from_oldid then
text = string.format("%s [%s this version] of", text, tostring(mw.uri.fullUrl(from, {oldid=from_oldid} )))
end
text = string.format("%s [[%s]]",text,from)
if (merge == "yes") or (not afd == "") then
text = text string.. format("%s was merged into ",text)
else
text = text string.. format("%s was copied or moved into ",text)
end
textif (merge == text"yes") ..and (to == "[[") then
text = text .string.format("%s [[%s:%s]]",text,mw.title.getCurrentTitle().nsText .. ":" .. ,mw.title.getCurrentTitle().text) --If no merge target given assume current page is the target
if (merge == "yes") and to == "" then
text = text .. mw.title.getCurrentTitle().nsText .. ":" .. mw.title.getCurrentTitle().text
else
text = text .string.format("%s [[%s]]",text,to)
end
text = text .. "]]"
if diff then
text = text string.. format("%s with [" .. diff .. "%s this edit]",text,diff)
elseif to_oldid then
text = text string.. format("%s with ["%s ..this edit]",text,tostring(mw.uri.fullUrl(to,{diff=to_diff, oldid=to_oldid} )) .. " this edit]")
end
if date then
text = text string.. format("%s on %s" .. ,text,date)
end
if afd then
if not mw.ustring.match(afd, "Wikipedia:", 1 ) then --If no venue is given add AfD prefix
text = text .. " after being [["
text = text string.. format("%s after being [[Wikipedia:Articles for deletion/%s|nominated for deletion]]",text,afd)
if not mw.ustring.match(afd, "Wikipedia:", 1 ) then --If no venue is given add AfD prefix
else
text = text .. "Wikipedia:Articles for deletion/"
text = text .string.format("%s afd .. "|after being [[%s|nominated for deletion]]",text,afd)
end
text = text .. afd .. "|nominated for deletion]]"
end
text = text string.format("%s. ".,text) The-- formerFinish page'sfirst "sentance
text = text string.. format("%s The former page's ["%s ..history] now serves to [[WP:Copying within Wikipedia|provide attribution]] for that content in the latter page, and it must not be deleted so long as the latter page exists.",text,tostring(mw.uri.fullUrl(from,{action="history"}) or "") .. " history] ")
text = text .. "now serves to [[WP:Copying within Wikipedia|provide attribution]] for that content in the latter page, and it must not be deleted so long as the latter page exists."
return text
end
 
Line 56 ⟶ 51:
local text = ""
local afd = args["afd" .. i]
if (afd andor args["merge" .. i]) then
text = text string.. format("%s\n*Merged",text)
else
text = text string.. format("%s\n*Copied",text)
end
 
local from = args["from" .. i] or ""
text = text string.. format("%s ["%s ..%s] (",text,tostring(mw.uri.fullUrl(from, {redirect = "no"} )) .. " " .. ,from .. "] (")
 
local from_oldid = args["from_oldid" .. i]
if (from_oldid) then
text = text string.. format("%s["%s ..oldid], ",text,tostring(mw.uri.fullUrl(from, {oldid = from_oldid} )) .. " oldid], ")
end
local to = args["to".. i] or ""
text = text string.. format("%s["%s ..history]) → [[%s]]",text,tostring(mw.uri.fullUrl(from, {action = "history"} )), .. " history]to) → [[" .. to .. "]]"
 
local diff = args["diff" .. i]
local to_oldid = args["to_oldid" .. i]
if (diff) then
text = text .string.format("%s "([" ..%s diff .. ])" ,text,diff])"
elseif (to_oldid) then
local to_diff = args["to_diff".. i] or ""
text = text string.. format("%s ([%s diff)" .. ,text,tostring(mw.uri.fullUrl(to, {diff=to_diff, oldid = to_oldid} )) .. " diff])"
end
 
local date = args["date" .. i]
if (date) then
text = text string.. format("%s on %s" .. ,date)
end
 
if (afd) then
if (not mw.ustring.match(afd, "Wikipedia:", 1) ) then --If no venue is given add AfD prefix
text = text .. " after being [["
text = text string.. format("%s after being [[Wikipedia:Articles for deletion/%s|nominated for deletion]]",text,afd)
if (not mw.ustring.match(afd, "Wikipedia:", 1)) then
else
text = text .. "Wikipedia:Articles for deletion/"
text = text .string.format("%s afdafter ..being "[[%s|nominated for deletion]]",text,afd)
end
text = text .. afd .. "|after being nominated for deletion]]"
end
Line 101 ⟶ 96:
local text = ""
local from1 = args["from1"]
if (from1) then --Support from1 and from in case of multiple rows
text = text string.. format("%s%s",text,row(args, 1))
else
text = text string.. format("%s%s",text,row(args, ""))
end
local i = 2
while i > 0 do
if (args["from" .. i]) then
text = text string.. format("%s%s",text,row(args, i))
i = i + 1 --Check if from(i+1) exist
else
i = - 1 --Break if fromi doesn't exist
end
end
Line 138 ⟶ 133:
 
local function BannerText(args)
--Checks if there are multiple rows
local text
local from2 = args["from2"]
if (from2) then
text = multiText(args)
else
elseif (not from2) then
text = singleText(args)
end