Module:Infobox ET: Difference between revisions

"is_zeta" -> "zeta_switch", make it overridable by zeta_override. Also don't show zeta when not sure
Move special properties to the last, move octave before fifth. Add "dual" marker to sharp and flat fifths
Line 106: Line 106:
})
})


-- special properties
if ET.is_highly_composite(et) or zeta_switch then
local text = ''
if ET.is_highly_composite(et) then
text = text .. '[[Highly composite equal division|highly composite]]'
if rat.eq(et.equave, 2) then
categories = categories .. '[[Category:Highly composite EDO' .. '|' .. string.rep ('#', string.len (et.size)) .. ']]'
end
end
if zeta_switch then
if #text > 0 then text = text .. '<br>' end
if not (type(zeta_override) == 'string' and #zeta_override > 0) then
text = text .. ET.why_zeta(et)
else
text = text .. zeta_override
end
categories = categories .. '[[Category:Zeta' .. '|' .. string.rep ('#', string.len (et.size)) .. ']]'
end
table.insert(infobox_data, {
'Special properties',
'<div style="max-width: 270px;">' .. text .. '</div>'
})
end
table.insert(infobox_data, {
table.insert(infobox_data, {
'Step size',
'Step size',
u._round(step_size, 6) .. '¢' .. note_12edo
u._round(step_size, 6) .. '¢' .. note_12edo
})
})
if not rat.eq(et.equave, 2) then
table.insert(infobox_data, {
'Octave',
approximation(et, 2)
})
end
if not rat.eq(et.equave, rat.new(3, 2)) then
if not rat.eq(et.equave, rat.new(3, 2)) then
table.insert(infobox_data, {
table.insert(infobox_data, {
Line 139: Line 124:
})
})
end
end
if not rat.eq(et.equave, 2) then
 
table.insert(infobox_data, {
'Octave',
approximation(et, 2)
})
end
table.insert(infobox_data, {
table.insert(infobox_data, {
'Semitones (A1:m2)',
'Semitones (A1:m2)',
A1 .. ':' .. m2 .. ' (' .. A1_cents .. '¢ : ' .. m2_cents .. '¢)'
A1 .. ':' .. m2 .. ' (' .. A1_cents .. '¢ : ' .. m2_cents .. '¢)'
})
})
if dual_fifth and et.size > 0 then
if dual_fifth and et.size > 0 then
table.insert(infobox_data, {
table.insert(infobox_data, {
'Sharp fifth',
'Dual sharp fifth',
approximation(et, 3/2, 1)
approximation(et, 3/2, 1)
})
})
table.insert(infobox_data, {
table.insert(infobox_data, {
'Flat fifth',
'Dual flat fifth',
approximation(et, 3/2, -1)
approximation(et, 3/2, -1)
})
})
Line 161: Line 142:
local flat = ET.approximate(et, 3/2, -1)
local flat = ET.approximate(et, 3/2, -1)
table.insert(infobox_data, {
table.insert(infobox_data, {
'Major 2nd',
'Dual major 2nd',
approximation(et, 9/8, 0, sharp + flat - octave)
approximation(et, 9/8, 0, sharp + flat - octave)
})
})
Line 190: Line 171:
'Distinct consistency limit',
'Distinct consistency limit',
distinct_consistency
distinct_consistency
})
end
-- special properties
if ET.is_highly_composite(et) or zeta_switch then
local text = ''
if ET.is_highly_composite(et) then
text = text .. '[[Highly composite equal division|highly composite]]'
if rat.eq(et.equave, 2) then
categories = categories .. '[[Category:Highly composite EDO|' .. string.rep ('#', string.len (et.size)) .. ']]'
end
end
if zeta_switch then
if #text > 0 then text = text .. '<br>' end
if not (type(zeta_override) == 'string' and #zeta_override > 0) then
text = text .. ET.why_zeta(et)
else
text = text .. zeta_override
end
categories = categories .. '[[Category:Zeta|' .. string.rep ('#', string.len (et.size)) .. ']]'
end
table.insert(infobox_data, {
'Special properties',
'<div style="max-width: 270px;">' .. text .. '</div>'
})
})
end
end