Module:MOS modes: Difference between revisions

Ganaram inukshuk (talk | contribs)
m Adopt yesno module
ArrowHead294 (talk | contribs)
mNo edit summary
Line 79: Line 79:
local gens_down = (i - 1) * periods
local gens_down = (i - 1) * periods
local gens_up = (#mos_modes - i) * periods
local gens_up = (#mos_modes - i) * periods
local udp_as_text = ""
local udp_as_text = gens_up .. "|" .. gens_down
if periods == 1 then
if periods == 1 then
udp_as_text = gens_up .. "|" .. gens_down
udp_as_text = udp_as_text .. "(" .. periods .. ")"
else
udp_as_text = gens_up .. "|" .. gens_down .. "(" .. periods .. ")"
end
end
result = result .. "| " .. udp_as_text
result = result .. "| " .. udp_as_text
Line 118: Line 116:
function p.modes_table(frame)
function p.modes_table(frame)
-- Mos is entered as a scale signature "xL ys" or "xL ys<p/q>" since the mos module can parse that format
-- Mos is entered as a scale signature "xL ys" or "xL ys<p/q>" since the mos module can parse that format
local scale_sig = frame.args["Scale Signature"] or "5L 2s"
local input_mos = mos.parse(frame.args["Scale Signature"] or "5L 2s")
local input_mos = mos.parse(scale_sig)
-- Get the mos's mode names, if given
-- Get the mos's mode names, if given
-- Mode names are entered as a semicolon-delimited list
-- Mode names are entered as a semicolon-delimited list
-- 5L 2s gets default names
-- 5L 2s gets default names
local mode_names = nil
local mode_names = tip.parse_entries(((scale_sig == "5L 2s") and {"Lydian; Ionian (major); Mixolydian; Dorian; Aeolian (minor); Phrygian; Locrian"} or {frame.args["Mode Names"]})[1])
if scale_sig == "5L 2s" then
mode_names_unparsed = "Lydian; Ionian (major); Mixolydian; Dorian; Aeolian (minor); Phrygian; Locrian"
mode_names = tip.parse_entries(mode_names_unparsed)
else
mode_names_unparsed = frame.args["Mode Names"]
mode_names = tip.parse_entries(mode_names_unparsed)
end


-- This is for entering multiple columns of info, if a single column of mode names isn't enough
-- This is for entering multiple columns of info, if a single column of mode names isn't enough
-- For n headers, the number of entries must match the number of modes times the number of headers
-- For n headers, the number of entries must match the number of modes times the number of headers
-- or else column data won't be added
-- or else column data won't be added
local headers_unparsed = frame.args["Table Headers"]
local headers = tip.parse_entries(frame.args["Table Headers"])
local headers = tip.parse_entries(headers_unparsed)
local entries = tip.parse_entries(frame.args["Table Entries"])
local entries_unparsed = frame.args["Table Entries"]
local entries = tip.parse_entries(entries_unparsed)
local is_collapsed = yesno(frame.args["Collapsed"], false)
local is_collapsed = yesno(frame.args["Collapsed"], false)