local MessageBox = require('Module:Message box')
local p =
local function singleText(args) local from_oldid = args["from_oldid"] or args["from_oldid1"] or "" local from = args["from"] or args["from1"] or "" local to = args["to"] or args["to1"] or "" local date = args["date"] or args["date1"] or "" 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" if not (from_oldid
"yes") or not (afd
"yes") and (to
"") then text = string.format("%s on %s",text,date) end if not (afd
local function row(args, i) local text = "" local afd = args["afd" .. i] if (afd or args["merge" .. i]) then text = string.format("%s\n*Merged",text) else text = string.format("%s\n*Copied",text) end
local from = args["from" .. i] or "" text = string.format("%s [%s %s] (",text,tostring(mw.uri.fullUrl(from,
)),from)
local from_oldid = args["from_oldid" .. i] if (from_oldid) then text = string.format("%s[%s oldid], ",text,tostring(mw.uri.fullUrl(from,))) end local to = args["to".. i] or "" text = string.format("%s[%s history]) → %s",text,tostring(mw.uri.fullUrl(from,)), to) local diff = args["diff" .. i] 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 "next" local to_oldid = args["to_oldid" .. i] or "prev" text = string.format("%s ([%s diff])",text,tostring(mw.uri.fullUrl(to,))) end local date = args["date" .. i] if (date) then text = string.format("%s on %s",text,date) end
if (afd) then if (mw.ustring.match(afd, "Wikipedia:", 1)) then --If no venue is given add AfD prefix text = string.format("%s after being nominated for deletion",text,afd) else text = string.format("%s after being nominated for deletion",text,afd) end end if (not (args["to_oldid" .. i] or args["to_diff".. i])) then text = string.format("%s",text) end return textend
local function list(args) local text = "" local from1 = args["from1"] if (from1) then --Support from1 and from in case of multiple rows text = string.format("%s%s",text,row(args, 1)) else text = string.format("%s%s",text,row(args, "")) end local i = 2 while (args["from" .. i]) do text = string.format("%s%s",text,row(args, i)) i = i + 1 --Check if from(i+1) exists end return textend local function multiText(args) local pageType if (mw.title.getCurrentTitle:inNamespace(1)) then pageType = "article" else pageType = "page" end local historyList = list(args) if (args["collapse"]
Copied pages: |
---|
%s |
local text = "Text has been copied to or from this %s; see the list below. The source pages now serve to 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" text = string.format(text, pageType, historyList) return textend
local function categories(args,multiUsed) local to_oldid = args["to_oldid"] or args["to_diff"] or args["diff"] or args["to_oldid1"] or args["to_diff1"] or args["diff1"] local from_oldid = args["from_oldid"] or args["from_oldid1"] local text = "" if ((not from_oldid) or (not to_oldid)) and not multiUsed then text = text .. "" end return textend
local function BannerText(args) --Checks if there are multiple rows local text local from2 = args["from2"] if (from2) then text = multiText(args) .. categories(args,true) else text = singleText(args) .. categories(args,false) end return textend
local function renderBanner(args) return MessageBox.main('tmbox',)end
function p.main(frame) local getArgs = require('Module:Arguments').getArgs local args = getArgs(frame) return renderBanner(args)end
return p