Module:MOS mode degrees: Difference between revisions
ArrowHead294 (talk | contribs) mNo edit summary |
ArrowHead294 (talk | contribs) mNo edit summary |
||
| (10 intermediate revisions by the same user not shown) | |||
| Line 1: | Line 1: | ||
local p = {} | |||
local mos = require("Module:MOS") | local mos = require("Module:MOS") | ||
local tamnams = require("Module:TAMNAMS") | |||
local tip = require("Module:Template input parse") | local tip = require("Module:Template input parse") | ||
local yesno = require("Module:Yesno") | local yesno = require("Module:Yesno") | ||
-- TODO | -- TODO | ||
| Line 111: | Line 112: | ||
-- Table's title | -- Table's title | ||
-- If it's for a modmos, add the step pattern | -- If it's for a modmos, add the step pattern | ||
result = result .. "|+ style=\"font-size: 105%; white-space: nowrap;\" | " .. string.format("Scale degrees of the modes of %s", scale_sig) | |||
result = result .. "|+ style=\"font-size: 105%; white-space: nowrap;\" | " .. string.format("%s\n", | .. (is_true_mos and "\n" or string.format(" (%s)\n", step_pattern)) | ||
.. "|-\n" | .. "|-\n" | ||
-- Add table headers for first row | -- Add table headers for first row | ||
result = result | result = result | ||
.. "! rowspan=\"2\" | UDP " .. (is_true_mos and "" or " and<br />alterations ") -- If modmos, add "and alterations" string | .. "! rowspan=\"2\" | UDP" .. (is_true_mos and "\n" or " and<br />alterations\n") -- If modmos, add "and alterations" string | ||
.. " | .. "! rowspan=\"2\" | Cyclic<br />order\n" | ||
.. " | .. "! rowspan=\"2\" | Step<br />pattern\n" | ||
-- Add header for scale degrees | -- Add header for scale degrees | ||
result = result .. string.format(" | result = result .. string.format("! colspan=\"%d\" class=\"unsortable\" | Scale degree (%sdegree)\n", #step_matrices[1], mos_prefix) | ||
-- Add second row of headers | -- Add second row of headers | ||
| Line 128: | Line 129: | ||
.. "! 0" | .. "! 0" | ||
for i = 1, #step_patterns[1] do | for i = 1, #step_patterns[1] do | ||
result = result .. string.format(" | result = result .. string.format("\n! %d", i) | ||
end | end | ||
| Line 138: | Line 139: | ||
-- Add brightness order (as UDP), rotational order, and step pattern | -- Add brightness order (as UDP), rotational order, and step pattern | ||
.. string.format("| %s | .. string.format("| %s\n| %s\n| %s\n", udps[i], cpos[i], step_patterns[i]) | ||
-- Add scale degrees with cell coloring | -- Add scale degrees with cell coloring | ||
| Line 146: | Line 147: | ||
local cell_color = p.cell_color(current_interval, input_mos) | local cell_color = p.cell_color(current_interval, input_mos) | ||
local style_code = cell_color == p.cell_color_none and "" or string.format("style=\"background: %s;\" | ", cell_color) | local style_code = (cell_color == p.cell_color_none and "" or string.format("style=\"background: %s;\" | ", cell_color)) | ||
result = result .. string.format(" | result = result .. string.format("| %s%s\n", style_code, degree_quality) | ||
end | end | ||
end | end | ||
| Line 166: | Line 166: | ||
local step_pattern = frame.args["MODMOS Step Pattern"] | local step_pattern = frame.args["MODMOS Step Pattern"] | ||
local mode_names_unparsed = frame.args["Mode Names"] | local mode_names_unparsed = frame.args["Mode Names"] | ||
-- Parse debugging option | |||
local debugg = yesno(frame.args["debug"]) | |||
-- Get the scale sig; for calculating the mos prefix | -- Get the scale sig; for calculating the mos prefix | ||
| Line 292: | Line 295: | ||
end | end | ||
-- Debugger option | |||
if debugg == true then | |||
result = "<syntaxhighlight lang=\"wikitext\">" .. result .. "</syntaxhighlight>" | |||
end | |||
return frame:preprocess(result) | |||
end | end | ||
return p | return p | ||