Module:Variable arguments: Difference between revisions
ArrowHead294 (talk | contribs) mNo edit summary |
ArrowHead294 (talk | contribs) mNo edit summary |
||
| (11 intermediate revisions by 2 users not shown) | |||
| Line 28: | Line 28: | ||
end | end | ||
result = "<div class=\"mw-content-subtitle2\"> | result = "<div class=\"mw-content-subtitle2\">" | ||
.. "<div class=\"breadcrumb-article\">" | .. "<div class=\"breadcrumb-article\">" | ||
.. "<div class=\"subpages\"> | .. string.format("<div class=\"subpages\">< <bdi dir=\"ltr\">%s</bdi></div>", result) | ||
.. "</div></div>" | .. "</div></div>" | ||
.. "{{#if: {{ARTICLESPACE}}||[[Category:Article subpages]]}}" | .. "{{#if: {{ARTICLESPACE}}||[[Category:Article subpages]]}}" | ||
| Line 36: | Line 36: | ||
src = "Template:Breadcrumb/styles.css" | src = "Template:Breadcrumb/styles.css" | ||
}) | }) | ||
if yesno(debugg) == true then | |||
result = "<syntaxhighlight lang=\"wikitext\">" .. result .. "</syntaxhighlight>" | |||
end | |||
return frame:preprocess(result) | |||
end | end | ||
function p.lua_banner(frame) | function p.lua_banner(frame) | ||
local args = mArguments.getArgs(frame, { | |||
parentOnly = true | |||
}) | |||
local debugg = frame.args.debug_mode or args.debug_mode | local debugg = frame.args.debug_mode or args.debug_mode | ||
local fmt = "* [[Module: %s]]\n" | local fmt = "* [[Module: %s]]\n" | ||
| Line 49: | Line 54: | ||
local i = 1 | local i = 1 | ||
for k, v in pairs(args) do | |||
result = result .. (v == debugg and "" or string.format(fmt, frame:preprocess(string.format("{{ucfirst: %s}}", v)))) | |||
result = result .. string.format(fmt, frame:preprocess(string.format("{{ucfirst:%s}}", | |||
i = i + 1 | i = i + 1 | ||
end | end | ||
| Line 65: | Line 66: | ||
end | end | ||
result = " | result = "{{sidebox\n| image = Lua-Logo.svg\n| image size = 30px\n| text = " | ||
.. string.format("%s:\n%s\n", | |||
.. string.format("%s:\n%s | |||
(namespace == "module" | (namespace == "module" | ||
and "This module depends on the following other modules" | and "This module depends on the following other modules" | ||
or "This template uses | or "This template uses {{wlink|Lua|s=wp}}"), | ||
result) | result) | ||
.. " | .. "}}" | ||
if yesno(debugg) == true then | |||
result = "<syntaxhighlight lang=\"wikitext\">" .. result .. "</syntaxhighlight>" | |||
end | |||
return frame:preprocess(result) | |||
end | end | ||
| Line 99: | Line 98: | ||
if result == nil or utils.trim(result) == "" then | if result == nil or utils.trim(result) == "" then | ||
return "" | |||
end | end | ||
if yesno(debugg) == true then | |||
result = "<syntaxhighlight lang=\"wikitext\">" .. result .. "</syntaxhighlight>" | |||
end | |||
return frame:preprocess(result) | |||
end | end | ||
| Line 134: | Line 137: | ||
.. "{{clear}}</div>" | .. "{{clear}}</div>" | ||
.. mw.getCurrentFrame():extensionTag("templatestyles", "", { | .. mw.getCurrentFrame():extensionTag("templatestyles", "", { | ||
src = " | src = "Template:Wikipedia/styles.css" | ||
}) | }) | ||
if yesno(debugg) == true then | |||
result = "<syntaxhighlight lang=\"wikitext\">" .. result .. "</syntaxhighlight>" | |||
end | |||
return frame:preprocess(result) | |||
end | end | ||
return p | return p | ||