Module:MOS in EDO allgens: Difference between revisions
Separated mosinedo-all and mosinedo-allgens; template pending |
ArrowHead294 (talk | contribs) mNo edit summary |
||
| (10 intermediate revisions by 2 users not shown) | |||
| Line 1: | Line 1: | ||
local p = {} | local p = {} | ||
local mos = require("Module:MOS") | |||
local mosinedo = require("Module:MOS in EDO") | |||
local rat = require("Module:Rational") | |||
local utils = require("Module:Utils") | |||
local yesno = require("Module:Yesno") | |||
-- Helper function | -- Helper function | ||
| Line 11: | Line 13: | ||
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 87: | Line 89: | ||
result = result .. mosinedo.mos_in_edo_simplified(edo, i, verified_number_of_periods, generation_limit) | result = result .. mosinedo.mos_in_edo_simplified(edo, i, verified_number_of_periods, generation_limit) | ||
end | end | ||
result = result .. "\n\n" | |||
end | end | ||
end | end | ||
return result | return string.sub(result, 1, -5) | ||
end | end | ||
| Line 103: | Line 105: | ||
-- - Generation Limit: if set, tables will be limited to this number of generations (rows in the table) | -- - Generation Limit: if set, tables will be limited to this number of generations (rows in the table) | ||
function p.mos_in_edo_allgens_frame(frame) | function p.mos_in_edo_allgens_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 110: | Line 111: | ||
local generation_limit = tonumber(frame.args["Generation Limit"]) or -1 | local generation_limit = tonumber(frame.args["Generation Limit"]) or -1 | ||
local num_periods = tonumber(frame.args["Number of Periods"]) or 1 | local num_periods = tonumber(frame.args["Number of Periods"]) or 1 | ||
local debugg = yesno(frame.args["debug"]) | |||
local result = p.mos_in_edo_allgens(edo, num_periods, show_subsets, generation_limit, temperaments) | |||
-- Debugger option | |||
if debugg == true then | |||
result = "<syntaxhighlight lang=\"wikitext\">" .. result .. "</syntaxhighlight>" | |||
end | |||
return frame:preprocess(result) | |||
end | end | ||
return p | |||