模組:DeletedPageCopied
外观
local MessageBox = require('Module:Message box')
local p = {}
local function singleText(args)
local from = args["from"] or ""
local to = args["to"] or ""
local date = args["date"] or ""
local afd = args["afd"] or ""
local text = "内容"
text = string.format("[[%s]]的%s",from,text)
from = string.gsub(from, " ", "_")
local diff = args["diff"]
local to_diff = args["to_diff"]
local to_oldid = args["to_oldid"]
if not (date == "") then
if (diff) then
text = string.format("%s在%s的[%s 这一编辑]中",text,date,diff)
elseif (to_oldid or to_diff) then
text = string.format("%s在%s的[%s 这一编辑]中",text,date,tostring(mw.uri.fullUrl(to, {diff=to_diff or "next", oldid = to_oldid or "prev"} )))
else
text = string.format("%s在%s",text,date)
end
end
if (date == "") then
if (diff) then
text = string.format("%s在[%s 这一编辑]中",text,diff)
elseif (to_oldid or to_diff) then
text = string.format("%s在[%s 这一编辑]中",text,tostring(mw.uri.fullUrl(to, {diff=to_diff or "next", oldid = to_oldid or "prev"} )))
end
end
text = string.format("%s被複製到[[%s]]",text,to)
if not (afd == "") then
if (mw.ustring.match(afd, "Wikipedia:", 1 )) then --如果没有给出讨论链接,则添加“Wikipedia:頁面存廢討論”前缀
text = string.format("经[[%s|頁面存廢討論]],%s",afd,text)
else
text = string.format("经[[Wikipedia:頁面存廢討論/%s|頁面存廢討論]],%s",afd,text)
end
end
text = text .. "。" -- 第一句完成
text = string.format("%s原作者見[%s 被刪除頁面歷史]。",text,string.format("https://archivesearch.toolforge.org/?q=%s&by=epage", from) or "")
return text
end
local function categories(args,multiUsed)
local to_oldid = args["to_oldid"] or args["to_diff"] or args["diff"]
local text = "[[Category:曾複製或移動自已刪除頁面的頁面]]"
if (not to_oldid) and not multiUsed then
text = text .. "[[Category:未填寫oldid的已刪除頁面複製模板頁面]]"
end
return text
end
local function renderBanner(args)
return MessageBox.main('tmbox', {
class = "copiednotice",
small = args["small"],
image = '[[File:Splitsection.svg|50px]]',
text = singleText(args) .. categories(args,false)
})
end
function p.main(frame)
local getArgs = require('Module:Arguments').getArgs
local args = getArgs(frame)
return renderBanner(args)
end
return p