Module:Infobox MOS: Difference between revisions
adopt mos operation functions |
simplify code for generator size function |
||
| Line 141: | Line 141: | ||
-- a larger array. | -- a larger array. | ||
function p.generator_sizes(input_mos) | function p.generator_sizes(input_mos) | ||
local input_mos = input_mos or mos.new(5, 2 | local input_mos = input_mos or mos.new(5, 2,3) | ||
local bright_min_in_steps = mos.bright_gen_to_et_steps_as_string(input_mos, {1, 1}, "") | local bright_min_in_steps = mos.bright_gen_to_et_steps_as_string(input_mos, {1, 1}, "") | ||
| Line 162: | Line 154: | ||
local section_header = "Generator size" | local section_header = "Generator size" | ||
local | local et_suffix = mos.mos_to_et_suffix(input_mos) | ||
local section_header = (et_suffix == "edo" | |||
and string.format('<div style=\"margin-top: 0.6em;\"><b>Generator size</b></div>') | |||
or string.format('<div style=\"margin-top: 0.6em;\"><b>Generator size</b><sup><abbr title=\"In steps of %s\">(%s)</sup></div>', et_suffix, et_suffix)) | |||
local section_entries = { | local section_entries = { | ||
{ | {section_header}, | ||
{"[[Bright]]", string.format("%s to %s (%.1f{{c}} to %.1f{{c}})", bright_min_in_steps, bright_max_in_steps, bright_min_in_cents, bright_max_in_cents)}, | {"[[Bright]]", string.format("%s to %s (%.1f{{c}} to %.1f{{c}})", bright_min_in_steps, bright_max_in_steps, bright_min_in_cents, bright_max_in_cents)}, | ||
{"[[Dark]]", string.format("%s to %s (%.1f{{c}} to %.1f{{c}})", dark_min_in_steps, dark_max_in_steps, dark_min_in_cents, dark_max_in_cents)}, | {"[[Dark]]", string.format("%s to %s (%.1f{{c}} to %.1f{{c}})", dark_min_in_steps, dark_max_in_steps, dark_min_in_cents, dark_max_in_cents)}, | ||