Module documentation[view] [edit] [history] [purge]
This module has a corresponding template that is currently missing or does not use this module. (edit template)

This module displays a Halberstadt-like keyboard layout for a given MOS pattern, assuming a 2:1 step ratio.

Introspection summary for Module:Keyboard vis 
Functions provided (1)
Line Function Params
10 vis_small (step_pattern)
Lua modules required (0)
Variable Module Functions used

No function descriptions were provided. The Lua code may have further information.


local p = {}

local END_L				= '[[File:Keyboard_vis_end_left.png|20px]]'
local END_R				= '[[File:Keyboard_vis_end_right.png|20px]]'
local BORDER_BLACK_KEY	= '[[File:Keyboard_vis_border_black_key.png|20px]]'
local BORDER_WHITE_KEY	= '[[File:Keyboard_vis_border_white_key.png|20px]]'

-- Produces a small keyboard visualization
-- Likely to display correctly on most devices
function p.vis_small(step_pattern)
	local step_pattern = step_pattern or "LLLsLLs"
	
	local result = END_L
	
	for i = 1, #step_pattern do
		local current_step = step_pattern:sub(i,i)
		if current_step == "L" then
			result = result .. BORDER_BLACK_KEY
		elseif current_step == "s" then
			result = result .. BORDER_WHITE_KEY
		end
	end
	result = result .. END_R
	
	return result
end

return p