Module:Copied: Difference between revisions

Content deleted Content added
changes by User:Tule-hog to allow merge of Template:Merged-from
Only apply wikilink escaping on automatically determined titles to avoid stacking colons onto manually escaped links
 
(5 intermediate revisions by 4 users not shown)
Line 14:
local text
if (mergedFrom == 'yes') then
text = "The contentscontent of"
else
text = "Text and/or other creative content from"
Line 31:
text = text .. " was copied or moved into"
end
if (to == "") then -- If no target given assume current page is the target
ifto = ":" .. (mw.title.getCurrentTitle().nsText == "Talk") thensubjectPageTitle.fullText
end
text = string.format("%s [[%s]]", text,mw.title.getCurrentTitle( to).text)
else
text = string.format("%s [[%s:%s]]",text,mw.title.getCurrentTitle().nsText,mw.title.getCurrentTitle().text)
end
else
text = string.format("%s [[%s]]",text,to)
end
local diff = args["diff"] or args["diff1"]
local to_diff = args["to_diff"] or args["to_diff1"]
Line 61 ⟶ 56:
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 fromTalkfromPage = stringmw.formattitle.new("%s:%s", "Talk", from)
local fromTalk = fromPage and fromPage.talkPageTitle.fullText or "Talk:" .. from
text = string.format("%s For the discussion at that ___location, see its [[%s|talk page]].", text, fromTalk)
end
Line 86 ⟶ 82:
local talk = args["talk".. i] or ""
if (talk == "yes" or (args["mergedFrom"] == 'yes' and talk ~= "no")) then
local fromPage = mw.title.new(from)
text= string.format("%s[[%s:%s|talk]], ", text, "Talk", from)
local fromTalk = fromPage and fromPage.talkPageTitle.fullText or "Talk:" .. from
text = string.format("%s [[%s|talk]], ", text,to fromTalk)
end
local to = args["to".. i] or ""
if (to == "") then -- If no target given assume current page is the target
ifto = ":" .. (mw.title.getCurrentTitle().nsText == "Talk") thensubjectPageTitle.fullText
end
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)
Line 206 ⟶ 200:
 
local function renderBanner(args)
local image
if args.mergedFrom then
image = "[[Image:Mergefrom.svg|50px|alt=|link=]]"
else
image = '[[File:Splitsection.svg|frameless|upright=0.23|link=|alt=]]',
end
return MessageBox.main('tmbox', {
class = "copiednotice",
small = args["small"],
image = image,
image = '[[File:Splitsection.svg|frameless|upright=0.23|link=|alt=]]',
text = BannerText(args)
})