Module:Sharpness documentation: Difference between revisions

ArrowHead294 (talk | contribs)
mNo edit summary
ArrowHead294 (talk | contribs)
mNo edit summary
Line 1: Line 1:
local yesno = require("Module:yesno")
local yesno = require("Module:Yesno")
local module = {}
local module = {}


Line 7: Line 7:
local aux_note = frame.args["auxnote"] or ""
local aux_note = frame.args["auxnote"] or ""
local notation = frame.args["notation"] or ""
local notation = frame.args["notation"] or ""
local is_debug = yesno(frame.args["debug"])


-- typ: "sharp" or "flat"
-- typ: "sharp" or "flat"
Line 71: Line 72:
end
end
else
else
result = result .. " It is based on " .. notation .. "."
result = result .. string.format(" It is based on %s.", notation)
end
end


Line 85: Line 86:
result = result
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 "
.. string.format("Passing in <code>%d</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 [[%dedo]]", n_edo, n_edo)
if s >= 2 then
if s >= 2 then
result = result .. ", since " .. n_edo .. "edo is a superset of [[12edo]]"
result = result .. string.format(", since %dedo is a superset of [[12edo]]", n_edo)
end
end
result = result .. "."
result = result .. "."
Line 103: Line 104:
-- If the template shows separate arrows
-- If the template shows separate arrows
result = result
result = result
.. "* [[{{#ifexist: " .. basic_suf .. "|" .. basic_suf .. "|" .. basic .. "}}]] &ndash; "
.. string.format("* [[{{#ifexist: %s|%s|%s}}]] &ndash; ", basic_suf, basic_suf, basic)
.. (s == 2
.. (s == 2
and "uses Stein&ndash;Zimmerman quarter tone accidentals."
and "uses Stein&ndash;Zimmerman quarter tone accidentals."
Line 109: Line 110:
else
else
-- If the template shows integrated (HEJI-like) arrows
-- If the template shows integrated (HEJI-like) arrows
result = result .. "{{#ifexist: " .. basic .. "a|* [[" .. basic .. "a]] &ndash; "
result = result .. string.format("{{#ifexist: %sa|* [[%sa]] &ndash; ", basic, basic)
.. "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)
result = result .. "{{#ifexist: ".. basic .. "|* [[" .. basic .. "]] &ndash; "
result = result .. string.format("{{#ifexist: %sa|* [[%sa]] &ndash; ", basic, basic)
.. "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 % 2 == 1 and s >= 3 then
result = result .. "{{#ifexist: " .. basic .. "-extended|* [[" .. basic .. "-extended]] &ndash; "
result = result .. string.format("{{#ifexist: %s-extended|* [[%s-extended]] &ndash; ", basic, basic)
.. "an alternate version of this template that includes "
.. "an alternate version of this template that includes "
Line 139: Line 140:
end
end


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


return module
return module