Module:MOS mode degrees: Difference between revisions

ArrowHead294 (talk | contribs)
mNo edit summary
ArrowHead294 (talk | contribs)
mNo edit summary
 
(8 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 tamnams = require("Module:TAMNAMS")
local yesno = require("Module:Yesno")
local yesno = require("Module:Yesno")
local p = {}


-- 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\n", scale_sig)
result = result .. "|+ style=\"font-size: 105%; white-space: nowrap;\" | " .. string.format("Scale degrees of the modes of %s", scale_sig)
.. (is_true_mos and "" or string.format(" (%s)", step_pattern))
.. (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 "
.. "! rowspan=\"2\" | Cyclic<br />order\n"
.. "!! rowspan=\"2\" | Step<br />pattern"
.. "! rowspan=\"2\" | Step<br />pattern\n"
-- Add header for scale degrees
-- Add header for scale degrees
result = result .. string.format(" !! colspan=\"%d\" class=\"unsortable\" | Scale degree (%sdegree)\n", #step_matrices[1], mos_prefix)
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(" !! %d", i)
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 || %s || %s", udps[i], cpos[i], step_patterns[i])
.. 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 148: Line 149:
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(" || %s%s", style_code, degree_quality)
result = result .. string.format("| %s%s\n", style_code, degree_quality)
end
end
result = result .. "\n"
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
local debugg = yesno(frame.args["debug"])
-- Debugger option
return frame:preprocess(debugg == true and "<pre>" .. result .. "</pre>" or result)
if debugg == true then
result = "<syntaxhighlight lang=\"wikitext\">" .. result .. "</syntaxhighlight>"
end
return frame:preprocess(result)
end
end


return p
return p