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: | 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 " | 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> | .. string.format("Passing in <code>%d</code> as a single unnamed parameter will change " | ||
.. "'''Step offset''' to '''Semitones''' in the case of [[ | .. "'''Step offset''' to '''Semitones''' in the case of [[%dedo]]", n_edo, n_edo) | ||
if s >= 2 then | if s >= 2 then | ||
result = result .. ", since | 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: | .. string.format("* [[{{#ifexist: %s|%s|%s}}]] – ", basic_suf, basic_suf, basic) | ||
.. (s == 2 | .. (s == 2 | ||
and "uses Stein–Zimmerman quarter tone accidentals." | and "uses Stein–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: | result = result .. string.format("{{#ifexist: %sa|* [[%sa]] – ", 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: | result = result .. string.format("{{#ifexist: %sa|* [[%sa]] – ", 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 == | if s % 2 == 1 and s >= 3 then | ||
result = result .. "{{#ifexist: | result = result .. string.format("{{#ifexist: %s-extended|* [[%s-extended]] – ", basic, basic) | ||
.. "an alternate version of this template that includes " | .. "an alternate version of this template that includes " | ||
| Line 139: | Line 140: | ||
end | end | ||
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 | ||