Module:MOS modes: Difference between revisions
m Removed spaces before/after pipe (as the standard for writing udp has no spaces) |
Added option to collapse table |
||
| Line 6: | Line 6: | ||
-- TODO: | -- TODO: | ||
-- - | -- - Add ability to autocollapse on large mos pages (say, more than 12 modes) | ||
-- - Code cleanup, adopt new functions where needed (low priority) | -- - Code cleanup, adopt new functions where needed (low priority) | ||
-- "Main" function | -- "Main" function | ||
-- To be called by wrapper | -- To be called by wrapper | ||
function p._mos_modes(input_mos, mode_names, headers, entries) | function p._mos_modes(input_mos, mode_names, headers, entries, is_collapsed) | ||
local is_collapsed = is_collapsed == true | |||
-- 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 input_mos = input_mos or mos.parse(scale_sig) | local input_mos = input_mos or mos.parse(scale_sig) | ||
| Line 44: | Line 46: | ||
-- Make a table with a column for the mode (as a string of L's and s's) and UDP | -- Make a table with a column for the mode (as a string of L's and s's) and UDP | ||
local result = "{| class=\"wikitable sortable\"\n" | local result = "{| class=\"wikitable sortable mw-collapsible" .. (is_collapsed and " mw-collapsed\"\n" or "\"\n") | ||
.. "|+ style=\"font-size: 105%;\" | Modes of " .. mos.as_string(input_mos) .. "\n" -- To create the scale signature with〈〉instead of <> | .. "|+ style=\"font-size: 105%;\" | Modes of " .. mos.as_string(input_mos) .. "\n" -- To create the scale signature with〈〉instead of <> | ||
.. "|-\n" | .. "|-\n" | ||
| Line 138: | Line 140: | ||
local entries_unparsed = frame.args["Table Entries"] | local entries_unparsed = frame.args["Table Entries"] | ||
local entries = tip.parse_entries(entries_unparsed) | local entries = tip.parse_entries(entries_unparsed) | ||
local is_collapsed = frame.args["Collapsed"] == 1 | |||
return p._mos_modes(input_mos, mode_names, headers, entries) | return p._mos_modes(input_mos, mode_names, headers, entries, is_collapsed) | ||
end | end | ||
return p | return p | ||