Module:MOS in EDO: Difference between revisions

ArrowHead294 (talk | contribs)
No edit summary
ArrowHead294 (talk | contribs)
mNo edit summary
Line 1: Line 1:
local mos = require('Module:MOS')
local mos = require("Module:MOS")
local utils = require('Module:Utils')
local utils = require("Module:Utils")
local tamnams = require('Module:TAMNAMS')
local tamnams = require("Module:TAMNAMS")
local p = {}
local p = {}


Line 7: Line 7:
-- Dark blue for large steps, light blue for small steps
-- Dark blue for large steps, light blue for small steps
-- For mosses that are reversed (starts with s and ends with L), use orange instead
-- For mosses that are reversed (starts with s and ends with L), use orange instead
p.cell_color_none = "NONE" -- For cells that don't have a color (default cell color applies)
p.cell_color_none = "" -- For cells that don't have a color (default cell color applies)
p.cell_color_perfect_size = "NONE" -- Only applies for steps of an edo
p.cell_color_perfect_size = "" -- Only applies for steps of an edo
p.cell_color_large = "BDD7EE"
p.cell_color_large = "#BDD7EE"
p.cell_color_small = "DDEBF7"
p.cell_color_small = "#DDEBF7"
p.cell_color_lg_rev = "F8CBAD"
p.cell_color_lg_rev = "#F8CBAD"
p.cell_color_sm_rev = "FCE4D6"
p.cell_color_sm_rev = "#FCE4D6"


-- Helper function
-- Helper function
Line 240: Line 240:
-- Create table, starting with headers
-- Create table, starting with headers
local result = string.format('{| class="wikitable center-all"\n')
local result = "{| class=\"wikitable center-all\"\n"
result = result .. string.format('|+ style="font-size: 105%;" | Generators %i\\%i and %i\\%i\n', gen_in_edosteps, edo, comp_in_edosteps, edo)
.. string.format("|+ style=\"font-size: 105%%;\" | Generators %i\\%i and %i\\%i\n", gen_in_edosteps, edo, comp_in_edosteps, edo)
result = result .. string.format('|-\n')
.. "|-\n"
result = result .. string.format('! colspan="%i" | Steps\n', edo)
.. string.format("! colspan=\"%i\" | Steps\n", edo)
result = result .. string.format('! MOS (name)\n')
.. "! MOS (name)\n"
result = result .. string.format('! Step ratio\n')
.. "! Step ratio\n"
if show_temperament then
if show_temperament then
result = result .. string.format('!Temperament\n')
result = result .. string.format("! Temperament\n")
end
end


Line 263: Line 263:
-- Add the step sizes
-- Add the step sizes
result = result .. string.format('|-\n')
result = result .. "|-\n"
for i = 1, #current_scale do
for i = 1, #current_scale do
local current_step = current_scale[i]
local current_step = current_scale[i]
Line 287: Line 287:
if current_step == 1 then
if current_step == 1 then
if large_step_size == small_step_size then
if large_step_size == small_step_size then
result = result .. string.format('| 1\n')
result = result .. "| 1\n"
else
else
result = result .. string.format('| bgcolor="%s" | 1\n', cell_color)
result = result .. string.format("| style=\"background-color: %s;\" | 1\n", cell_color)
end
end
else
else
if cell_color == p.cell_color_none then
if cell_color == p.cell_color_none then
result = result .. string.format('| colspan="%i" | %i\n', current_step, current_step)
result = result .. string.format("| colspan=\"%i\" | %i\n", current_step, current_step)
else
else
result = result .. string.format('| bgcolor="%s" colspan="%i" | %i\n', cell_color, current_step, current_step)
result = result .. string.format("| style=\"background-color: %s\" colspan=\"%i\" | %i\n", cell_color, current_step, current_step)
end
end
end
end
Line 333: Line 333:
end
end


result = result .. string.format('|}\n')
result = result .. "|}\n"
return result
return result
Line 381: Line 381:
-- Create table, starting with headers
-- Create table, starting with headers
local result = string.format('{| class="wikitable center-all"\n')
local result = "{| class=\"wikitable center-all\"\n"
result = result .. string.format('|+ style="font-size: 110%%;" | Generators %i\\%i and %i\\%i\n', gen_in_edosteps, edo, comp_in_edosteps, edo)
.. string.format("|+ style=\"font-size: 105%%;\" | Generators %i\\%i and %i\\%i\n", gen_in_edosteps, edo, comp_in_edosteps, edo)
result = result .. string.format('|-\n')
.. "|-\n"
result = result .. string.format('! Step visualization\n')
.. "! Step visualization\n"
result = result .. string.format('! MOS (name)\n') -- Scale sig (and name)
.. "! MOS (name)\n" -- Scale sig (and name)
result = result .. string.format('! Step sizes\n') -- Step sizes
.. "! Step sizes\n" -- Step sizes
result = result .. string.format('! Step ratio\n') -- Step ratio
.. "! Step ratio\n" -- Step ratio
if show_temperament then
if show_temperament then
result = result .. string.format('! Temperament\n') -- Temperament, if given
result = result .. "! Temperament\n" -- Temperament, if given
end
end


Line 403: Line 403:
-- New row
-- New row
result = result .. string.format('|-\n')
result = result .. "|-\n"
-- Add the step visualization
-- Add the step visualization
local step_vis = p.step_pattern_to_simple_visualization(current_scale)
local step_vis = p.step_pattern_to_simple_visualization(current_scale)
result = result .. string.format('| %s\n', step_vis)
result = result .. string.format("| %s\n", step_vis)
-- Add the scale sig
-- Add the scale sig
Line 443: Line 443:
end
end


result = result .. string.format('|}\n')
result = result .. "|}\n"
return result
return result