Module:MOS scalesig: Difference between revisions

Ganaram inukshuk (talk | contribs)
module now calls link functions from module:mos
Ganaram inukshuk (talk | contribs)
remove preprocessing function, as expected input will always be unparsed scalesigs
Line 3: Line 3:
local getArgs = require("Module:Arguments").getArgs
local getArgs = require("Module:Arguments").getArgs
local p = {}
local p = {}
-- Preprocess unparsed scalesig; if it's raw text, then it's a scalesig to be
-- parsed into a mos; if it's a mos as defined by the mos module, return it.
function p.preprocess_unparsed_scalesig(unparsed)
if unparsed.nL ~= nil and unparsed.ns ~= nil and unparsed.equave ~= nil then
return unparsed
else
return mos.parse(unparsed)
end
end


-- Function to format a string into a mos scalesig, with nonbreaking spaces.
-- Function to format a string into a mos scalesig, with nonbreaking spaces.
Line 20: Line 10:
--  be 2/1-equivalent.
--  be 2/1-equivalent.
-- - is_link - Whether the scalesig is a link to its wiki page.
-- - is_link - Whether the scalesig is a link to its wiki page.
function p._mos_scalesig(unparsed, is_link, is_long)
function p._mos_scalesig(input_mos, is_link, is_long)
local input_mos = p.preprocess_unparsed_scalesig(unparsed)
local is_link = yesno(is_link, false)
local is_link = yesno(is_link, false)
local is_long = yesno(is_long, false)
local is_long = yesno(is_long, false)
Line 36: Line 25:
local args = getArgs(frame)
local args = getArgs(frame)
local unparsed = args["scalesig"]
local input_mos = mos.parse(args["scalesig"])
local is_link = yesno(args["link"], false)
local is_link = yesno(args["link"], false)
local is_long = yesno(args["long"], false)
local is_long = yesno(args["long"], false)