Module:MOS in EDO allperiods: Difference between revisions
Template will now auto-add categories |
ArrowHead294 (talk | contribs) mNo edit summary |
||
| Line 1: | Line 1: | ||
local mos = require( | local mos = require("Module:MOS") | ||
local rat = require( | local rat = require("Module:Rational") | ||
local utils = require( | local utils = require("Module:Utils") | ||
local mosinedo = require( | local mosinedo = require("Module:MOS in EDO") | ||
local p = {} | local p = {} | ||
| Line 11: | Line 11: | ||
function p.parse_entries(unparsed) | function p.parse_entries(unparsed) | ||
local parsed = {} | local parsed = {} | ||
for entry in string.gmatch(unparsed, | for entry in string.gmatch(unparsed, "([^;]+)") do | ||
local trimmed = entry:gsub("^%s*(.-)%s*$", "%1") | local trimmed = entry:gsub("^%s*(.-)%s*$", "%1") | ||
table.insert(parsed, trimmed) -- Add to array | table.insert(parsed, trimmed) -- Add to array | ||
| Line 81: | Line 81: | ||
-- Add a section header | -- Add a section header | ||
if number_of_periods == 1 then | if number_of_periods == 1 then | ||
result = result .. | result = result .. "== Single-period MOS scales ==\n" | ||
else | else | ||
-- If the L2 header wasn't written yet, write that, followed by | -- If the L2 header wasn't written yet, write that, followed by | ||
| Line 124: | Line 124: | ||
-- Auto-add categories | -- Auto-add categories | ||
result = result .. string.format("[[Category:%iedo]]\n", edo) | result = result .. string.format("[[Category:%iedo]]\n", edo) | ||
.. "[[Category:Lists of scales]]\n" | |||
.. "[[Category:MOS scales]]" | |||
return result | return result | ||
| Line 131: | Line 131: | ||
function p.test() | function p.test() | ||
return tonumber("") | return tonumber("") | ||
end | end | ||
| Line 146: | Line 145: | ||
-- Maximum values can be overridden to have no max if set to "-1" | -- Maximum values can be overridden to have no max if set to "-1" | ||
function p.mos_in_edo_allperiods_frame(frame) | function p.mos_in_edo_allperiods_frame(frame) | ||
local edo = tonumber(frame.args["EDO"]) | local edo = tonumber(frame.args["EDO"]) | ||
local temperaments = p.parse_entries(frame.args["Temperaments"]) | local temperaments = p.parse_entries(frame.args["Temperaments"]) | ||
| Line 153: | Line 151: | ||
local generation_limit = tonumber(frame.args["Generation Limit"]) or -1 | local generation_limit = tonumber(frame.args["Generation Limit"]) or -1 | ||
return p.mos_in_edo_allperiods(edo, max_periods, show_subsets, generation_limit, temperaments) | |||
end | end | ||
return p | return p | ||