Module:Ups and downs sharpness: Difference between revisions

Tristanbay (talk | contribs)
changed forced cell widths
Tristanbay (talk | contribs)
m organized accidental strings
Line 16: Line 16:
local flat_marg = -12.5
local flat_marg = -12.5
local tab
local tab
local up_t = " [[File:Up arrow petaluma script.svg|10px]]"
local down_t = " [[File:Down arrow petaluma script.svg|10px]]"
local quip_t = " [[File:Quip narrow.svg|9px]]"
local quid_t = " [[File:Quid narrow.svg|9px]]"
local natural_t = "  [[File:Heji18.svg|16px]]"
local sharp_t = "  [[File:Heji25.svg|16px]]"
local flat_t = "  [[File:Heji11.svg|16px]]"
local dsharp_t = "  [[File:Heji32.svg|21px]]"
local dflat_t = "  [[File:Heji4.svg|27px]]"
local hsharp_t
local hflat_t
local ssharp_t
local sflat_t
if sharp == -2 then
if sharp == -2 then
Line 28: Line 47:
.. "|-\n"
.. "|-\n"
.. "! Symbol\n"
.. "! Symbol\n"
.. string.format(spanf, 2, arrow_marg, string.rep(" [[File:Down arrow petaluma script.svg|10px]]", 3))
.. string.format(spanf, 2, arrow_marg, string.rep(down_t, 3))
.. string.format(spanf, 2, arrow_marg, string.rep(" [[File:Down arrow petaluma script.svg|10px]]", 2))
.. string.format(spanf, 2, arrow_marg, string.rep(down_t, 2))
.. string.format(spanf, 2, arrow_marg, " [[File:Down arrow petaluma script.svg|10px]]")
.. string.format(spanf, 2, arrow_marg, down_t)
.. string.format(spanf, 2, arrow_marg - 15, " [[File:Heji18.svg|15px]]")
.. string.format(spanf, 2, arrow_marg - 15, natural_t)
.. string.format(spanf, 2, arrow_marg, " [[File:Up arrow petaluma script.svg|10px]]")
.. string.format(spanf, 2, arrow_marg, up_t)
.. string.format(spanf, 2, arrow_marg, string.rep(" [[File:Up arrow petaluma script.svg|10px]]", 2))
.. string.format(spanf, 2, arrow_marg, string.rep(up_t, 2))
.. string.format(spanf, 2, arrow_marg, string.rep(" [[File:Up arrow petaluma script.svg|10px]]", 3))
.. string.format(spanf, 2, arrow_marg, string.rep(up_t, 3))
.. "|}\n</div>"
.. "|}\n</div>"
elseif sharp == 1 then
elseif sharp == 1 then
tab = "{{sharpness-sharp1}}"
tab = "{{sharpness-sharp1}}"
else
else
tab = "<div style=\"overflow-x:auto\">\n{| class=\"wikitable center-all\"\n"
if frame.args["edo"] % 12 == 0 then
.. "|-\n"
tab = "<div style=\"overflow-x:auto\">\n{| class=\"wikitable center-all\"\n"
.. "! Step offset\n"
.. "|-\n"
.. "| '''0'''"
.. "! Step offset\n"
for i = 1, sharp * 2 do
.. "| '''0'''"
tab = tab .. string.format((i % sharp == 0 and " || '''%s'''" or " || %s"), i)
for i = 1, sharp * 2 do
tab = tab .. string.format((i % sharp == 0 and " || '''%s'''" or " || %s"), i)
end
else
tab = "<div style=\"overflow-x:auto\">\n{| class=\"wikitable center-all\"\n"
.. "|-\n"
.. "! Semitones\n"
.. "| '''0'''"
for i = 1, sharp * 2 do
tab = tab .. string.format((i % sharp == 0 and " || '''%s'''" or " || %s"), i)
end
end
end
tab = tab .. "\n|-\n! Sharp symbol\n"
tab = tab .. "\n|-\n! Sharp symbol\n"
.. "| rowspan=\"2\" style=\"white-space:nowrap; width:3em\" | &#x202F;[[File:Heji18.svg|15px]]\n"
.. "| rowspan=\"2\" style=\"white-space:nowrap; width:3em\" | " .. natural_t .. "\n"
for i = 1, sharp * 2 do
for i = 1, sharp * 2 do
local cs = math.ceil((i / sharp) - 0.5) -- sharpness of note
local cs = math.ceil((i / sharp) - 0.5) -- sharpness of note
Line 68: Line 97:
if ((i - (sharp * math.floor(i / sharp))) / sharp) > math.ceil(((i - (sharp * math.floor(i / sharp))) / sharp) - 0.5) then
if ((i - (sharp * math.floor(i / sharp))) / sharp) > math.ceil(((i - (sharp * math.floor(i / sharp))) / sharp) - 0.5) then
if (i - (sharp * math.floor(i / sharp))) % 5 == 4 then
if (i - (sharp * math.floor(i / sharp))) % 5 == 4 then
s = s .. "&#x202F;[[File:Down arrow petaluma script.svg|10px]]&#x202F;[[File:Quip narrow.svg|9px]]"
s = s .. down_t .. quip_t
cell_width = cell_width + 3
cell_width = cell_width + 3
else
else
for j = 1, (i - (sharp * math.floor(i / sharp))) % 5 do
for j = 1, (i - (sharp * math.floor(i / sharp))) % 5 do
s = s .. "&#x202F;[[File:Up arrow petaluma script.svg|10px]]"
s = s .. up_t
cell_width = cell_width + 1.5
cell_width = cell_width + 1.5
end
end
end
end
for j = 1, math.floor((i - (sharp * math.floor(i / sharp))) / 5) do
for j = 1, math.floor((i - (sharp * math.floor(i / sharp))) / 5) do
s = s .. "&#x202F;[[File:Quip narrow.svg|9px]]"
s = s .. quip_t
cell_width = cell_width + 1.5
cell_width = cell_width + 1.5
end
end
else
else
if ((sharp * math.ceil(i / sharp)) - i) % 5 == 4 then
if ((sharp * math.ceil(i / sharp)) - i) % 5 == 4 then
s = s .. "&#x202F;[[File:Up arrow petaluma script.svg|10px]]&#x202F;[[File:Quid narrow.svg|9px]]"
s = s .. up_t .. quid_t
cell_width = cell_width + 3
cell_width = cell_width + 3
else
else
for j = 1, ((sharp * math.ceil(i / sharp)) - i) % 5 do
for j = 1, ((sharp * math.ceil(i / sharp)) - i) % 5 do
s = s .. "&#x202F;[[File:Down arrow petaluma script.svg|10px]]"
s = s .. down_t
cell_width = cell_width + 1.5
cell_width = cell_width + 1.5
end
end
end
end
for j = 1, math.floor(((sharp * math.ceil(i / sharp)) - i) / 5) do
for j = 1, math.floor(((sharp * math.ceil(i / sharp)) - i) / 5) do
s = s .. "&#x202F;[[File:Quid narrow.svg|9px]]"
s = s .. quid_t
cell_width = cell_width + 1.5
cell_width = cell_width + 1.5
end
end
end
end
if cs == 1 then
if cs == 1 then
s = s .. "&#x202F;&#x202F;[[File:Heji25.svg|16px]]"
s = s .. sharp_t
elseif cs == 2 then
elseif cs == 2 then
s = s .. "&#x202F;&#x202F;[[File:Heji32.svg|21px]]"
s = s .. dsharp_t
end
end
tab = tab .. string.format(spanf, cell_width, marg, s)
tab = tab .. string.format(spanf, cell_width, marg, s)
Line 123: Line 152:
if ((i - (sharp * math.floor(i / sharp))) / sharp) > math.ceil(((i - (sharp * math.floor(i / sharp))) / sharp) - 0.5) then
if ((i - (sharp * math.floor(i / sharp))) / sharp) > math.ceil(((i - (sharp * math.floor(i / sharp))) / sharp) - 0.5) then
if (i - (sharp * math.floor(i / sharp))) % 5 == 4 then
if (i - (sharp * math.floor(i / sharp))) % 5 == 4 then
s = s .. "&#x202F;[[File:Up arrow petaluma script.svg|10px]]&#x202F;[[File:Quid narrow.svg|9px]]"
s = s .. up_t .. quid_t
cell_width = cell_width + 3
cell_width = cell_width + 3
else
else
for j = 1, (i - (sharp * math.floor(i / sharp))) % 5 do
for j = 1, (i - (sharp * math.floor(i / sharp))) % 5 do
s = s .. "&#x202F;[[File:Down arrow petaluma script.svg|10px]]"
s = s .. down_t
cell_width = cell_width + 1.5
cell_width = cell_width + 1.5
end
end
end
end
for j = 1, math.floor((i - (sharp * math.floor(i / sharp))) / 5) do
for j = 1, math.floor((i - (sharp * math.floor(i / sharp))) / 5) do
s = s .. "&#x202F;[[File:Quid narrow.svg|9px]]"
s = s .. quid_t
cell_width = cell_width + 1.5
cell_width = cell_width + 1.5
end
end
else
else
if ((sharp * math.ceil(i / sharp)) - i) % 5 == 4 then
if ((sharp * math.ceil(i / sharp)) - i) % 5 == 4 then
s = s .. "&#x202F;[[File:Down arrow petaluma script.svg|10px]]&#x202F;[[File:Quip narrow.svg|9px]]"
s = s .. down_t .. quip_t
cell_width = cell_width + 3
cell_width = cell_width + 3
else
else
for j = 1, ((sharp * math.ceil(i / sharp)) - i) % 5 do
for j = 1, ((sharp * math.ceil(i / sharp)) - i) % 5 do
s = s .. "&#x202F;[[File:Up arrow petaluma script.svg|10px]]"
s = s .. up_t
cell_width = cell_width + 1.5
cell_width = cell_width + 1.5
end
end
end
end
for j = 1, math.floor(((sharp * math.ceil(i / sharp)) - i) / 5) do
for j = 1, math.floor(((sharp * math.ceil(i / sharp)) - i) / 5) do
s = s .. "&#x202F;[[File:Quip narrow.svg|9px]]"
s = s .. quip_t
cell_width = cell_width + 1.5
cell_width = cell_width + 1.5
end
end
end
end
if cs == 1 then
if cs == 1 then
s = s .. "&#x202F;&#x202F;[[File:Heji11.svg|16px]]"
s = s .. flat_t
elseif cs == 2 then
elseif cs == 2 then
s = s .. "&#x202F;&#x202F;[[File:Heji4.svg|27px]]"
s = s .. dflat_t
end
end
tab = tab .. string.format(spanf, cell_width, marg, s)
tab = tab .. string.format(spanf, cell_width, marg, s)