Module:Sharpness documentation: Difference between revisions
Dave Keenan (talk | contribs) Enable a See Also section with alternatives in the case of sharpness = 0 |
Dave Keenan (talk | contribs) Change the if-then-else nesting so that the See Also section works for sharpness zero. |
||
| Line 94: | Line 94: | ||
result = result .. "." | result = result .. "." | ||
end | end | ||
end | |||
-- Display a "see also" section for sharpness-2 and above, and sharpness-0 | |||
if s >= 2 or s <= -2 or s == 0 then | |||
local basic = "Template:Sharpness-" .. typ .. value | |||
local basic_suf = basic .. "-" .. suffix | |||
result = result .. "\n\n<h3>See also</h3>\n" | |||
.. "* [[Alternative symbols for ups and downs notation]]\n" | |||
if (extension == "a" or extension == "A") then | |||
-- If the template shows separate up and down chevrons | |||
result = result | |||
.. string.format("* [[{{#ifexist: %s|%s|%s}}]] – ", basic_suf, basic_suf, basic) | |||
.. (s == 2 | |||
and "uses Stein–Zimmermann quarter tone accidentals." | |||
or "the classic version of this template that shows arrows attached to standard accidentals.") | |||
else | |||
-- If the template shows integrated (HEJI-like) arrows | |||
result = result .. string.format("{{#ifexist: %sa|* [[%sa]] – ", basic, basic) | |||
.. "an alternate version of this template that shows separate up and down chevrons.\n|}}" | |||
if ( | if string.lower(suffix) ~= "" then | ||
-- If the | -- If we are on a different version of a template (e.g. "extended" ones that show more arrows than the minimum) | ||
result = result | result = result .. string.format("{{#ifexist: %s|* [[%s]] – ", basic, basic) | ||
.. "the basic version of this template.|}}" | |||
.. | |||
else | else | ||
-- | -- Otherwise, add an additional note for possible extended versions, if they exist | ||
result = result .. string.format("{{#ifexist: % | if s % 2 == 1 and s >= 3 then | ||
.. "an alternate version of this template that | result = result .. string.format("{{#ifexist: %s-extended|* [[%s-extended]] – ", basic, basic) | ||
.. "an alternate version of this template that includes " | |||
if s == 3 then | |||
-- Sharp-3 EDOs normally only need single arrows, but note that | |||
-- sometimes double arrows may be needed | |||
result = result .. "double" | |||
elseif s == 5 then | |||
-- Sharp-5 EDOs normally need double arrows, and note that sometimes | |||
-- triple arrows may be needed | |||
result = result .. | result = result .. "triple" | ||
end | |||
result = result .. " arrows.|}}" | |||
end | end | ||
end | end | ||