317
редагувань
starcitizen>Alistair3149 (Created page with "-- This module implements {{key press}}. local kbdPrefix = '<kbd class="keyboard-key nowrap">' local kbdSuffix = '</kbd>' local keyText = { ['caps lock'] = '⇪ Caps Lock', ['caps lock'] = '⇪ Caps Lock', ['shift'] = '⇧ Shift', ['shift'] = '⇧ Shift', ['enter'] = '↵ Enter', ['enter'] = '↵ Enter', ['cmd'] = '⌘ Cmd', ['cmd'] = '⌘ Cmd', ['command'] = '⌘...") |
м (6 ревізій: Template:Main_page/headerTemplate:Main page/header/styles.css) |
||
| (Не показані 5 проміжних версій 3 користувачів) | |||
| Рядок 164: | Рядок 164: | ||
end | end | ||
local lc = id:lower() | local lc = id:lower() | ||
local text = keyText[lc] or keyText[keyAlias[lc]] or | local text = keyText[lc] or keyText[keyAlias[lc]] | ||
result:add(kbdPrefix .. text .. kbdSuffix) | local leftRight = lc:match("^left ") or lc:match("^right ") | ||
if not text and leftRight then | |||
local _lc = lc:gsub("^" .. leftRight, "") | |||
local suffix = keyText[_lc] or keyText[keyAlias[_lc]] | |||
if suffix then | |||
text = leftRight:gsub("^%l", string.upper) .. " " .. suffix | |||
end | |||
end | |||
result:add(kbdPrefix .. (text or id) .. kbdSuffix) | |||
end | end | ||
return mw.getCurrentFrame():extensionTag{ | return mw.getCurrentFrame():extensionTag{ | ||
name = 'templatestyles', args = { src = ' | name = 'templatestyles', args = { src = 'Module:Key/styles.css'} | ||
} .. result:join() | } .. result:join() | ||
end | end | ||