Module:Keyboard vis: Difference between revisions

ArrowHead294 (talk | contribs)
mNo edit summary
ArrowHead294 (talk | contribs)
mNo edit summary
Line 1: Line 1:
local CORNER_TL = '┌'
local p = {}
local CORNER_TR = '┐'
local CORNER_BL = '└'
local CORNER_BR = '┘'
local BORDER_BLACK_KEY_TOP = '╥'
local BORDER_WHITE_KEY_TOP = '┬'
local BORDER_KEY_BOTTOM = '┴'
local BORDER_BLACK_KEY_SIDE = '║'
local BORDER_WHITE_KEY_SIDE = '│'


local p = {}
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, debug_mode)
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 out_str = (debug_mode == true and '&lt;pre style=&quot;' or '<pre style="')
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;">'
.. (debug_mode == true and '&quot;&gt;' or '">')
.. 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)
.. (debug_mode == true and '&lt;/pre&gt;' or '</pre>')
.. '</pre>'
return out_str
return result
end
end


return p
return p