Module:Ups and downs sharpness: Difference between revisions
Tristanbay (talk | contribs) took away nowrap again, idk why it doesn't work Tag: Manual revert |
ArrowHead294 (talk | contribs) mNo edit summary |
||
| Line 8: | Line 8: | ||
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 tab = "{|class=\"wikitable\"\n| | local tab = "{| class=\"wikitable\"\n" | ||
.. "|-\n" | |||
.. "! Step offset\n" | |||
.. "| '''0'''\n" | |||
for i = 1, sharp * 2 + 1 do | for i = 1, sharp * 2 + 1 do | ||
if (i % sharp == 0) then | if (i % sharp == 0) then | ||
tab = tab .. "|'''" .. i .. "'''\n" | tab = tab .. "| '''" .. i .. "'''\n" | ||
else | else | ||
tab = tab .. "|" .. i .. "\n" | tab = tab .. "| " .. i .. "\n" | ||
end | end | ||
end | end | ||
tab = tab .. "|-\n!Sharp symbol\n|rowspan=\"2\"|[[File:Heji18.svg|15px]]\n" | tab = tab .. "|-\n! Sharp symbol\n| rowspan=\"2\" | [[File:Heji18.svg|15px]]\n" | ||
for i = 1, sharp * 2 + 1 do | for i = 1, sharp * 2 + 1 do | ||
tab = tab .. "|" | local cs = math.ceil((i / sharp) - 0.5) | ||
tab = tab .. "| <span style=\"display: inline-block; margin-bottom: -45px; transform: translate(0, " | |||
if cs == 0 then | |||
tab = tab .. "-2.5px" | |||
elseif cs == 1 then | |||
tab = tab .. "-15px" | |||
elseif cs == 2 then | |||
tab = tab .. "-20px" | |||
end | |||
tab = tab .. "); 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 | ||
| Line 42: | Line 54: | ||
end | end | ||
end | end | ||
if | if cs == 1 then | ||
tab = tab .. " [[File:Heji25.svg|16px]]" | tab = tab .. " [[File:Heji25.svg|16px]]" | ||
elseif | elseif cs == 2 then | ||
tab = tab .. " [[File:Heji32.svg|21px]]" | tab = tab .. " [[File:Heji32.svg|21px]]" | ||
end | end | ||
tab = tab .. "\n" | tab = tab .. "</span>\n" | ||
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 | ||
tab = tab .. "|" | tab = tab .. "| style=\"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 | ||