Module:Sharpness documentation: Difference between revisions
Jump to navigation
Jump to search
Missing sharpness-(-2) |
ArrowHead294 (talk | contribs) mNo edit summary |
||
| Line 48: | Line 48: | ||
if math.abs(s) == 1 then | if math.abs(s) == 1 then | ||
out_str = out_str .. "is identical to standard notation." | out_str = out_str .. "is identical to standard notation." | ||
else | else | ||
if extension == "" then | if extension == "" then | ||
out_str = out_str .. "[[ups and downs notation]] and comprises sharps, flats, " | if math.abs(s) == 2 then | ||
out_str = out_str .. "comprises sharps, flats, and Stein–Zimmerman [[24edo #Notation|quartertone]] accidentals." | |||
else | |||
out_str = out_str .. "[[ups and downs notation]] and comprises sharps, flats, " | |||
.. (s % 2 == 0 | |||
and "naturals, and Stein–Zimmerman [[24edo #Notation|quartertone]] accidentals " | |||
or "and naturals ") | |||
.. "with arrows from [[Helmholtz–Ellis notation]]." | |||
end | |||
elseif extension == "a" or extension == "A" then -- extension for modern-style ups and downs | elseif extension == "a" or extension == "A" then -- extension for modern-style ups and downs | ||
out_str = out_str .. "is based on [[ups and downs notation]] using separate arrows." | out_str = out_str .. "is based on [[ups and downs notation]] using separate arrows." | ||
| Line 83: | Line 84: | ||
-- display the see also section for sharpness-3 and above | -- display the see also section for sharpness-3 and above | ||
if s >= 3 then | if s >= 3 or (s == 2 and (extension == "a" or extension == "A")) then | ||
out_str = out_str | out_str = out_str | ||
.. "\n\n<h3>See also</h3>\n" | .. "\n\n<h3>See also</h3>\n" | ||
Revision as of 11:45, 13 February 2025
- This module should not be invoked directly; use its corresponding template instead: Template:Sharpness documentation.
This module is used for Template:Sharpness documentation to automate information for sharpness templates (templates that show how many steps sharps or flats raise or lower by).
By default, it handles standard sharps and flats, quarter-tone accidentals, and ups and downs notation.
| Introspection summary for Module:Sharpness documentation | |||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
| ||||||||||||
No function descriptions were provided. The Lua code may have further information.
See also
local yesno = require("Module:yesno")
local p = {}
function p.main(frame)
local in_str = frame.args["input"]
local note = frame.args["note"] or ""
local notation = frame.args["notation"] or ""
-- type: "sharp" or "flat"
-- value: absolute value of sharpness (the "n" as in sharp-n and flat-n)
-- extension: used for identifying alternative symbol set
local type, value, extension = in_str:match("%-(%a*)(%d+)(%a*)")
-- signed sharpness
local s = tonumber(value)
if type == "flat" then
s = -s
end
local sc = s * 12 -- edo number for supersets of 12edo
if extension == nil then
extension = ""
end
local out_str = "This template is used "
if s == 0 then
out_str = out_str
.. "for {{EDOs| 7, 14, 21, 28, and 35 }} [[equal divisions of the octave]]. "
.. "Since these tunings temper out the 3-limit augmented unison ([[2187/2048]], known as the Pythagorean apotome), "
.. "going up seven fifths brings one back to the root note, and as such, "
.. "the traditional sharps and flats are redundant and cannot raise or lower the pitch."
else
out_str = out_str
.. "for [[edo]]s where a sharp "
.. ((s < 0) and {"lowers"} or {"raises"})[1] .. " by " .. math.abs(s) .. " step"
if math.abs(s) ~= 1 then
out_str = out_str .. "s"
end
out_str = out_str .. "."
if notation == "" then
out_str = out_str .. " This symbol set "
if math.abs(s) == 1 then
out_str = out_str .. "is identical to standard notation."
else
if extension == "" then
if math.abs(s) == 2 then
out_str = out_str .. "comprises sharps, flats, and Stein–Zimmerman [[24edo #Notation|quartertone]] accidentals."
else
out_str = out_str .. "[[ups and downs notation]] and comprises sharps, flats, "
.. (s % 2 == 0
and "naturals, and Stein–Zimmerman [[24edo #Notation|quartertone]] accidentals "
or "and naturals ")
.. "with arrows from [[Helmholtz–Ellis notation]]."
end
elseif extension == "a" or extension == "A" then -- extension for modern-style ups and downs
out_str = out_str .. "is based on [[ups and downs notation]] using separate arrows."
end
end
else
out_str = out_str .. " It is based on " .. notation .. "."
end
-- display custom note
if note then
out_str = out_str .. " " .. note
end
-- display the note about supersets of 12edo for sharpness-1 and above
if s >= 1 then
out_str = out_str
.. "\n\n<h3>Parameters</h3>\n"
.. "Passing <code>{{pipe}}"
.. sc
.. "</code> will change '''Step offset''' to '''Semitones''' in the case of [["
.. sc .. "edo]]"
.. ((s >= 2) and {", since " .. sc .. "edo is a superset of [[12edo]]."} or {"."})[1]
end
-- display the see also section for sharpness-3 and above
if s >= 3 or (s == 2 and (extension == "a" or extension == "A")) then
out_str = out_str
.. "\n\n<h3>See also</h3>\n"
.. "* [[Alternative symbols for ups and downs notation]]"
end
end
local debugg = yesno(frame.args["debug"])
return frame:preprocess(debugg == true and "<pre>" .. out_str .. "</pre>" or out_str)
end
return p