Module:MOS tunings: Difference between revisions
ArrowHead294 (talk | contribs) m +Debugging option |
ArrowHead294 (talk | contribs) mNo edit summary |
||
| (6 intermediate revisions by 2 users not shown) | |||
| Line 1: | Line 1: | ||
local p = {} | |||
local et = require("Module:ET") | |||
local jira = require("Module:JI ratios") | |||
local mos = require("Module:MOS") | local mos = require("Module:MOS") | ||
local tamnams = require("Module:TAMNAMS") | local tamnams = require("Module:TAMNAMS") | ||
local | local tip = require("Module:Template input parse") | ||
local yesno = require("Module:Yesno") | local yesno = require("Module:Yesno") | ||
-- Rewritten/simplified module replacement for Module:MOS degrees | -- Rewritten/simplified module replacement for Module:MOS degrees | ||
| Line 180: | Line 181: | ||
end | end | ||
local et_as_string = et.as_string(mos. | local et_as_string = et.as_string(mos.as_et(input_mos, step_ratios[i])) | ||
local header_text = string.format("%s<br />[[%s]]", step_ratio_as_text, et_as_string) | local header_text = string.format("%s<br />[[%s]]", step_ratio_as_text, et_as_string) | ||
result = result .. string.format("! colspan=\"2\" | %s\n", header_text) | result = result .. string.format("! colspan=\"2\" | %s\n", header_text) | ||
| Line 210: | Line 211: | ||
result = result | result = result | ||
.. "|-\n" | .. "|-\n" | ||
.. string.format("| %s | .. string.format("| %s\n", degree_name) | ||
.. string.format("| %s\n", degree_abbrev) | |||
-- Add cells for each interval's tunings | -- Add cells for each interval's tunings | ||
| Line 219: | Line 221: | ||
result = result | result = result | ||
--.. string.format(" | --.. string.format("\n| %s\\%s\n| %.1f", step_count, input_mos.nL * step_ratio[1] + input_mos.ns * step_ratio[2], cents) | ||
.. string.format(" | .. string.format("| style=\"border-right: none;\" | %s\\%s\n", step_count, input_mos.nL * step_ratio[1] + input_mos.ns * step_ratio[2]) | ||
.. string.format("| style=\"border-left: none;\" | %.1f\n", cents) | |||
end | end | ||
| Line 229: | Line 232: | ||
-- Ratios link to their respective pages, and are comma-delimited. | -- Ratios link to their respective pages, and are comma-delimited. | ||
local ratios_as_text = jira.ratios_as_string(sorted_ji_ratios[i], true, ", ") | local ratios_as_text = jira.ratios_as_string(sorted_ji_ratios[i], true, ", ") | ||
result = result .. " | result = result .. "| style=\"text-align: left;\" | " .. string.format("%s\n", ratios_as_text) | ||
end | end | ||
]]-- | ]]-- | ||
end | end | ||
-- End of table, plus footnotes | -- End of table, plus footnotes | ||
result = result .. "|} | result = result .. "|}" | ||
--[[ | --[[ | ||
| Line 323: | Line 324: | ||
local step_ratios = p.parse_step_ratios(frame.args["Step Ratios"]) | local step_ratios = p.parse_step_ratios(frame.args["Step Ratios"]) | ||
local tolerance = tonumber(frame.args["Tolerance"]) | local tolerance = tonumber(frame.args["Tolerance"]) | ||
local debugg = frame.args["debug"] | local debugg = yesno(frame.args["debug"]) | ||
--local ji_ratios, footnotes = p.parse_ji_ratios(frame.args["JI Ratios"], input_mos.equave) | --local ji_ratios, footnotes = p.parse_ji_ratios(frame.args["JI Ratios"], input_mos.equave) | ||
local | local result = p._mos_tunings(input_mos, mos_prefix, mos_abbrev, step_ratios, ji_ratios, tolerance, footnotes, is_collapsed) | ||
if debugg == true then | |||
result = "<syntaxhighlight lang=\"wikitext\">" .. result .. "</syntaxhighlight>" | |||
end | |||
return frame:preprocess(result) | |||
end | end | ||