Module:Ups and downs sharpness: Difference between revisions

Tristanbay (talk | contribs)
removed inline-block to see what that'll do
Tristanbay (talk | contribs)
change to pure XHTML
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=\"margin-bottom:-45px; transform:translate(0, %spx); white-space:nowrap;\">%s</span>\n"
local spanf = "<td style=\"margin-bottom:-45px; transform:translate(0, %spx); white-space:nowrap;\">%s</td>\n"
local arrow_marg = -2.5
local arrow_marg = -2.5
local sharp_marg = -15
local sharp_marg = -15
Line 21: Line 21:
tab = "{{sharpness-flat1}}"
tab = "{{sharpness-flat1}}"
elseif sharp == 0 then
elseif sharp == 0 then
tab = "{| class=\"wikitable center-all\"\n"
tab = "<table center-all>\n"
.. "|-\n"
.. "<tr>\n"
.. "! Step offset\n"
.. "<th>Step offset</th>\n"
.. "| −3 || −2 || −1 || 0 || +1 || +2 || +3\n"
.. "<td>−3</td><td>−2</td><td>−1</td><td>0</td><td>+1</td><td>+2</td><td>+3</td>\n"
.. "|-\n"
.. "</tr>\n<tr>"
.. "! Symbol\n"
.. "<th>Symbol</th>\n"
.. string.format(spanf, arrow_marg, string.rep("&#x202F;[[File:Down arrow petaluma script.svg|10px]]", 3))
.. string.format(spanf, arrow_marg, string.rep("&#x202F;[[File:Down arrow petaluma script.svg|10px]]", 3))
.. string.format(spanf, arrow_marg, string.rep("&#x202F;[[File:Down arrow petaluma script.svg|10px]]", 2))
.. string.format(spanf, arrow_marg, string.rep("&#x202F;[[File:Down arrow petaluma script.svg|10px]]", 2))
Line 34: Line 34:
.. string.format(spanf, arrow_marg, string.rep("&#x202F;[[File:Up arrow petaluma script.svg|10px]]", 2))
.. string.format(spanf, arrow_marg, string.rep("&#x202F;[[File:Up arrow petaluma script.svg|10px]]", 2))
.. string.format(spanf, arrow_marg, string.rep("&#x202F;[[File:Up arrow petaluma script.svg|10px]]", 3))
.. string.format(spanf, arrow_marg, string.rep("&#x202F;[[File:Up arrow petaluma script.svg|10px]]", 3))
.. "|}"
.. "</tr>\n</table>"
elseif sharp == 1 then
elseif sharp == 1 then
tab = "{{sharpness-sharp1}}"
tab = "{{sharpness-sharp1}}"
else
else
tab = "{| class=\"wikitable center-all\"\n"
tab = "<table center-all>\n"
.. "|-\n"
.. "<tr>\n"
.. "! Step offset\n"
.. "<th>Step offset<th>\n"
.. "| '''0'''"
.. "<td>'''0'''</td>"
for i = 1, sharp * 2 + 1 do
for i = 1, sharp * 2 + 1 do
tab = tab .. string.format((i % sharp == 0 and " || '''%s'''" or " || %s"), i)
tab = tab .. string.format((i % sharp == 0 and "<td>'''%s'''</td>" or "<td>%s</td>"), i)
end
end
tab = tab .. "\n|-\n! Sharp symbol\n"
tab = tab .. "\n</tr>\n<tr>\n<th>Sharp symbol<th>\n"
.. "| rowspan=\"2\" | <span style=\"white-space:nowrap;\">&#x202F;[[File:Heji18.svg|15px]]</span>\n"
.. "<td rowspan=\"2\" style=\"white-space:nowrap;\">&#x202F;[[File:Heji18.svg|15px]]</td>\n"
for i = 1, sharp * 2 + 1 do
for i = 1, sharp * 2 + 1 do
local cs = math.ceil((i / sharp) - 0.5) -- sharpness of note
local cs = math.ceil((i / sharp) - 0.5) -- sharpness of note
Line 93: Line 93:
end
end
tab = tab .. "|-\n! Flat symbol\n"
tab = tab .. "\n<tr>\n<th>Flat symbol</th>\n"
for i = 1, sharp * 2 + 1 do
for i = 1, sharp * 2 + 1 do
Line 137: Line 137:
end
end
tab = tab .. "|}"
tab = tab .. "\n</table>"
end
end