Jump to content
Main menu
Main menu
move to sidebar
hide
Navigation
Main Page
Community Portal
Village Pump
Recent Changes
Upload File
Help
Help Contents
Editing Guide
Repair Guide Template
Sandbox
Browse Wiki
๐ Service Manuals
๐ Schematics
๐ Apple
๐ฎ Nintendo
๐ Sega
โก Troubleshooting
Search
Search
Appearance
Create account
Log in
Personal tools
Create account
Log in
Pages for logged out editors
learn more
Contributions
Talk
Editing
Module:Key
Module
Discussion
English
Read
Edit source
View history
Tools
Tools
move to sidebar
hide
Actions
Read
Edit source
View history
General
What links here
Related changes
Page information
Appearance
move to sidebar
hide
Warning:
You are not logged in. Your IP address will be publicly visible if you make any edits. If you
log in
or
create an account
, your edits will be attributed to your username, along with other benefits.
Anti-spam check. Do
not
fill this in!
-- 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 key|shift]]'] = 'โง [[Shift key|Shift]]', ['enter'] = 'โต Enter', ['[[enter key|enter]]'] = 'โต [[Enter key|Enter]]', ['cmd'] = 'โ Cmd', ['[[command key|cmd]]'] = 'โ [[Command key|Cmd]]', ['command'] = 'โ Command', ['[[command key|command]]'] = 'โ [[Command key|Command]]', ['opt'] = 'โฅ Opt', ['[[option key|opt]]'] = 'โฅ [[Option key|Opt]]', ['option'] = 'โฅ Option', ['[[option key|option]]'] = 'โฅ [[Option key|Option]]', ['tab'] = 'Tab โน', ['[[tab key|tab]]'] = '[[Tab key|Tab]] โน', ['backspace'] = 'โ Backspace', ['[[backspace]]'] = 'โ [[Backspace]]', ['win'] = 'โ Win', ['[[windows key|win]]'] = 'โ [[Windows key|Win]]', ['menu'] = 'โฃ Menu', ['[[menu key|menu]]'] = 'โฃ [[Menu key|Menu]]', ['up'] = 'โ', ['[[arrow keys|up]]'] = '[[Arrow keys|โ]]', ['down'] = 'โ', ['[[arrow keys|down]]'] = '[[Arrow keys|โ]]', ['left'] = 'โ', ['[[arrow keys|left]]'] = '[[Arrow keys|โ]]', ['right'] = 'โ', ['[[arrow keys|right]]'] = '[[Arrow keys|โ]]', ['asterisk'] = '*', ['hash'] = '#', ['[[#]]'] = '[[Number sign|#]]', ['colon'] = ':', ['[[:]]'] = '[[Colon (punctuation)|:]]', ['pipe'] = '|', ['[[|]]'] = '[[Pipe symbol||]]', ['semicolon'] = ';', ['[[;]]'] = '[[Semi-colon|;]]', ['equals'] = '=', -- Left & right analog sticks. ['l up'] = 'Lโ', ['l down'] = 'Lโ', ['l left'] = 'Lโ', ['l right'] = 'Lโ', ['l ne'] = 'Lโ', ['l se'] = 'Lโ', ['l nw'] = 'Lโ', ['l sw'] = 'Lโ', ['r up'] = 'Rโ', ['r down'] = 'Rโ', ['r left'] = 'Rโ', ['r right'] = 'Rโ', ['r ne'] = 'Rโ', ['r se'] = 'Rโ', ['r nw'] = 'Rโ', ['r sw'] = 'Rโ', -- PlayStation. ['ex'] = 'ร', ['circle'] = 'โ', ['square'] = 'โก', ['triangle'] = 'โณ', -- Nintendo 64 and GameCube. ['c up'] = 'Cโ', ['c down'] = 'Cโ', ['c left'] = 'Cโ', ['c right'] = 'Cโ', ['c ne'] = 'Cโ', ['c se'] = 'Cโ', ['c nw'] = 'Cโ', ['c sw'] = 'Cโ', } local keyAlias = { -- ['alternate name for key (alias)'] = 'name for key used in key table' ['[[cmd key|cmd]]'] = '[[command key|cmd]]', ['[[cmd key|command]]'] = '[[command key|command]]', ['[[opt key|opt]]'] = '[[option key|opt]]', ['[[option key]]'] = '[[option key|option]]', ['[[opt key|option]]'] = '[[option key|option]]', ['[[win key|win]]'] = '[[windows key|win]]', ['*'] = 'asterisk', ['#'] = 'hash', [':'] = 'colon', [';'] = 'semicolon', ['l-up'] = 'l up', ['l-down'] = 'l down', ['l-left'] = 'l left', ['l-right'] = 'l right', ['l-ne'] = 'l ne', ['l-se'] = 'l se', ['l-nw'] = 'l nw', ['l-sw'] = 'l sw', ['r-up'] = 'r up', ['r-down'] = 'r down', ['r-left'] = 'r left', ['r-right'] = 'r right', ['r-ne'] = 'r ne', ['r-se'] = 'r se', ['r-nw'] = 'r nw', ['r-sw'] = 'r sw', ['ps x'] = 'ex', ['ps c'] = 'circle', ['ps s'] = 'square', ['ps t'] = 'triangle', ['c-up'] = 'c up', ['c-down'] = 'c down', ['c-left'] = 'c left', ['c-right'] = 'c right', ['c-ne'] = 'c ne', ['c-se'] = 'c se', ['c-nw'] = 'c nw', ['c-sw'] = 'c sw', } local Collection = {} Collection.__index = Collection do function Collection:add(item) if item ~= nil then self.n = self.n + 1 self[self.n] = item end end function Collection:join(sep) return table.concat(self, sep) end function Collection:sort(comp) table.sort(self, comp) end function Collection.new() return setmetatable({n = 0}, Collection) end end local function keyPress(args) local chainNames = { 'chain first', 'chain second', 'chain third', 'chain fourth', 'chain fifth', 'chain sixth', 'chain seventh', 'chain eighth', 'chain ninth', } local result = Collection.new() local chainDefault = args.chain or '+' for i, id in ipairs(args) do if i > 1 then result:add(args[chainNames[i - 1]] or chainDefault) end local lc = id:lower() local text = keyText[lc] or keyText[keyAlias[lc]] or id result:add(kbdPrefix .. text .. kbdSuffix) end return mw.getCurrentFrame():extensionTag{ name = 'templatestyles', args = { src = 'Template:Key press/styles.css'} } .. result:join() end local function keypress(frame) -- Called by "{{key press|...}}". -- Using the template doubles the postโexpand include size. return keyPress(frame:getParent().args) end local function press(frame) -- Called by "{{#invoke:key|press|...}}". return keyPress(frame.args) end return { keypress = keypress, press = press, }
Summary:
Please note that all contributions to RetroTechCollection may be edited, altered, or removed by other contributors. If you do not want your writing to be edited mercilessly, then do not submit it here.
You are also promising us that you wrote this yourself, or copied it from a public domain or similar free resource (see
RetroTechCollection:Copyrights
for details).
Do not submit copyrighted work without permission!
Cancel
Editing help
(opens in new window)
Page included on this page:
Module:Key/doc
(
edit
)
Search
Search
Editing
Module:Key
Add topic