Module:MOS in EDO allperiods: Difference between revisions

ArrowHead294 (talk | contribs)
mNo edit summary
ArrowHead294 (talk | contribs)
mNo edit summary
 
(9 intermediate revisions by the same user not shown)
Line 21: Line 21:
-- Main function
-- Main function
-- Creates tables for every mos in an edo, for every possible period count
-- Creates tables for every mos in an edo, for every possible period count
function p.mos_in_edo_allperiods(edo, max_number_of_periods, show_subsets, generation_limit, temperaments, is_debug)
function p.mos_in_edo_allperiods(edo, max_number_of_periods, show_subsets, generation_limit, temperaments)
local edo = edo or 12
local edo = edo or 12
local max_number_of_periods = max_number_of_periods or -1
local max_number_of_periods = max_number_of_periods or -1
Line 63: 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("This page lists all [[moment of symmetry]] scales in [[%iedo]].\n\n", edo)
result = result .. string.format("This page lists all [[moment of symmetry]] scales in [[%iedo]].\n__TOC__\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 84: Line 84:
-- Add a section header
-- Add a section header
if number_of_periods == 1 then
if number_of_periods == 1 then
result = result .. "== Single-period MOS scales ==\n"
result = result .. "<h2>Single-period MOS scales</h2>\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 90: Line 90:
-- header.
-- header.
if not multi_period_header_written then
if not multi_period_header_written then
result = result .. string.format("== Multi-period MOS scales ==\n")
result = result .. string.format("<h2>Multi-period MOS scales</h2>\n")
multi_period_header_written = true
multi_period_header_written = true
end
end
result = result .. string.format("=== %i periods ===\n", number_of_periods)
result = result .. string.format("<h3>%i periods</h3>\n", number_of_periods)
end
end
Line 125: Line 125:
-- Add categories
-- Add categories
if not is_debug then
result = result .. string.format("[[Category:%iedo]]\n", edo)
result = result .. string.format("\n\n[[Category:%iedo]]\n", edo)
.. "[[Category:Lists of scales]]\n"
.. "[[Category:Lists of scales]]\n"
.. "[[Category:MOS scales]]"
.. "[[Category:MOS scales]]"
end
 
-- Debugger
return result
return result
end
end
Line 156: Line 153:
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 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
local result = p.mos_in_edo_allperiods(edo, max_periods, show_subsets, generation_limit, temperaments, debugg)
return frame:preprocess(result)
return frame:preprocess(debugg == true and "<pre>" .. result .. "</pre>" or result)
end
end


return p
return p