Module:Step vis: Difference between revisions

ArrowHead294 (talk | contribs)
mNo edit summary
ArrowHead294 (talk | contribs)
m +Debugging option
Line 4: Line 4:
-- Helper function
-- Helper function
-- Create a step visualization that's based on the table on the diasem page
-- Create a step visualization that's based on the table on the diasem page
function p.step_pattern_to_visualization(step_pattern)
function p.step_pattern_to_visualization(step_pattern, debug_mode)
local step_pattern = step_pattern or { 5, 2, 5, 0, 5, 2, 0 }
local step_pattern = step_pattern or { 5, 2, 5, 0, 5, 2, 0 }
local left_border = "├" -- U+251C ├
local left_border = (debug_mode == true and "├" or "├") -- U+251C ├
local right_border = "┤" -- U+2524 ┤
local right_border = (debug_mode == true and "┤" or "┤") -- U+2524 ┤
local no_border = "─" -- U+2500 ─
local no_border = (debug_mode == true and "─" or "─") -- U+2500 ─
local double_border = "╫" -- U+256B ╫
local double_border = (debug_mode == true and "╫" or "╫") -- U+256B ╫
local double_border_left = "╟" -- U+255F ╟
local double_border_left = (debug_mode == true and "╟" or "╟") -- U+255F ╟
local double_border_right = "╢" -- U+2562 ╢
local double_border_right = (debug_mode == true and "╢" or "╢") -- U+2562 ╢
local single_border = "┼" -- U+253C ┼
local single_border = (debug_mode == true and "┼" or "┼") -- U+253C ┼
local step_visualization = ""
local step_visualization = ""
Line 43: Line 43:
- This removes the double centre border at the end if the second-to-last and last steps are both 0
- This removes the double centre border at the end if the second-to-last and last steps are both 0
]]--
]]--
step_visualization = string.sub(step_visualization, 1, -9)
step_visualization = (debug_mode == true and string.sub(step_visualization, 1, -13) or string.sub(step_visualization, 1, -9))
end
end
current_step_vis = double_border_right
current_step_vis = double_border_right
Line 77: Line 77:
function p.step_vis_frame(frame)
function p.step_vis_frame(frame)
local step_pattern = tip.parse_numeric_entries(frame.args["Step Pattern"], " ")
local step_pattern = tip.parse_numeric_entries(frame.args["Step Pattern"], " ")
return p.step_pattern_to_visualization(step_pattern)
local debugg = yesno(frame.args["debug"])
return p.step_pattern_to_visualization(step_pattern, debugg)
end
end


return p
return p