Module:Ups and downs sharpness: Difference between revisions
Tristanbay (talk | contribs) More spacing between flats and sharps and arrows |
ArrowHead294 (talk | contribs) mNo edit summary |
||
| Line 9: | Line 9: | ||
function p.ud_sharpness(frame) -- generate table | function p.ud_sharpness(frame) -- generate table | ||
local sharp = sharp_n(frame.args["edo"]) | local sharp = sharp_n(frame.args["edo"]) | ||
local spanf = "| <span style=\"display: inline-block; margin-bottom: -45px; transform: translate(0, %spx); white-space: nowrap;\">%s</span>\n" | |||
local arrow_marg = -2.5 | local arrow_marg = -2.5 | ||
local sharp_marg = -15 | local sharp_marg = -15 | ||
| Line 20: | Line 21: | ||
tab = "{{sharpness-flat1}}" | tab = "{{sharpness-flat1}}" | ||
elseif sharp == 0 then | elseif sharp == 0 then | ||
tab = "{| class=\"wikitable center-all\"\n" | tab = "{| class=\"wikitable center-all\"\n" | ||
.. "|-\n" | .. "|-\n" | ||
| Line 49: | Line 49: | ||
for i = 1, sharp * 2 + 1 do | for i = 1, sharp * 2 + 1 do | ||
local cs = math.ceil((i / sharp) - 0.5) | local cs = math.ceil((i / sharp) - 0.5) | ||
local marg | |||
local s = "" | |||
if cs == 0 then | if cs == 0 then | ||
marg = arrow_marg | |||
elseif cs == 1 then | elseif cs == 1 then | ||
marg = sharp_marg | |||
elseif cs == 2 then | elseif cs == 2 then | ||
marg = double_sharp_marg | |||
else | |||
marg = 0 -- Failsafe | |||
end | end | ||
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 .. " [[File:Down arrow petaluma script.svg|10px]] [[File:Quip narrow.svg|9px]]" | |||
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 .. " [[File:Up arrow petaluma script.svg|10px]]" | |||
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 .. " [[File:Quip narrow.svg|9px]]" | |||
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 .. " [[File:Up arrow petaluma script.svg|10px]] [[File:Quid narrow.svg|9px]]" | |||
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 .. " [[File:Down arrow petaluma script.svg|10px]]" | |||
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 .. " [[File:Quid narrow.svg|9px]]" | |||
end | end | ||
end | end | ||
if cs == 1 then | if cs == 1 then | ||
s = s .. "  [[File:Heji25.svg|16px]]" | |||
elseif cs == 2 then | elseif cs == 2 then | ||
s = s .. "  [[File:Heji32.svg|21px]]" | |||
end | end | ||
tab = tab .. | tab = tab .. string.format(spanf, marg, s) | ||
end | end | ||
tab = tab .. "|-\n! Flat symbol\n" | tab = tab .. "|-\n! Flat symbol\n" | ||
for i = 1, sharp * 2 + 1 do | for i = 1, sharp * 2 + 1 do | ||
local cs = math.ceil((i / sharp) - 0.5) | local cs = math.ceil((i / sharp) - 0.5) | ||
local marg | |||
local s = "" | |||
if cs == 1 or cs == 2 then | if cs == 1 or cs == 2 then | ||
marg = flat_marg | |||
end | end | ||
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 .. " [[File:Up arrow petaluma script.svg|10px]] [[File:Quid narrow.svg|9px]]" | |||
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 .. " [[File:Down arrow petaluma script.svg|10px]]" | |||
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 .. " [[File:Quid narrow.svg|9px]]" | |||
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 .. " [[File:Down arrow petaluma script.svg|10px]] [[File:Quip narrow.svg|9px]]" | |||
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 .. " [[File:Up arrow petaluma script.svg|10px]]" | |||
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 .. " [[File:Quip narrow.svg|9px]]" | |||
end | end | ||
end | end | ||
if cs == 1 then | if cs == 1 then | ||
s = s .. "  [[File:Heji11.svg|16px]]" | |||
elseif cs == 2 then | elseif cs == 2 then | ||
s = s .. "  [[File:Heji4.svg|27px]]" | |||
end | end | ||
tab = tab .. | tab = tab .. string.format(spanf, marg, s) | ||
end | end | ||
tab = tab .. "|}" | tab = tab .. "|}" | ||
end | end | ||