Module:Sharpness documentation: Difference between revisions

ArrowHead294 (talk | contribs)
mNo edit summary
Dave Keenan (talk | contribs)
Added line break <br> before "This symbol set ...".
 
(5 intermediate revisions by 2 users not shown)
Line 48: Line 48:


result = result .. "."
result = result .. "."
end


if notation == "" then
if notation == "" then
result = result .. " This symbol set "
result = result .. "<br>This symbol set "


if math.abs(s) == 1 then
if math.abs(s) == 1 then
result = result .. "is identical to standard notation."
result = result .. "is identical to standard notation."
else
else
if extension == "" then
if extension == "" then
if math.abs(s) == 2 then
if math.abs(s) == 2 then
-- If a sharp raises by two steps
-- If a sharp raises by two steps
result = result
.. "comprises sharps, flats, and Stein&ndash;Zimmermann [[24edo #Notation|quartertone]] accidentals."
else
if s == 0 then
result = result
result = result
.. "comprises sharps, flats, and Stein&ndash;Zimmerman [[24edo #Notation|quartertone]] accidentals."
.. "is based on [[ups and downs notation]] and comprises naturals "
.. "with arrows from [[Helmholtz&ndash;Ellis notation]]."
else
else
-- Otherwise (if a sharp raises by three or more steps)
-- Otherwise (if a sharp raises by three or more steps)
result = result
result = result
.. "is based on [[ups and downs notation]] and comprises sharps, flats, "
.. "is based on [[ups and downs notation]] and comprises sharps, flats, "
.. (s % 2 == 0 and "naturals, and Stein&ndash;Zimmerman [[24edo #Notation|quartertone]] accidentals " or "and naturals ")
.. (s % 2 == 0 and "naturals, and Stein&ndash;Zimmermann [[24edo #Notation|quartertone]] accidentals " or "and naturals ")
.. "with arrows from [[Helmholtz&ndash;Ellis notation]]."
.. "with arrows from [[Helmholtz&ndash;Ellis notation]]."
end
end
elseif extension == "a" or extension == "A" then
-- Extension for modern-style ups and downs
result = result .. "is based on [[ups and downs notation]] using separate arrows."
end
end
elseif extension == "a" or extension == "A" then
-- Extension for modern-style ups and downs
result = result .. "is based on [[ups and downs notation]] using separate up and down chevrons."
end
end
else
result = result .. string.format(" It is based on %s.", notation)
end
end
else
result = result .. string.format(" It is based on %s.", notation)
end


-- display custom notes
-- display custom notes
if note or aux_note then
if note or aux_note then
result = result .. " " .. note ..(aux_note ~= "" and "\n\n" .. aux_note or "")
result = result .. " " .. note ..(aux_note ~= "" and "\n\n" .. aux_note or "")
end
end


-- Display the note about supersets of 12edo for sharpness-1 and above and set the edo number for supersets of 12edo
-- Display the note about supersets of 12edo for sharpness-1 and above and set the edo number for supersets of 12edo
if s >= 1 then
if s >= 1 then
local n_edo = s * 12
local n_edo = s * 12


result = result
result = result
.. "\n\n<h3>Parameters</h3>\n"
.. "\n\n<h3>Parameters</h3>\n"
.. string.format("Passing in <code>%d</code> as a single unnamed parameter will change "
.. string.format("Passing in <code>%d</code> as a single unnamed parameter will change "
.. "'''Step offset''' to '''Semitones''' in the case of [[%dedo]]", n_edo, n_edo)
.. "'''Step offset''' to '''Semitones''' in the case of [[%dedo]]", n_edo, n_edo)
if s >= 2 then
if s >= 2 then
result = result .. string.format(", since %dedo is a superset of [[12edo]]", n_edo)
result = result .. string.format(", since %dedo is a superset of [[12edo]]", n_edo)
end
result = result .. "."
end
end
result = result .. "."
end


-- Display a "see also" section for sharpness-2 and above
-- Display a "see also" section for sharpness-2 and above, and sharpness-0
if s >= 2 or s <= -2 then
if s >= 2 or s <= -2 or s == 0 then
local basic = "Template:Sharpness-" .. typ .. value
local basic = "Template:Sharpness-" .. typ .. value
local basic_suf = basic .. "-" .. suffix
local basic_suf = basic .. "-" .. suffix
result = result .. "\n\n<h3>See also</h3>\n"
result = result .. "\n\n<h3>See also</h3>\n"
.. "* [[Alternative symbols for ups and downs notation]]\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}}]] &ndash; ", basic_suf, basic_suf, basic)
.. (s == 2
and "uses Stein&ndash;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]] &ndash; ", basic, basic)
.. "an alternate version of this template that shows separate up and down chevrons.\n|}}"
if (extension == "a" or extension == "A") then
if string.lower(suffix) ~= "" then
-- If the template shows separate arrows
-- 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]] &ndash; ", basic, basic)
.. string.format("* [[{{#ifexist: %s|%s|%s}}]] &ndash; ", basic_suf, basic_suf, basic)
.. "the basic version of this template.|}}"
.. (s == 2
and "uses Stein&ndash;Zimmerman quarter tone accidentals."
or "the classic version of this template that shows arrows attached to standard accidentals.")
else
else
-- If the template shows integrated (HEJI-like) arrows
-- Otherwise, add an additional note for possible extended versions, if they exist
result = result .. string.format("{{#ifexist: %sa|* [[%sa]] &ndash; ", basic, basic)
if s % 2 == 1 and s >= 3 then
.. "an alternate version of this template that shows separate arrows.\n|}}"
result = result .. string.format("{{#ifexist: %s-extended|* [[%s-extended]] &ndash; ", basic, basic)
.. "an alternate version of this template that includes "
if string.lower(suffix) ~= "" then
if s == 3 then
-- If we are on a different version of a template (e.g. "extended" ones that show more arrows than the minimum)
-- Sharp-3 EDOs normally only need single arrows, but note that  
result = result .. string.format("{{#ifexist: %s|* [[%s]] &ndash; ", basic, basic)
-- sometimes double arrows may be needed
.. "the basic version of this template.|}}"
result = result .. "double"
else
elseif s == 5 then
-- Otherwise, add an additional note for possible extended versions, if they exist
-- Sharp-5 EDOs normally need double arrows, and note that sometimes
if s % 2 == 1 and s >= 3 then
-- triple arrows may be needed
result = result .. string.format("{{#ifexist: %s-extended|* [[%s-extended]] &ndash; ", basic, basic)
result = result .. "triple"
.. "an alternate version of this template that includes "
end
if s == 3 then
result = result .. " arrows.|}}"
-- 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 .. "triple"
end
result = result .. " arrows.|}}"
end
end
end
end
end
Line 141: Line 147:
end
end


return frame:preprocess(debugg == true and "<syntaxhighlight lang=\"wikitext\">" .. result .. "</syntaxhighlight>" or result)
-- Debugger option
if debugg == true then
result = "<syntaxhighlight lang=\"wikitext\">" .. result .. "</syntaxhighlight>"
end
return frame:preprocess(result)
end
end


return p
return p