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
local spanf = "| <span style=\"display: inline-block; margin-bottom: -45px; transform: translate(0, %spx); white-space: nowrap;\">%s</span>\n"
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)
tab = tab .. "| <span style=\"display: inline-block; margin-bottom: -45px; transform: translate(0, "
local marg
local s = ""
if cs == 0 then
if cs == 0 then
tab = tab .. arrow_marg
marg = arrow_marg
elseif cs == 1 then
elseif cs == 1 then
tab = tab .. sharp_marg
marg = sharp_marg
elseif cs == 2 then
elseif cs == 2 then
tab = tab .. double_sharp_marg
marg = double_sharp_marg
else
marg = 0 -- Failsafe
end
end
tab = tab .. "px); white-space: nowrap;\">"
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
tab = tab .. "&#x202F;[[File:Down arrow petaluma script.svg|10px]]&#x202F;[[File:Quip narrow.svg|9px]]"
s = s .. "&#x202F;[[File:Down arrow petaluma script.svg|10px]]&#x202F;[[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
tab = tab .. "&#x202F;[[File:Up arrow petaluma script.svg|10px]]"
s = s .. "&#x202F;[[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
tab = tab .. "&#x202F;[[File:Quip narrow.svg|9px]]"
s = s .. "&#x202F;[[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
tab = tab .. "&#x202F;[[File:Up arrow petaluma script.svg|10px]]&#x202F;[[File:Quid narrow.svg|9px]]"
s = s .. "&#x202F;[[File:Up arrow petaluma script.svg|10px]]&#x202F;[[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
tab = tab .. "&#x202F;[[File:Down arrow petaluma script.svg|10px]]"
s = s .. "&#x202F;[[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
tab = tab .. "&#x202F;[[File:Quid narrow.svg|9px]]"
s = s .. "&#x202F;[[File:Quid narrow.svg|9px]]"
end
end
end
end
if cs == 1 then
if cs == 1 then
tab = tab .. "&#x202F;&#x202F;[[File:Heji25.svg|16px]]"
s = s .. "&#x202F;&#x202F;[[File:Heji25.svg|16px]]"
elseif cs == 2 then
elseif cs == 2 then
tab = tab .. "&#x202F;&#x202F;[[File:Heji32.svg|21px]]"
s = s .. "&#x202F;&#x202F;[[File:Heji32.svg|21px]]"
end
end
tab = tab .. "</span>\n"
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)
tab = tab .. "| <span style=\"display: inline-block; margin-bottom: -45px; transform: translate(0, "
local marg
local s = ""
if cs == 1 or cs == 2 then
if cs == 1 or cs == 2 then
tab = tab .. flat_marg
marg = flat_marg
end
end
tab = tab .. "px); white-space: nowrap;\">"
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
tab = tab .. "&#x202F;[[File:Up arrow petaluma script.svg|10px]]&#x202F;[[File:Quid narrow.svg|9px]]"
s = s .. "&#x202F;[[File:Up arrow petaluma script.svg|10px]]&#x202F;[[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
tab = tab .. "&#x202F;[[File:Down arrow petaluma script.svg|10px]]"
s = s .. "&#x202F;[[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
tab = tab .. "&#x202F;[[File:Quid narrow.svg|9px]]"
s = s .. "&#x202F;[[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
tab = tab .. "&#x202F;[[File:Down arrow petaluma script.svg|10px]]&#x202F;[[File:Quip narrow.svg|9px]]"
s = s .. "&#x202F;[[File:Down arrow petaluma script.svg|10px]]&#x202F;[[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
tab = tab .. "&#x202F;[[File:Up arrow petaluma script.svg|10px]]"
s = s .. "&#x202F;[[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
tab = tab .. "&#x202F;[[File:Quip narrow.svg|9px]]"
s = s .. "&#x202F;[[File:Quip narrow.svg|9px]]"
end
end
end
end
if cs == 1 then
if cs == 1 then
tab = tab .. "&#x202F;&#x202F;[[File:Heji11.svg|16px]]"
s = s .. "&#x202F;&#x202F;[[File:Heji11.svg|16px]]"
elseif cs == 2 then
elseif cs == 2 then
tab = tab .. "&#x202F;&#x202F;[[File:Heji4.svg|27px]]"
s = s .. "&#x202F;&#x202F;[[File:Heji4.svg|27px]]"
end
end
tab = tab .. "</span>\n"
tab = tab .. string.format(spanf, marg, s)
end
end
tab = tab .. "|}"
tab = tab .. "|}"
end
end