Module:Infobox MOS: Difference between revisions

Ganaram inukshuk (talk | contribs)
m Fixed section headers being duplicated for edr
Ganaram inukshuk (talk | contribs)
Transfered kb-vis code to new module
Line 6: Line 6:
--local xp = require('Module:Xenpaper') -- No xenpaper links for now
--local xp = require('Module:Xenpaper') -- No xenpaper links for now
local infobox = require('Module:Infobox')
local infobox = require('Module:Infobox')
local kbvis = require('Module:Keyboard vis')


-- TODO:
-- TODO:
Line 27: Line 28:
local brightest_mode = mos.brightest_mode(input_mos)
local brightest_mode = mos.brightest_mode(input_mos)
local CORNER_TL = '┌'
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 line_1 = CORNER_TL
local line_2 = BORDER_WHITE_KEY_SIDE
local line_3 = BORDER_WHITE_KEY_SIDE
local line_4 = CORNER_BL
for i = 1, #brightest_mode do
local current_step = brightest_mode:sub(i,i)
if current_step == "L" then
line_1 = line_1 .. BORDER_BLACK_KEY_TOP
line_2 = line_2 .. BORDER_BLACK_KEY_SIDE
line_3 = line_3 .. BORDER_WHITE_KEY_SIDE
line_4 = line_4 .. BORDER_KEY_BOTTOM
elseif current_step == "s" then
line_1 = line_1 .. BORDER_WHITE_KEY_TOP
line_2 = line_2 .. BORDER_WHITE_KEY_SIDE
line_3 = line_3 .. BORDER_WHITE_KEY_SIDE
line_4 = line_4 .. BORDER_KEY_BOTTOM
end
end
line_1 = line_1 .. CORNER_TR
line_2 = line_2 .. BORDER_WHITE_KEY_SIDE
line_3 = line_3 .. BORDER_WHITE_KEY_SIDE
line_4 = line_4 .. CORNER_BR
local vis = ""
local vis = ""
if input_mos.nL + input_mos.ns < 40 then
if input_mos.nL + input_mos.ns < 40 then
vis = string.format('<pre style="background-color: white; line-height: 1; font-family: Courier New, monospace; font-size: 1em; padding: 0.1em; margin: 0.1em">%s\n%s\n%s\n%s</pre>', line_1, line_2, line_3, line_4)
vis = kbvis.vis_small(brightest_mode)
end
end