Module:MOS degrees: Difference between revisions
m Clarified comments, removed completed TO-DO's |
Added nominal-accidental highlighting and et to template |
||
| Line 287: | Line 287: | ||
local result = '{| class="wikitable sortable"\n' | local result = '{| class="wikitable sortable"\n' | ||
-- Produce the headers | -- Produce the headers; first row | ||
local steps_in_et = input_mos.nL * step_ratio[1] + input_mos.ns * step_ratio[2] | local steps_in_et = input_mos.nL * step_ratio[1] + input_mos.ns * step_ratio[2] | ||
local et_for_mos = et.new(steps_in_et, input_mos.equave) | local et_for_mos = et.new(steps_in_et, input_mos.equave) | ||
result = result .. " | result = result .. '! rowspan="2" |Scale degree\n' | ||
result = result .. '! rowspan="2" |Note name on ' .. string.sub(note_symbols, 1, 1) .. "\n" | |||
-- Add this once for every step ratio to be represented | |||
result = result .. '! colspan="2" |Steps of ' .. et.as_string(et_for_mos) .. '\n' | |||
result = result .. "(L:s = " .. step_ratio[1] .. ":" .. step_ratio[2] .. ")\n" | |||
-- Next row | |||
result = result .. "|-\n" | |||
-- Add this once for every step ratio to be represented | |||
result = result .. "! Steps\n! Cents\n" | |||
-- Add each row, containing a degree, note name, step count, and cent value | -- Add each row, containing a degree, note name, step count, and cent value | ||
for i = 1, #degrees_and_note_names do | for i = 1, #degrees_and_note_names do | ||
-- | -- Is the row for a nominal? (Nominals have no accidentals and are | ||
result = result .. "|-\n" | -- therefore strings of size 1) | ||
local is_nominal = string.len(degrees_and_note_names[i][2]) == 1 | |||
-- Add new row, with coloring | |||
if not is_nominal then | |||
result = result .. '|- bgcolor="#c8ccd1"\n' | |||
else | |||
result = result .. "|-\n" | |||
end | |||
-- Add cells for degree and note name | |||
result = result .. "| " .. degrees_and_note_names[i][1] .. "\n" -- Degree name | result = result .. "| " .. degrees_and_note_names[i][1] .. "\n" -- Degree name | ||
result = result .. "| " .. degrees_and_note_names[i][2] .. "\n" -- Note name | result = result .. "| " .. degrees_and_note_names[i][2] .. "\n" -- Note name | ||
-- Add cells for step size | |||
result = result .. "| " .. steps_and_cents[i][1] .. "\n" -- Steps | result = result .. "| " .. steps_and_cents[i][1] .. "\n" -- Steps | ||
result = result .. "| " .. steps_and_cents[i][2] .. "¢\n" -- Cents | result = result .. "| " .. steps_and_cents[i][2] .. "¢\n" -- Cents | ||