Module:Infobox MOS: Difference between revisions
m nocat -> debug, per clarified use for debug |
tuning -> input_mos; scalesig entered is processed as a mos and back to string to ensure it's formatted correctly for the infobox title (trying the long string first) |
||
| Line 37: | Line 37: | ||
-- Helper function | -- Helper function | ||
-- Adds categories | -- Adds categories | ||
function p.categorize( | function p.categorize(input_mos) | ||
local | local input_mos = input_mos or mos.new(5,2) | ||
-- Add to category of abstact mosses | -- Add to category of abstact mosses | ||
| Line 389: | Line 388: | ||
-- New "main" function | -- New "main" function | ||
function p._infobox_mos( | function p._infobox_mos(input_mos, other_names_unparsed) | ||
local | local input_mos = input_mos or mos.new(4,5,3) | ||
local other_names_unparsed = other_names_unparsed or "" | local other_names_unparsed = other_names_unparsed or "" | ||
local other_names_parsed = tip.parse_entries(other_names_unparsed) or tip.parse_entries(other_names_unparsed, ",") | local other_names_parsed = tip.parse_entries(other_names_unparsed) or tip.parse_entries(other_names_unparsed, ",") | ||
| Line 399: | Line 397: | ||
-- Keyboard visualization | -- Keyboard visualization | ||
local kb_vis = p.kb_vis( | local kb_vis = p.kb_vis(input_mos) | ||
p.concatenate_tables(sections, kb_vis) | p.concatenate_tables(sections, kb_vis) | ||
-- Scale structure section | -- Scale structure section | ||
local scale_structure = p.scale_structure( | local scale_structure = p.scale_structure(input_mos) | ||
p.concatenate_tables(sections, scale_structure) | p.concatenate_tables(sections, scale_structure) | ||
| Line 411: | Line 409: | ||
-- Generator sizes section | -- Generator sizes section | ||
local gen_sizes = p.generator_sizes( | local gen_sizes = p.generator_sizes(input_mos) | ||
p.concatenate_tables(sections, gen_sizes) | p.concatenate_tables(sections, gen_sizes) | ||
-- Tamnams info section, if applicable | -- Tamnams info section, if applicable | ||
local tamnams_info = p.tamnams_information( | local tamnams_info = p.tamnams_information(input_mos) | ||
if tamnams_info ~= nil then | if tamnams_info ~= nil then | ||
p.concatenate_tables(sections, tamnams_info) | p.concatenate_tables(sections, tamnams_info) | ||
| Line 427: | Line 425: | ||
-- Related scales section | -- Related scales section | ||
local related_scales = p.related_scales( | local related_scales = p.related_scales(input_mos) | ||
p.concatenate_tables(sections, related_scales) | p.concatenate_tables(sections, related_scales) | ||
-- Equal tunings section | -- Equal tunings section | ||
local equal_tunings = p.equal_tunings( | local equal_tunings = p.equal_tunings(input_mos) | ||
p.concatenate_tables(sections, equal_tunings) | p.concatenate_tables(sections, equal_tunings) | ||
-- Adjacent links | -- Adjacent links | ||
local adjacent_links = p.adjacent_links( | local adjacent_links = p.adjacent_links(input_mos) | ||
local args = { | local args = { | ||
["Adjacent Links"] = adjacent_links, | ["Adjacent Links"] = adjacent_links, | ||
["Title"] = | ["Title"] = mos.as_long_string(input_mos), | ||
["Rows"] = sections, | ["Rows"] = sections, | ||
} | } | ||
| Line 452: | Line 450: | ||
-- "Scale Signature" is preferred; "Tuning" is supported for legacy purposes | -- "Scale Signature" is preferred; "Tuning" is supported for legacy purposes | ||
local | local unparsed = args["Tuning"] or args["Scale Signature"] | ||
local input_mos = mos.parse(unparsed) | |||
local other_names = args["othernames"] or nil | local other_names = args["othernames"] or nil | ||
local debug_mode = yesno(args["debug"], false) | local debug_mode = yesno(args["debug"], false) | ||
local result = p._infobox_mos( | local result = p._infobox_mos(mos.as_long_string(input_mos), other_names) | ||
if not debug_mode then | if not debug_mode then | ||
result = result .. p.categorize( | result = result .. p.categorize(input_mos) | ||
end | end | ||