Module:Variable arguments: Difference between revisions
Jump to navigation
Jump to search
ArrowHead294 (talk | contribs) mNo edit summary |
ArrowHead294 (talk | contribs) mNo edit summary |
||
| Line 60: | Line 60: | ||
.. "{|\n" | .. "{|\n" | ||
.. "|-\n" | .. "|-\n" | ||
.. "| | .. "| style=\"line-height: 110%; display: inline-block; " | ||
.. "margin: 0.125em 0em 0.125em 0.792em;\" | .. "margin: 0.125em 0em 0.125em 0.792em;\" | [[File:Lua-Logo.svg|30px]]" | ||
.. " || | .. " || style=\"display: inline-block; font-size: 0.88em; " | ||
.. "line-height: 110%; padding: 0.22em 0.22em 0.22em 0.792em;\" | .. "line-height: 110%; padding: 0.22em 0.22em 0.22em 0.792em;\" | " | ||
.. string.format("This template uses [[wikipedia:WP:Lua|Lua]]:\n%s | .. string.format("This template uses [[wikipedia:WP:Lua|Lua]]:\n%s\n", result) | ||
.. "|}\n</div>" | .. "|}\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) | ||
Revision as of 12:40, 13 May 2025
- This module should not be invoked directly; use its corresponding templates instead.
This module is used to store functions for templates that take a variable number of arguments but do not use Module:Labelled list hatnote:
| Introspection summary for Module:Variable arguments | ||||||||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
| |||||||||||||||||||||||||||
No function descriptions were provided. The Lua code may have further information.
local mArguments = require("Module:Arguments")
local utils = require("Module:Utils")
local yesno = require("Module:Yesno")
local p = {}
function p.breadcrumb(frame)
local args = mArguments.getArgs(frame, {
parentOnly = true
})
local debugg = frame.args.debug_mode or args.debug_mode
local result = ""
local i = 0
local pname = ""
for k, v in pairs(args) do
pname = pname .. v
result = result .. (v == debugg and "" or string.format("[[%s|%s]] {{pipe}} ", pname, v))
i = i + 1
pname = pname .. "/"
end
result = result:sub(1, -11)
if utils.trim(result) == "" or result == nil then
result = "[[{{#titleparts: {{FULLPAGENAME}}|-1}}]]"
end
result = "<div id=\"contentSub\">\n"
.. "<div id=\"mw-content-subtitle\">\n"
.. "<div style=\"margin: 0.5em;\"></div>\n"
.. "<div class=\"nomobile\" style=\"margin: -0.8em;\"></div>\n"
.. string.format("<div class=\"subpages\" style=\"margin-top: -0.1em;\">< <bdi dir=\"ltr\">%s</bdi></div>\n", result)
.. "</div>\n</div>{{#if: {{ARTICLESPACE}}||[[Category:Article subpages]]}}"
return frame:preprocess(yesno(debugg) == true and "<syntaxhighlight lang=\"wikitext\">" .. result .. "</syntaxhighlight>" or result)
end
function p.lua_banner(frame)
local args = mArguments.getArgs(frame, {
parentOnly = true
})
local debugg = frame.args.debug_mode or args.debug_mode
local result = ""
local i = 0
for k, v in pairs(args) do
result = result .. (v == debugg and "" or string.format("* [[Module:%s]]\n", v))
i = i + 1
end
result = result:sub(1, -2)
if utils.trim(result) == "" or result == nil then
result = "* [[Module:{{ROOTPAGENAME}}]]\n"
end
result = "<div style=\"border-collapse: collapse; border: 1px solid #a2a9b1;"
.. " background-color: #f8f9fa; box-sizing: border-box; clear: right; "
.. "color: #202122; float: right; font-size: 16px; margin: 0 0 4px 4px; width: 238px;\">\n"
.. "{|\n"
.. "|-\n"
.. "| style=\"line-height: 110%; display: inline-block; "
.. "margin: 0.125em 0em 0.125em 0.792em;\" | [[File:Lua-Logo.svg|30px]]"
.. " || style=\"display: inline-block; font-size: 0.88em; "
.. "line-height: 110%; padding: 0.22em 0.22em 0.22em 0.792em;\" | "
.. string.format("This template uses [[wikipedia:WP:Lua|Lua]]:\n%s\n", result)
.. "|}\n</div>"
return frame:preprocess(yesno(debugg) == true and "<syntaxhighlight lang=\"wikitext\">" .. result .. "</syntaxhighlight>" or result)
end
function p.nwr(frame)
local args = mArguments.getArgs(frame, {
parentOnly = true
})
local debugg = frame.args.debug_mode or args.debug_mode
local result = ""
local i = 0
for k, v in pairs(args) do
result = result .. (v == debugg and "" or
string.format("<span style=\"white-space: nowrap;\">%s</span>, ", string.gsub(v, "^%s*(.-)%s*$", "%1")))
i = i + 1
end
result = result:sub(1, -3)
if utils.trim(result) == "" or result == nil then
result = ""
end
return frame:preprocess(yesno(debugg) == true and "<syntaxhighlight lang=\"wikitext\">" .. result .. "</syntaxhighlight>" or result)
end
function p.wikipedia(frame)
local args = mArguments.getArgs(frame, {
parentOnly = true
})
local debugg = frame.args.debug_mode or args.debug_mode
local result = ""
local i = 0
for k, v in pairs(args) do
v = string.gsub(v, "^%s*(.-)%s*$", "%1")
if string.lower(v) ~= "false" and string.lower(v) ~= "true" then
result = result .. (v == debugg and "" or string.format("<div style=\"margin-left: 10px;\">'''{{w|%s}}'''</div>\n", v))
end
i = i + 1
end
if utils.trim(result) == "" or result == nil then
result = "<div style=\"margin-left: 10px;\">'''{{w|{{ARTICLEROOTPAGENAME}}}}'''</div>\n"
end
result = "<div style=\"background: #f9f9f9; border: 1px solid #aaa; clear: right; float: right; "
.. "font-size: 90%; width: 300px; margin: 0 0 4px 4px; padding: 4px; text-align: left;\">\n"
.. "<div style=\"float: left;\">[[File:Wikipedia-logo.png|44px|none|link=|alt=]]</div>\n"
.. "<div style=\"margin-left: 60px;\">"
.. string.format("English [[Wikipedia:Main Page|Wikipedia]] has %s on:\n%s</div>", (i > 1 and "articles" or "an article"), result)
.. "{{clear}}</div>"
return frame:preprocess(yesno(debugg) == true and "<syntaxhighlight lang=\"wikitext\">" .. result .. "</syntaxhighlight>" or result)
end
return p