Module:Sharpness documentation: Difference between revisions

ArrowHead294 (talk | contribs)
mNo edit summary
ArrowHead294 (talk | contribs)
mNo edit summary
Line 23: Line 23:
end
end


local out_str = "This template is used "
local result = "This template is used "


if s == 0 then
if s == 0 then
-- Sharp-0 EDOs (lower 5 multiples of 7) are redundant, take care of that right away
-- Sharp-0 EDOs (lower 5 multiples of 7) are redundant, take care of that right away
out_str = out_str
result = result
.. "for {{EDOs| 7, 14, 21, 28, and 35 }} [[equal divisions of the octave]]. "
.. "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), "
.. "Since these tunings temper out the 3-limit augmented unison ([[2187/2048]], known as the Pythagorean apotome), "
Line 34: Line 34:
else
else
-- Otherwise
-- Otherwise
out_str = out_str
result = result
.. "for [[edo]]s where a sharp "
.. "for [[edo]]s where a sharp "
.. ((s < 0) and "lowers" or "raises")
.. ((s < 0) and "lowers" or "raises")
Line 42: Line 42:


if math.abs(s) ~= 1 then
if math.abs(s) ~= 1 then
out_str = out_str .. "s"
result = result .. "s"
end
end


out_str = out_str .. "."
result = result .. "."


if notation == "" then
if notation == "" then
out_str = out_str .. " This symbol set "
result = result .. " This symbol set "


if math.abs(s) == 1 then
if math.abs(s) == 1 then
out_str = out_str .. "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
out_str = out_str
result = result
.. "comprises sharps, flats, and Stein&ndash;Zimmerman [[24edo #Notation|quartertone]] accidentals."
.. "comprises sharps, flats, and Stein&ndash;Zimmerman [[24edo #Notation|quartertone]] accidentals."
else
else
-- Otherwise (if a sharp raises by three or more steps)
-- Otherwise (if a sharp raises by three or more steps)
out_str = out_str
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;Zimmerman [[24edo #Notation|quartertone]] accidentals " or "and naturals ")
Line 67: Line 67:
elseif extension == "a" or extension == "A" then
elseif extension == "a" or extension == "A" then
-- Extension for modern-style ups and downs
-- Extension for modern-style ups and downs
out_str = out_str .. "is based on [[ups and downs notation]] using separate arrows."
result = result .. "is based on [[ups and downs notation]] using separate arrows."
end
end
end
end
else
else
out_str = out_str .. " It is based on " .. notation .. "."
result = result .. " It is based on " .. notation .. "."
end
end


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


Line 83: Line 83:
local n_edo = s * 12
local n_edo = s * 12


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


Line 97: Line 97:
local basic = "Template:Sharpness-" .. typ .. value
local basic = "Template:Sharpness-" .. typ .. value
local basic_suf = basic .. "-" .. suffix
local basic_suf = basic .. "-" .. suffix
out_str = out_str .. "\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 (extension == "a" or extension == "A") then
-- If the template shows separate arrows
-- If the template shows separate arrows
out_str = out_str
result = result
.. "* [[{{#ifexist: " .. basic_suf .. "|" .. basic_suf .. "|" .. basic .. "}}]] &ndash; "
.. "* [[{{#ifexist: " .. basic_suf .. "|" .. basic_suf .. "|" .. basic .. "}}]] &ndash; "
.. (s == 2
.. (s == 2
Line 109: Line 109:
else
else
-- If the template shows integrated (HEJI-like) arrows
-- If the template shows integrated (HEJI-like) arrows
out_str = out_str .. "{{#ifexist: " .. basic .. "a|* [[" .. basic .. "a]] &ndash; "
result = result .. "{{#ifexist: " .. basic .. "a|* [[" .. basic .. "a]] &ndash; "
.. "an alternate version of this template that shows separate arrows.\n|}}"
.. "an alternate version of this template that shows separate arrows.\n|}}"
if string.lower(suffix) ~= "" then
if string.lower(suffix) ~= "" then
-- If we are on a different version of a template (e.g. "extended" ones that show more arrows than the minimum)
-- If we are on a different version of a template (e.g. "extended" ones that show more arrows than the minimum)
out_str = out_str .. "{{#ifexist: ".. basic .. "|* [[" .. basic .. "]] &ndash; "
result = result .. "{{#ifexist: ".. basic .. "|* [[" .. basic .. "]] &ndash; "
.. "the basic version of this template.|}}"
.. "the basic version of this template.|}}"
else
else
-- Otherwise, add an additional note for possible extended versions, if they exist
-- Otherwise, add an additional note for possible extended versions, if they exist
if s == 3 or s == 5 then
if s == 3 or s == 5 then
out_str = out_str .. "{{#ifexist: " .. basic .. "-extended|* [[" .. basic .. "-extended]] &ndash; "
result = result .. "{{#ifexist: " .. basic .. "-extended|* [[" .. basic .. "-extended]] &ndash; "
.. "an alternate version of this template that includes "
.. "an alternate version of this template that includes "
Line 125: Line 125:
-- Sharp-3 EDOs normally only need single arrows, but note that  
-- Sharp-3 EDOs normally only need single arrows, but note that  
-- sometimes double arrows may be needed
-- sometimes double arrows may be needed
out_str = out_str .. "double"
result = result .. "double"
elseif s == 5 then
elseif s == 5 then
-- Sharp-5 EDOs normally need double arrows, and note that sometimes
-- Sharp-5 EDOs normally need double arrows, and note that sometimes
-- triple arrows may be needed
-- triple arrows may be needed
out_str = out_str .. "triple"
result = result .. "triple"
end
end
out_str = out_str .. " arrows.|}}"
result = result .. " arrows.|}}"
end
end
end
end
Line 140: Line 140:


local is_debug = yesno(frame.args["debug"])
local is_debug = yesno(frame.args["debug"])
return frame:preprocess(is_debug == true and "<pre>" .. out_str .. "</pre>" or out_str)
return frame:preprocess(is_debug == true and "<pre>" .. result .. "</pre>" or result)
end
end


return module
return module