Module:MOSes by EDO: Difference between revisions
Created copy of Ganaram’s module for subpages rather than full pages Tags: Mobile edit Mobile web edit Advanced mobile edit |
No edit summary |
||
(8 intermediate revisions by 2 users not shown) | |||
Line 3: | Line 3: | ||
local utils = require("Module:Utils") | local utils = require("Module:Utils") | ||
local mosinedo = require("Module:MOS in EDO") | local mosinedo = require("Module:MOS in EDO") | ||
local yesno = require("Module:Yesno") | |||
local p = {} | local p = {} | ||
-- Copied from Ganaram Inukshuk's module on 22 Oct 2024, the only change was changing from 2nd | -- Copied from Ganaram Inukshuk's module on 22 Oct 2024, the only change was changing from 2nd level headings to plain bold text and removing the auto-categories, to allow calling multiple times inside of a single page. | ||
-- Helper function | -- Helper function | ||
Line 62: | Line 63: | ||
-- TODO: Show period/note/subset limits if applicable | -- TODO: Show period/note/subset limits if applicable | ||
local result = "" | local result = "" | ||
result = result .. string.format(" | result = result .. string.format("These are all [[moment of symmetry]] scales in [[%iedo]].\n", edo) | ||
-- Call a for loop that produces a set of tables for each period count | -- Call a for loop that produces a set of tables for each period count | ||
Line 83: | Line 84: | ||
-- Add a section header | -- Add a section header | ||
if number_of_periods == 1 then | if number_of_periods == 1 then | ||
result = result .. " | result = result .. "<br/>'''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 89: | Line 90: | ||
-- header. | -- header. | ||
if not multi_period_header_written then | if not multi_period_header_written then | ||
result = result .. string.format(" | result = result .. string.format("<br/>'''Multi-period MOS scales'''\n") | ||
result = result .. string.format(" | result = result .. string.format("<br/>'''''%i periods'''''\n", number_of_periods) | ||
multi_period_header_written = true | multi_period_header_written = true | ||
else | else | ||
result = result .. string.format(" | result = result .. string.format("<br/>'''''%i periods'''''\n", number_of_periods) | ||
end | end | ||
end | end | ||
Line 115: | Line 116: | ||
local temperament_index = 1 + i - starting_generator | local temperament_index = 1 + i - starting_generator | ||
if show_temperament then | if show_temperament then | ||
result = result .. mosinedo.mos_in_edo_simplified(edo, i, number_of_periods, generation_limit, temperaments[temperament_index]) | result = result .. mosinedo.mos_in_edo_simplified(edo, i, number_of_periods, generation_limit, temperaments[temperament_index]) .. "\n" | ||
else | else | ||
result = result .. mosinedo.mos_in_edo_simplified(edo, i, number_of_periods, generation_limit) | result = result .. mosinedo.mos_in_edo_simplified(edo, i, number_of_periods, generation_limit) .. "\n" | ||
end | end | ||
end | end | ||
Line 123: | Line 124: | ||
end | end | ||
end | end | ||
return result | return result | ||
Line 152: | Line 148: | ||
local max_periods = tonumber(frame.args["Period Limit"]) or -1 | local max_periods = tonumber(frame.args["Period Limit"]) or -1 | ||
local generation_limit = tonumber(frame.args["Generation Limit"]) or -1 | local generation_limit = tonumber(frame.args["Generation Limit"]) or -1 | ||
local debugg = yesno(frame.args["debug"]) | |||
local result = p.mos_in_edo_allperiods(edo, max_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 | return p |