Module:快捷键
跳转到导航
跳转到搜索
可在Module:快捷键/doc创建此模块的帮助文档
-- Module:快捷键
local p = {}
local getArgs = require('Dev:Arguments').getArgs
function p.nbsp(str)
local s = mw.ustring.gsub (str, " ", " ")
return s
end
function p.main(frame)
local args = getArgs(frame:getParent())
local hotkeys = {}
local style = {}
style['display'] = 'inline-flex'
style['align-items'] = 'center'
for i, key in ipairs(args) do
local s = p.nbsp(key)
local fmtkey = mw.html.create('span')
fmtkey
:attr('class', 'hotkey')
:wikitext(s)
fmtkey = tostring(fmtkey)
table.insert(hotkeys, fmtkey)
end
local out = mw.html.create('span')
out
:css(style)
:wikitext(table.concat(hotkeys, '+'))
return tostring(out)
end
return p