Home
Random
Recent changes
Special pages
Community portal
Preferences
About Stockhub
Disclaimers
Search
User menu
Talk
Contributions
Create account
Log in
Editing
Module:Old move/sandbox
Warning:
You are not logged in. Your IP address will be publicly visible if you make any edits. If you
log in
or
create an account
, your edits will be attributed to your username, along with other benefits.
Anti-spam check. Do
not
fill this in!
local MessageBox = require('Module:Message box') local p = {} local datemodule = require('Module:Date')._Date local function singleText(args) local pageType if (mw.title.getCurrentTitle():inNamespace(1)) then pageType = "article" else pageType = "page" end local date = args["date"] or args["date1"] or "" local from = args["from"] or args["from1"] or "" local to = args["destination"] or args["destination1"] or args["to1"] or args["to"] or "" local result = args["result"] or args["result1"] or "" local link = args["link"] or args["link1"] or "" local dateformat = args["dateformat"] or "mdy" local text = "" if not (date == "") then if datemodule(date) then date = datemodule(date):text(dateformat) end text = string.format("On %s, it was proposed that this %s be [[Wikipedia:Requested moves|moved]]",date,pageType) else text = string.format("It has previously been proposed that this %s be [[Wikipedia:Requested moves|moved]]",pageType) end if not (from == "") then text = string.format("%s from [%s %s]",text,tostring(mw.uri.fullUrl(from, {redirect = "no"} )), from) end if not (to == "") then text = string.format("%s to [[%s]]",text, to) end text = string.format("%s.",text) if not (result == "") then if not (link == "") then text = string.format("%s The result of [[%s|the discussion]] was '''%s'''.",text,link,result) else text = string.format("%s The result of the discussion was '''%s'''.",text,result) end else if not (link == "") then text = string.format("%s See [[%s|discussion]].",text,link) end end return text end local function row(args, i) local pageType if (mw.title.getCurrentTitle():inNamespace(1)) then pageType = "article" else pageType = "page" end local date = args["date" .. i] or "" local from = args["from" .. i] or "" local dateformat = args["dateformat"] or "mdy" local to = args["destination" .. i] or args["to" .. i] or "" local result = mw.language.getContentLanguage():ucfirst(args["result" .. i]) or "" local link = args["link" .. i] or "" local text = string.format("\n*'''%s'''",result) if not (date == "") then if datemodule(date) then date = datemodule(date):text(dateformat) end text = string.format("%s, %s",text,date) end if not (from == "") then text = string.format("%s, from [%s %s]",text,tostring(mw.uri.fullUrl(from, {redirect = "no"} )), from) if not (to == "") then text = string.format("%s to [[%s]]",text, to) end else if not (to == "") then text = string.format("%s, to [[%s]]",text,to) end end if not (link == "") then text = string.format("%s, see [[%s|discussion]]",text,link) end text = text .. "." return text end local function list(args) local text = "" local multiple = args["result1"] or "" if not (multiple == "") then --Support to1 and to 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 i > 0 do if (args["result" .. i]) then text = string.format("%s%s",text,row(args, i)) i = i + 1 --Check if to(i+1) exist else i = - 1 --Break if fromi doesn't exist end end return text end local function multiText(args) local pageType if (mw.title.getCurrentTitle():inNamespace(0)) then pageType = "article" else pageType = "page" end local historyList = list(args) local text = string.format("This %s has previously been nominated to be moved.", pageType) text = string.format("%s\n%s", text, historyList) return text end local function BannerText(args) --Checks if there are multiple rows local text local multiple = args["result2"] or "" if not (multiple == "") then text = multiText(args) else text = singleText(args) end return text end local function renderBanner(args) return MessageBox.main('tmbox', { small = args["small"], type = 'move', text = BannerText(args) }) end function p.main(frame) local getArgs = require('Module:Arguments').getArgs local args = getArgs(frame) return renderBanner(args) end return p
Summary:
Please note that all contributions to Stockhub may be edited, altered, or removed by other contributors. If you do not want your writing to be edited mercilessly, then do not submit it here.
You are also promising us that you wrote this yourself, or copied it from a public domain or similar free resource (see
Stockhub:Copyrights
for details).
Do not submit copyrighted work without permission!
Cancel
Editing help
(opens in new window)
Template used on this page:
Module:Old move/sandbox/doc
(
edit
)