Module:Scale tree: Difference between revisions

ArrowHead294 (talk | contribs)
mNo edit summary
ArrowHead294 (talk | contribs)
mNo edit summary
 
(18 intermediate revisions by the same user not shown)
Line 1: Line 1:
local p = {}
local MOS = require("Module:MOS")
local MOS = require("Module:MOS")
local ET = require("Module:ET")
local ET = require("Module:ET")
Line 5: Line 4:
local sb = require("Module:SB tree")
local sb = require("Module:SB tree")
local utils = require("Module:Utils")
local utils = require("Module:Utils")
local yesno = require("Module:yesno")
local p = {}


-- Helper function that parses entries from a semicolon-delimited string and returns them in an array
-- Helper function that parses entries from a semicolon-delimited string and returns them in an array
Line 11: Line 12:
function p.parse_entries(unparsed)
function p.parse_entries(unparsed)
local parsed = {}
local parsed = {}
for entry in string.gmatch(unparsed, "([^<>]+)") do
-- for entry in string.gmatch(unparsed, "([^;]+)") do
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 112: Line 114:
-- - Comments
-- - Comments
local result = "{| class=\"wikitable center-all\"\n"
local result = "{| class=\"wikitable center-all\"\n"
.. "|+ style=\"font-size: 105%; white-space: nowrap;\" | " .. string.format("Scale Tree and Tuning Spectrum of %s\n", mos_as_string)
.. "|+ style=\"font-size: 105%; white-space: nowrap;\" | " .. string.format("Scale tree and tuning spectrum of %s\n", mos_as_string)
.. "|-\n"
.. "|-\n"
.. string.format("! rowspan=\"2\" colspan=\"%d\" | Generator<sup><abbr title=\"In steps of ed%s.\">(ed%s)</abbr></sup>\n", depth + 1, equave_suffix, equave_suffix)
.. string.format("! rowspan=\"2\" colspan=\"%d\" | Generator<sup><abbr title=\"In steps of ed%s.\">(ed%s)</abbr></sup>\n", depth + 1, equave_suffix, equave_suffix)
Line 196: Line 198:
local out_str = p._scale_tree(mos, depth, comments)
local out_str = p._scale_tree(mos, depth, comments)
local debugg = frame.args["debug"]
local debugg = yesno(frame.args["debug"])
return frame:preprocess(debugg == "true" and "<pre>" .. out_str .. "</pre>" or out_str)
return frame:preprocess(debugg == true and "<pre>" .. out_str .. "</pre>" or out_str)
end
end


return p
return p