Module:MOS degrees: Difference between revisions

ArrowHead294 (talk | contribs)
mNo edit summary
ArrowHead294 (talk | contribs)
mNo edit summary
 
(4 intermediate revisions by 2 users not shown)
Line 1: Line 1:
local p = {}
local et = require("Module:ET")
--local jiraf = require("Module:JI ratio finder")
local mos = require("Module:MOS")
local mos = require("Module:MOS")
local mosnot = require("Module:MOS notation")
local rat = require("Module:Rational")
local rat = require("Module:Rational")
local tamnams = require("Module:TAMNAMS")
local utils = require("Module:Utils")
local utils = require("Module:Utils")
local mosnot = require("Module:MOS notation")
local yesno = require("Module:Yesno")
local et = require("Module:ET")
--local jiraf = require('Module:JI ratio finder')
local tamnams = require("Module:TAMNAMS")
local p = {}


-- Version 2 of the MOS degrees moudle (by ganaraminukshuk)
-- TODO:
-- This is based more off of the MOS intervals module and older, non-tempalte tables that feature JI ratios,
-- Rewrite "main function" into a underscore-prefixed function to be called by Lua code and a wrapper to be called by templates. (HIGH PRIORITY!!!)
-- and doesn't depend on genchains (except for note names) to calculate cent values or degree names.
-- Adopt MOS arithmetic function (MEDIUM-PRIORITY!!!)
-- Current TODO list:
-- Add support for double accidentals (low-priority)
-- - Rewrite "main function" into a underscore-prefixed function to be called
-- Move certain helper functions to helper modules (low-priority)
--  by lua code and a wrapper to be called by templates. (HIGH PRIORITY!!!)
-- - Adopt MOS arithmetic function (MEDIUM-PRIORITY!!!)
-- - Add support for double accidentals (low-priority)
-- - Move certain helper functions to helper modules (low-priority)


-- Helper function
-- Helper function
Line 579: Line 577:
-- First row
-- First row
result = result .. string.format("|+ style=\"font-size: 105%%; white-space: nowrap;\" | Scale degree of %s\n", scale_sig)
result = result
result = result .. "! rowspan=\"2\" class=\"unsortable\" | Scale degree\n"
.. "|+ style=\"font-size: 105%%; white-space: nowrap;\" | " .. string.format("Scale degree of %s\n", scale_sig)
.. "|-\n"
.. "! rowspan=\"2\" class=\"unsortable\" | Scale degree\n"
-- Add column for abbreviations
-- Add column for abbreviations
Line 620: Line 620:
-- Add the step ratio name if there is one
-- Add the step ratio name if there is one
if step_ratio_name == nil then
if step_ratio_name == nil then
result = result .. "! colspan=\"2\" |" .. et_as_string .. " (L:s = " .. step_ratio_key .. ")\n"
result = result .. "! colspan=\"2\" | " .. et_as_string .. " (L:s = " .. step_ratio_key .. ")\n"
else
else
result = result .. "! colspan=\"2\" |" .. et_as_string .. " (" .. step_ratio_name .. ", L:s = " .. step_ratio_key .. ")\n"
result = result .. "! colspan=\"2\" | " .. et_as_string .. " (" .. step_ratio_name .. ", L:s = " .. step_ratio_key .. ")\n"
end
end
end
end
Line 817: Line 817:
result = p.mos_degrees(input_mos, step_ratios, mos_prefix, show_abbreviations, number_of_alterations, ji_ratios_parsed, udp_parsed, notation_parsed, show_notation)
result = p.mos_degrees(input_mos, step_ratios, mos_prefix, show_abbreviations, number_of_alterations, ji_ratios_parsed, udp_parsed, notation_parsed, show_notation)
 
return result
-- Debugger
local debugg = yesno(frame.args["debug"])
if debugg == true then
result = "<syntaxhighlight lang=\"wikitext\">" .. result .. "</syntaxhighlight>"
end
return frame:preprocess(result)
end
end


return p
return p