Module:Copied: Difference between revisions

Content deleted Content added
more
Maybe?
Line 1:
local MessageBox = require('Module:Message box')
local p = {}
 
local function singleText()
argtable = {}
from_oldid = frame.args["from_oldid"]
from = frame.args["from"]
to_diff = frame.args["to_diff"]
to_oldid = frame.args["to_oldid"]
to = frame.args["to"]
date = frame.args["date"]
afd = frame.args["afd"]
text = "Text and/or other creative content from "
if not (from_oldid == "" or from_oldid == nil) then
text = text .. "[{{fullurl:" .. from .. "|oldid=" .. from_oldid .. "this version] of "
end
text = text .. "[[" .. from .."]]"
text = text .. " was copied or moved into "
text = text .. "[[" .. to .. "]]"
if not (diff == "" or diff == nil) then
text = text .. " with [" .. diff .. "|this edit]"
elseif not (to_oldid == "" or to_oldid == nil) then
text = text .. "with [{{fullurl:" .. to .. "|diff=" .. to_diff .. "&oldid=" .. to_oldid .. "}}|this edit]"
end
if not (date == "" or date == nil) then
text = text .. " on " .. date
end
if not (afd == "" or afd == nil) then
text = text .. " after being [[Wikipedia:Articles for deletion/" .. afd "|nominated for deletion]]."
end
text = text .. ". The former page's "
text = text .. 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
 
local function Copied:renderBannerTextmultiText()
collapse = frame.args["collapse"]
if #argtable == 1 then
text = "Text has been copied to or from this {{#ifeq:{{SUBJECTSPACE}}||article|page}}; 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."
text = text + "Text and/or other creative content from [{{fullurl:" + argtable[1]["from"] + "|redirect=no}} " + argtable[1]["from"] + "] from"
if #argtablecollapse == 1'yes' then
text = text .. '<table style="width:100%; background: transparent;" class="collapsible collapsed">\n<tr><th>Copied pages:</th></tr>\n<tr><td>'
end
text = text .. list()
if collapse == 'yes' then
text = text .. '</td></tr></table>'
end
return text
end
 
function Copied:renderBannerBannerText()
local text
from2 = frame.args["from2"]
if not (from2 == nil or from2 == "") then
text = singleText()
else
text = multiText()
end
return text
end
 
local copied =function renderBanner()
return MessageBox.main('tmbox', {
small = 'no'frame.args["small"],
type = 'notice',
image = '[[File:Splitsection.svg|50px]]',
smallimage = 'none',
text = self:renderBannerTextBannerText()
})
end
local p = {}
 
function p._main(args)
local copied = renderBanner()
return tostring(copied)
end
 
function p.main(frame)
return p._mainrenderBanner(args)
local args = require('Module:Arguments').getArgs(frame)
return p._main(args)
end