Module:Variable arguments: Difference between revisions

ArrowHead294 (talk | contribs)
mNo edit summary
ArrowHead294 (talk | contribs)
mNo edit summary
Line 59: Line 59:
result = "<div class=\"mbox-lua\" "
result = "<div class=\"mbox-lua\" "
.. string.format("style=\"width: %ipx;\">\n",
.. string.format("style=\"width: %ipx;\">\n", (namespace == "module" and 272 or 238))
(namespace == "module" and 272 or 238))
.. "{|\n"
.. "{|\n"
.. "|-\n"
.. "|-\n"
Line 96: Line 95:
end
end
return frame:preprocess(yesno(debugg) == true and "<syntaxhighlight lang=\"wikitext\">" .. result .. "</syntaxhighlight>" or result)
end
function p.ts_banner(frame)
local args = mArguments.getArgs(frame, {
    parentOnly = true
    })
    local debugg = frame.args.debug_mode or args.debug_mode
    local fmt = "* [[%s]]\n"
    local namespace = string.lower(frame:preprocess("{{NAMESPACE}}"))
local result = ""
local i = 0
for k, v in pairs(args) do
result = result .. (v == debugg and "" or string.format(fmt, frame:preprocess(string.format("{{ucfirst:%s}}", v))))
i = i + 1
end
result = result:sub(1, -2)
if result == nil or utils.trim(result) == "" then
local arpn_s = frame:preprocess("{{ARTICLEROOTPAGENAME}}/styles.css")
result = string.format(fmt, arpn_s)
end
result = "<div class=\"mbox-lua\" "
.. string.format("style=\"width: %ipx;\">\n", (namespace == "module" and 272 or 238))
.. "{|\n"
.. "|-\n"
.. "| <span style=\"line-height: 110%; display: inline-block; "
.. "margin: 0.125em 0em 0.125em 0.792em;\">[[File:Farm-Fresh_css_add.svg|32px]]</span>"
.. " || <span style=\"display: inline-block; font-size: 0.88em; "
.. "line-height: 110%; padding: 0.22em 0.22em 0.22em 0.792em;\">"
.. string.format("This %s uses [[mw:extension:TemplateStyles|TemplateStyles]]:\n%s</span>\n",
namespace, result)
.. "|}\n</div>"
return frame:preprocess(yesno(debugg) == true and "<syntaxhighlight lang=\"wikitext\">" .. result .. "</syntaxhighlight>" or result)
return frame:preprocess(yesno(debugg) == true and "<syntaxhighlight lang=\"wikitext\">" .. result .. "</syntaxhighlight>" or result)
end
end