- This module should not be invoked directly; use its corresponding template instead: Template:MOS scalesig.
Module:MOS scalesig formats a string into a mos scale signature, with non-breaking spaces and, if non-octave, the appropriate brackets. Scale signatures can optionally be formatted as a link to the scale's wiki page.
| Introspection summary for Module:MOS scalesig
|
Functions provided (1)
| Line
|
Function
|
Params
|
| 8
|
mos_scalesig (invokable)
|
(frame)
|
|
|
No function descriptions were provided. The Lua code may have further information.
local p = {}
local getArgs = require("Module:Arguments").getArgs
local mos = require("Module:MOS")
local yesno = require("Module:Yesno")
-- Wrapper function; calls mos module's to-string and to-link functions
function p.mos_scalesig(frame)
local args = getArgs(frame)
local input_mos = mos.parse(args["scalesig"])
local is_link = yesno(args["link"], false)
local is_long = yesno(args["long"], false)
local debugg = yesno(args["debug"])
function make_scalesig()
if is_link then
-- Text is a link to the mospage
-- Long link links to and displays "xL ys (p/q-equivalent)"
-- (Short) link instead displays "xL ys<p/q>"
-- Has no effect if it's octave-equivalent.
return (is_long and mos.as_long_link(input_mos) or mos.as_link(input_mos))
else
-- Text is the scalesig, with nbsp and appropriate brackets added
-- Long string displays "xL ys (p/q-equivalent)"
-- (Short) string instead displays "xL ys<p/q>"
-- Has no effect if it's octave-equivalent.
return (is_long and mos.as_long_string(input_mos) or mos.as_string(input_mos))
end
end
local result = make_scalesig()
-- Debugger option
if debugg == true then
result = "<syntaxhighlight lang=\"wikitext\">" .. result .. "</syntaxhighlight>"
end
return frame:preprocess(result)
end
return p