Jump to content

Module:Copied and Module:Copied/sandbox: Difference between pages

(Difference between pages)
Page 1
Page 2
Content deleted Content added
per talk page
 
No edit summary
 
Line 11: Line 11:
local afd = args["afd"] or args["afd1"] or ""
local afd = args["afd"] or args["afd1"] or ""
local merge = args["merge"] or args["merge1"] or ""
local merge = args["merge"] or args["merge1"] or ""
local text = "Text and/or other creative content from"
local mergedFrom = args["mergedFrom"] or ""
local text
if (mergedFrom == 'yes') then
text = "The contents of"
else
text = "Text and/or other creative content from"
end
if not (from_oldid == "") then
if not (from_oldid == "") then
text = string.format("%s [%s this version] of", text, tostring(mw.uri.fullUrl(from, {oldid=from_oldid} )))
text = string.format("%s [%s this version] of", text, tostring(mw.uri.fullUrl(from, {oldid=from_oldid} )))
Line 20: Line 26:
text = text .. '[[]]'
text = text .. '[[]]'
end
end
if (merge == "yes") or not (afd == "") then
if (merge == "yes") or (mergedFrom == "yes") or not (afd == "") then
text = text .. " was merged into"
text = text .. " was [[Wikipedia:Merging|merged]] into"
else
else
text = text .. " was copied or moved into"
text = text .. " was copied or moved into"
end
end
if (merge == "yes") and (to == "") then
if (to == "") then --If no target given assume current page is the target
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 (mw.title.getCurrentTitle().nsText == "Talk") then
text = string.format("%s [[%s]]",text,mw.title.getCurrentTitle().text)
else
text = string.format("%s [[%s:%s]]",text,mw.title.getCurrentTitle().nsText,mw.title.getCurrentTitle().text)
end
else
else
text = string.format("%s [[%s]]",text,to)
text = string.format("%s [[%s]]",text,to)
Line 48: Line 58:
end
end
end
end
text = text .. "." -- Finish first sentance
text = text .. "." -- Finish first sentence
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 as long as the latter page exists.",text,tostring(mw.uri.fullUrl(from,{action="history"}) or ""))
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 as long as the latter page exists.",text,tostring(mw.uri.fullUrl(from,{action="history"}) or ""))
if (args["talk"] == 'yes' or (mergedFrom == 'yes' and args["talk"] ~= 'no')) then
local fromTalk = string.format("%s:%s", "Talk", from)
text = string.format("%s For the discussion at that location, see its [[%s|talk page]].", text, fromTalk)
end
return text
return text
end
end
Line 56: Line 70:
local text = ""
local text = ""
local afd = args["afd" .. i]
local afd = args["afd" .. i]
if (afd or args["merge" .. i]) then
if (afd or args["merge" .. i] or args["mergedFrom"]) then
text = string.format("%s\n*Merged",text)
text = string.format("%s\n*Merged",text)
else
else
Line 68: Line 82:
if (from_oldid) then
if (from_oldid) then
text = string.format("%s[%s oldid], ",text,tostring(mw.uri.fullUrl(from, {oldid = from_oldid} )))
text = string.format("%s[%s oldid], ",text,tostring(mw.uri.fullUrl(from, {oldid = from_oldid} )))
end
local talk = args["talk".. i] or ""
if (talk == "yes" or (args["mergedFrom"] == 'yes' and talk ~= "no")) then
text= string.format("%s[[%s:%s|talk]], ", text, "Talk", from)
end
end
local to = args["to".. i] or ""
local to = args["to".. i] or ""
if (to == "") then -- If no target given assume current page is the target
if (mw.title.getCurrentTitle().nsText == "Talk") then
to = string.format("%s",mw.title.getCurrentTitle().text)
else
to = string.format("%s:%s",mw.title.getCurrentTitle().nsText,mw.title.getCurrentTitle().text)
end
end
text = string.format("%s[%s history]) → [[%s]]",text,tostring(mw.uri.fullUrl(from, {action = "history"} )), to)
text = string.format("%s[%s history]) → [[%s]]",text,tostring(mw.uri.fullUrl(from, {action = "history"} )), to)
Line 94: Line 120:
end
end
if (not (args["to_oldid" .. i] or args["to_diff".. i])) then
if (not (args["to_oldid" .. i] or args["to_diff".. i])) then
if (args["mergedFrom"] == 'yes') then
text = string.format("%s[[Category:Wikipedia pages using copied template without oldid]]",text)
text = string.format("%s[[Category:Wikipedia pages using merged-from template without oldid]]",text)
else
text = string.format("%s[[Category:Wikipedia pages using copied template without oldid]]",text)
end
end
end
Line 126: Line 156:
local historyList = list(args)
local historyList = list(args)
if (args["collapse"] == 'yes') then
if (args["collapse"] == 'yes') then
local collapsedText = '<table style="width:100%%; background: transparent;" class="mw-collapsible mw-collapsed">\n<tr><th>Copied pages:</th></tr>\n<tr><td> %s </td></tr></table>'
local collapsedText
if (args["mergedFrom"] == 'yes') then
collapsedText = '<table style="width:100%%; background: transparent;" class="mw-collapsible mw-collapsed">\n<tr><th>Merged pages:</th></tr>\n<tr><td> %s </td></tr></table>'
else
collapsedText = '<table style="width:100%%; background: transparent;" class="mw-collapsible mw-collapsed">\n<tr><th>Copied pages:</th></tr>\n<tr><td> %s </td></tr></table>'
end
historyList = string.format(collapsedText, historyList)
historyList = string.format(collapsedText, historyList)
end
end

local mergedFrom
local text = "Text has been copied to or from this %s; 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 as long as the copies exist. For attribution and to access older versions of the copied text, please see the history links below. %s"
local copies
text = string.format(text, pageType, historyList)
if (args["mergedFrom"]) then
mergedFrom = "merged into"
copies = "this page"
else
mergedFrom = "copied to or from"
copies = "the copies"
end
local text = "Text has been %s this %s; 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 as long as %s exist. For attribution and to access older versions of the copied text, please see the history links below. %s"
text = string.format(text, mergedFrom, pageType, copies, historyList)
return text
return text
end
end
Line 140: Line 184:
local text = "[[Category:Wikipedia pages using copied template]]"
local text = "[[Category:Wikipedia pages using copied template]]"
if ((not from_oldid) or (not to_oldid)) and not multiUsed then
if ((not from_oldid) or (not to_oldid)) and not multiUsed then
if (args["mergedFrom"] == 'yes') then
text = text .. "[[Category:Wikipedia pages using copied template without oldid]]"
text = text .. "[[Category:Wikipedia pages using merged-from template without oldid]]"
else
text = text .. "[[Category:Wikipedia pages using copied template without oldid]]"
end
end
end
return text
return text