Module:Ups and downs sharpness: Difference between revisions

Tristanbay (talk | contribs)
Added functionality to display semitones for edos 7\12 fifths
Tristanbay (talk | contribs)
seeing if this fixes it not going into the right case
Line 58: Line 58:
tab = "{{sharpness-sharp1}}"
tab = "{{sharpness-sharp1}}"
else
else
if sharp * 12 ~= frame.args["edo"] then
if frame.args["edo"] % 12 == 0 and frame.args["edo"] <= 300 then -- does it temper out 531441/524288?
tab = "<div style=\"overflow-x:auto\">\n{| class=\"wikitable center-all\"\n"
tab = "<div style=\"overflow-x:auto\">\n{| class=\"wikitable center-all\"\n"
.. "|-\n"
.. "|-\n"
.. "! Step offset\n"
.. "! Semitones\n"
.. "| '''0'''"
.. "| '''0'''"
for i = 1, sharp * 2 do
for i = 1, sharp * 2 do
tab = tab .. string.format((i % sharp == 0 and " || '''%s'''" or " || %s"), i)
tab = tab .. (i % sharp == 0 and string.format(" || '''%s'''", math.floor(i / sharp)) or string.format(" || {{Simplified fraction|%s|%s|true}}", i, sharp))
end
end
else
else
tab = "<div style=\"overflow-x:auto\">\n{| class=\"wikitable center-all\"\n"
tab = "<div style=\"overflow-x:auto\">\n{| class=\"wikitable center-all\"\n"
.. "|-\n"
.. "|-\n"
.. "! Semitones\n"
.. "! Step offset\n"
.. "| '''0'''"
.. "| '''0'''"
for i = 1, sharp * 2 do
for i = 1, sharp * 2 do
tab = tab .. (i % sharp == 0 and string.format(" || '''%s'''", math.floor(i / sharp)) or string.format(" || {{Simplified fraction|%s|%s|true}}", i, sharp))
tab = tab .. string.format((i % sharp == 0 and " || '''%s'''" or " || %s"), i)
end
end
end
end