Module:Shortcut: Difference between revisions
Jump to navigation
Jump to search
HyperNervie (talk | contribs) No edit summary |
HyperNervie (talk | contribs) (Add templatestyles) |
||
| Line 31: | Line 31: | ||
html:wikitext(noredirect(sc)) | html:wikitext(noredirect(sc)) | ||
end | end | ||
return tostring(html) | return tostring(html) .. frame:extensionTag{ | ||
name = "templatestyles", | |||
args = {src = "Shortcut/styles.css"} | |||
} | |||
end | end | ||
return p | return p | ||
Latest revision as of 08:54, 23 August 2025
Documentation for this module may be created at Module:Shortcut/doc
local p = {}
local function _noredirect(name)
return "\n*" .. mw.getCurrentFrame():expandTemplate{
title = "Noredirect", args = {name}
}
end
local function _noredirectTemplate(name)
return "\n*<code>{{" .. mw.getCurrentFrame():expandTemplate{
title = "Noredirect", args = {"Template:" .. name, name}
} .. "}}</code>"
end
function p.main(frame)
local args = {}
for k, v in pairs(frame:getParent().args) do
args[k] = mw.text.trim(v)
end
local noredirect = _noredirect
if args.template ~= nil and args.template ~= "" then
noredirect = _noredirectTemplate
end
local html = mw.html.create("div")
:addClass("shortcut-list")
:tag("div")
:addClass("shortcut-list-header")
:wikitext(#args > 1 and "Shortcuts" or "Shortcut")
:done()
for _, sc in ipairs(args) do
html:wikitext(noredirect(sc))
end
return tostring(html) .. frame:extensionTag{
name = "templatestyles",
args = {src = "Shortcut/styles.css"}
}
end
return p