local MessageBox = require("Module:Message box")local yesno = require("Module:Yesno")
local p =
local function demoCheck(args) return yesno(args["demo"]) or yesno(args["nocat"])end
local function showWarning(text, nocat) mw.addWarning(text) return nocat and "" or ""end
local function delink(text) if text
local function showError(text, nocat) return string.format("%s%s %s", nocat and "" or " ", tostring(mw.html.create("span") :css("color", "red") :css("font-weight", "bold") :wikitext("Error:") ), text )end
local function row(args, i) return mw.html.create("li"):wikitext(rowText)end
local function bannerText(frame, args) local text = "" local id = args["id"] or args["revid"] if id ~= nil then text = string.format("Revisions succeeding this version of this", id) else text = "This" end local citations = local i = 1 while (args[tostring(i)] or (args["articlename" .. i] or (i
1 and args["title"])) ) do if args[tostring(i)] then table.insert(citations, args[tostring(i)]) else local author = args["author" .. i] or (i
1 and args["date"])) or -- legacy way of providing dates string.format("%s %s", args["monthday" .. i] or (i
1 and args["year"]) or "" ) if mw.text.trim(date or "")
year%s
or date%s
parameter was not found, but a parenthesized year was found in the " .. "author%s
parameter. Move the provided year to the correct parameter.", i, i, i ), demoCheck(args)) else text = text .. " " .. showWarning(string.format("Provided title%s
must also have a respective year%s
or date%s
parameter.", i, i, i )) end endlocal display_authors = args["display-authors" .. i] or (i
text = string.format("%s article is substantially duplicated by a piece in an external publication. " .. "Please do not flag this article as a copyright violation of the following source", text ) local citationCount = #citations if citationCount
title
.", demoCheck(args) ) elseif citationCount > 1 then text = string.format("%ss:", text) else text = string.format("%s:", text) end local ul = mw.html.create("ul") for k, v in pairs(citations) do ul:node(mw.html.create("li"):wikitext(v)) end text = string.format("%s %s %s", text, tostring(ul), args["comments"] and tostring(mw.html.create("table") :attr("class", "mw-collapsible mw-collapsed") :attr("style", "width:100%; background-color: #f8eaba;") :node(mw.html.create("tr") :node(mw.html.create("th") :wikitext("Additional comments") ) ) :node(mw.html.create("tr"):node(mw.html.create("td") :attr("style", "background-color: white; border: 1px solid #c0c090; padding: 0.25em 0.5em;") :wikitext(args["comments"] ) )) ) or "" ) return textendfunction p.renderBanner(frame, args) return MessageBox.main('tmbox',) .. ((demoCheck(args) or mw.title.getCurrentTitle.namespace
function p.main(frame) local getArgs = require('Module:Arguments').getArgs local args = getArgs(frame,) return p.renderBanner(frame, args)end
return p