Module:Navbar: Difference between revisions

ArrowHead294 (talk | contribs)
mNo edit summary
ArrowHead294 (talk | contribs)
mNo edit summary
Line 30: Line 30:


function p.lumatone_map(frame)
function p.lumatone_map(frame)
local page_name = frame:preprocess("{{ARTICLESPACE}}:{{ROOTPAGENAME}}")
local page_name = frame:preprocess("{{ARTICLEROOTPAGENAME}}")
local debugg = yesno(frame.args["debug"])
local a = page_name:match("[Ll]umatone%s*[Mm]apping%s*[Ff]or%s*(%d+)%s*[Ee][Dd][2Oo]")
local a = page_name:match("[Ll]umatone%s*[Mm]apping%s*[Ff]or%s*(%d+)%s*[Ee][Dd][2Oo]")
local x = tonumber(frame.args["edo"]) or tonumber(a)
local x = tonumber(frame.args["edo"]) or tonumber(a)
local thresh = 5
local thresh = 5
local out_str = frame:preprocess("<br />{{Navbox"
local out_str = "<br />{{Navbox"
.. "|name=Navbox Lumatone"
.. "|name=Navbox Lumatone"
.. "|Title=[[Lumatone|Lumatone mappings]]"
.. "|Title=[[Lumatone|Lumatone mappings]]"
Line 47: Line 48:
.. "[[Lumatone mapping for " .. (x + 2) .. "edo|" .. (x + 2) .. "edo]] &bull; "
.. "[[Lumatone mapping for " .. (x + 2) .. "edo|" .. (x + 2) .. "edo]] &bull; "
.. "[[Lumatone mapping for " .. (x + 3) .. "edo|" .. (x + 3) .. "edo]] '''&rarr;'''}}"
.. "[[Lumatone mapping for " .. (x + 3) .. "edo|" .. (x + 3) .. "edo]] '''&rarr;'''}}"
.. "}}")
.. "}}"
if string.lower(page_name) ~= "template:navbox lumatone" then
if string.lower(page_name) ~= "template:navbox lumatone" then
Line 53: Line 54:
end
end


local debugg = yesno(frame.args["debug"])
return frame:preprocess(debugg == true and "<pre>" .. out_str .. "</pre>" or out_str)
return frame:preprocess(debugg == true and "<pre>" .. out_str .. "</pre>" or out_str)
end
end
Line 59: Line 59:
function p.frac_octave(frame)
function p.frac_octave(frame)
local root_page_name = frame:preprocess("{{FULLROOTPAGENAME}}")
local root_page_name = frame:preprocess("{{FULLROOTPAGENAME}}")
local debugg = yesno(frame.args["debug"])
local a = root_page_name:match("(%d+)%a+[%s%-]*[Oo]ctave%s*[Tt]emperament[s]?")
local a = root_page_name:match("(%d+)%a+[%s%-]*[Oo]ctave%s*[Tt]emperament[s]?")
local x = tonumber(frame.args["f"]) or tonumber(a)
local x = tonumber(frame.args["f"]) or tonumber(a)
local out_str = frame:preprocess("<br />{{Navbox"
local out_str = "<br />{{Navbox"
.. "|name=Navbox fractional-octave"
.. "|name=Navbox fractional-octave"
.. "|Title=[[Fractional-octave temperaments]]"
.. "|Title=[[Fractional-octave temperaments]]"
.. "|Data 1={{center|"
.. "|Data 1={{centre|"
.. ((x >= 6) and "'''&larr;''' " or "")
.. ((x >= 6) and "'''&larr;''' " or "")
.. ((x >= 5) and "[[" .. ordinal(x - 4) .. "-octave temperaments|" .. ordinal(x - 4) .. "]] &bull; " or "")
.. ((x >= 5) and "[[" .. ordinal(x - 4) .. "-octave temperaments|" .. ordinal(x - 4) .. "]] &bull; " or "")
Line 76: Line 77:
.. "[[" .. ordinal(x + 3) .. "-octave temperaments|" .. ordinal(x + 3) .. "]] &bull; "
.. "[[" .. ordinal(x + 3) .. "-octave temperaments|" .. ordinal(x + 3) .. "]] &bull; "
.. "[[" .. ordinal(x + 4) .. "-octave temperaments|" .. ordinal(x + 4) .. "]] '''&rarr;'''}}"
.. "[[" .. ordinal(x + 4) .. "-octave temperaments|" .. ordinal(x + 4) .. "]] '''&rarr;'''}}"
.. "}}")
.. "}}"
local debugg = yesno(frame.args["debug"])
 
return frame:preprocess(debugg == true and "<pre>" .. out_str .. "</pre>" or out_str)
return frame:preprocess(debugg == true and "<pre>" .. out_str .. "</pre>" or out_str)
end
end


return p
return p