Module:Keyboard vis: Difference between revisions
ArrowHead294 (talk | contribs) mNo edit summary |
ArrowHead294 (talk | contribs) mNo edit summary |
||
| Line 1: | Line 1: | ||
local | local p = {} | ||
local | local CORNER_TL = '┌' -- U+250C ┌ | ||
local CORNER_TR = '┐' -- U+2510 ┐ | |||
local CORNER_BL = '└' -- U+2514 └ | |||
local CORNER_BR = '┘' -- U+2518 ┘ | |||
local BORDER_BLACK_KEY_TOP = '╥' -- U+2565 ╥ | |||
local BORDER_WHITE_KEY_TOP = '┬' -- U+252C ┬ | |||
local BORDER_KEY_BOTTOM = '┴' -- U+2534 ┴ | |||
local BORDER_BLACK_KEY_SIDE = '║' -- U+2551 ║ | |||
local BORDER_WHITE_KEY_SIDE = '│' -- U+2502 │ | |||
-- Produces a small keyboard visualization | -- Produces a small keyboard visualization | ||
-- Likely to display correctly on most devices | -- Likely to display correctly on most devices | ||
function p.vis_small(step_pattern | function p.vis_small(step_pattern) | ||
local step_pattern = step_pattern or "LLLsLLs" | local step_pattern = step_pattern or "LLLsLLs" | ||
| Line 40: | Line 40: | ||
line_4 = line_4 .. CORNER_BR | line_4 = line_4 .. CORNER_BR | ||
local | local result = '<pre style="' | ||
.. 'background-color: white; ' | .. 'background-color: white; ' | ||
.. 'line-height: 1; ' | .. 'line-height: 1; ' | ||
| Line 46: | Line 46: | ||
.. 'font-size: 1em; ' | .. 'font-size: 1em; ' | ||
.. 'padding: 0.1em; ' | .. 'padding: 0.1em; ' | ||
.. 'margin: 0.1em; | .. 'margin: 0.1em;">' | ||
.. string.format('\n%s\n%s\n%s\n%s\n', line_1, line_2, line_3, line_4) | .. string.format('\n%s\n%s\n%s\n%s\n', line_1, line_2, line_3, line_4) | ||
.. | .. '</pre>' | ||
return | return result | ||
end | end | ||
return p | return p | ||