Module:Variable arguments: Difference between revisions

ArrowHead294 (talk | contribs)
m Undid revision 198236 by ArrowHead294 (talk)
Tag: Undo
ArrowHead294 (talk | contribs)
mNo edit summary
 
(10 intermediate revisions by 2 users not shown)
Line 28: Line 28:
end
end
result = "<div class=\"mw-content-subtitle2\">\n"
result = "<div class=\"mw-content-subtitle2\">"
.. "<div class=\"breadcrumb-article\">"
.. "<div class=\"breadcrumb-article\">"
.. "<div class=\"subpages\">" .. string.format("&lt; <bdi dir=\"ltr\">%s</bdi>", result) .. "</div>\n"
.. string.format("<div class=\"subpages\">&lt; <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"
})
})
return frame:preprocess(yesno(debugg) == true and "<syntaxhighlight lang=\"wikitext\">" .. result .. "</syntaxhighlight>" or result)
if yesno(debugg) == true then
result = "<syntaxhighlight lang=\"wikitext\">" .. result .. "</syntaxhighlight>"
end
return frame:preprocess(result)
end
end


Line 47: Line 52:
     local namespace = string.lower(frame:preprocess("{{NAMESPACE}}"))
     local namespace = string.lower(frame:preprocess("{{NAMESPACE}}"))
local result = ""
local result = ""
local i = 0
local i = 1
for k, v in pairs(args) do
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 .. (v == debugg and "" or string.format(fmt, frame:preprocess(string.format("{{ucfirst: %s}}", v))))
i = i + 1
i = i + 1
end
end
Line 61: Line 66:
end
end
result = "<div class=\"sidebox\">\n"
result = "{{sidebox\n| image = Lua-Logo.svg\n| image size = 30px\n| text = "
.. "{|\n"
.. string.format("%s:\n%s\n",
.. "|-\n"
.. "| <span class=\"sidebox-image\">[[File:Lua-Logo.svg|30px]]</span>"
.. " || <span class=\"sidebox-text\">"
.. string.format("%s:\n%s</span>\n",
(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 [[wikipedia:wp:Lua|Lua]]"),
or "This template uses {{wlink|Lua|s=wp}}"),
result)
result)
.. "|}\n</div>"
.. "}}"
.. mw.getCurrentFrame():extensionTag("templatestyles", "", {
 
src = "Module:Variable arguments/styles.css"
if yesno(debugg) == true then
})
result = "<syntaxhighlight lang=\"wikitext\">" .. result .. "</syntaxhighlight>"
return frame:preprocess(yesno(debugg) == true and "<syntaxhighlight lang=\"wikitext\">" .. result .. "</syntaxhighlight>" or result)
end
return frame:preprocess(result)
end
end


Line 95: Line 98:
if result == nil or utils.trim(result) == "" then
if result == nil or utils.trim(result) == "" then
result = ""
return ""
end
if yesno(debugg) == true then
result = "<syntaxhighlight lang=\"wikitext\">" .. result .. "</syntaxhighlight>"
end
end
return frame:preprocess(yesno(debugg) == true and "<syntaxhighlight lang=\"wikitext\">" .. result .. "</syntaxhighlight>" or result)
return frame:preprocess(result)
end
end


Line 130: Line 137:
    .. "{{clear}}</div>"
    .. "{{clear}}</div>"
    .. mw.getCurrentFrame():extensionTag("templatestyles", "", {
    .. mw.getCurrentFrame():extensionTag("templatestyles", "", {
src = "Module:Variable arguments/styles.css"
src = "Template:Wikipedia/styles.css"
})
})
return frame:preprocess(yesno(debugg) == true and "<syntaxhighlight lang=\"wikitext\">" .. result .. "</syntaxhighlight>" or result)
if yesno(debugg) == true then
result = "<syntaxhighlight lang=\"wikitext\">" .. result .. "</syntaxhighlight>"
end
return frame:preprocess(result)
end
end


return p
return p