Module:Infobox MOS: Difference between revisions
ArrowHead294 (talk | contribs) mNo edit summary |
ArrowHead294 (talk | contribs) mNo edit summary |
||
| Line 22: | Line 22: | ||
-- Helper function | -- Helper function | ||
-- Create a keyboard visualization, based on the Halberstadt keyboard layout | -- Create a keyboard visualization, based on the Halberstadt keyboard layout | ||
function p.kb_vis(input_mos) | function p.kb_vis(input_mos, debug_mode) | ||
local input_mos = input_mos or mos.new(5, 2) | local input_mos = input_mos or mos.new(5, 2) | ||
| Line 29: | Line 29: | ||
local vis = "" | local vis = "" | ||
if input_mos.nL + input_mos.ns < 40 then | if input_mos.nL + input_mos.ns < 40 then | ||
vis = kbvis.vis_small(brightest_mode) | vis = kbvis.vis_small(brightest_mode, debug_mode) | ||
end | end | ||
| Line 389: | Line 389: | ||
-- New "main" function | -- New "main" function | ||
function p._infobox_mos(tuning, other_names_unparsed) | function p._infobox_mos(tuning, other_names_unparsed, debug_mode) | ||
local tuning = tuning or "5L 2s" | local tuning = tuning or "5L 2s" | ||
local other_names_unparsed = other_names_unparsed or "" | local other_names_unparsed = other_names_unparsed or "" | ||
debug_mode = (debug_mode == nil and false or debug_mode) | |||
local tuning_parsed = mos.parse(tuning) | local tuning_parsed = mos.parse(tuning) | ||
| Line 399: | Line 400: | ||
-- Keyboard visualization | -- Keyboard visualization | ||
local kb_vis = p.kb_vis(tuning_parsed) | local kb_vis = p.kb_vis(tuning_parsed, debug_mode) | ||
p.concatenate_tables(sections, kb_vis) | p.concatenate_tables(sections, kb_vis) | ||
| Line 456: | Line 457: | ||
local debug_mode = yesno(args["debug"]) | local debug_mode = yesno(args["debug"]) | ||
local result = p._infobox_mos(tuning, other_names) .. p.categorize(tuning) | local result = p._infobox_mos(tuning, other_names, debug_mode) .. p.categorize(tuning) | ||
return frame:preprocess(debug_mode == true and "<pre>" .. result .. "</pre>" or result) | return frame:preprocess(debug_mode == true and "<pre>" .. result .. "</pre>" or result) | ||
end | end | ||
return p | return p | ||