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("{{ | 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 = | 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]] • " | .. "[[Lumatone mapping for " .. (x + 2) .. "edo|" .. (x + 2) .. "edo]] • " | ||
.. "[[Lumatone mapping for " .. (x + 3) .. "edo|" .. (x + 3) .. "edo]] '''→'''}}" | .. "[[Lumatone mapping for " .. (x + 3) .. "edo|" .. (x + 3) .. "edo]] '''→'''}}" | ||
.. "}}" | .. "}}" | ||
if string.lower(page_name) ~= "template:navbox lumatone" then | if string.lower(page_name) ~= "template:navbox lumatone" then | ||
Line 53: | Line 54: | ||
end | end | ||
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 = | local out_str = "<br />{{Navbox" | ||
.. "|name=Navbox fractional-octave" | .. "|name=Navbox fractional-octave" | ||
.. "|Title=[[Fractional-octave temperaments]]" | .. "|Title=[[Fractional-octave temperaments]]" | ||
.. "|Data 1={{ | .. "|Data 1={{centre|" | ||
.. ((x >= 6) and "'''←''' " or "") | .. ((x >= 6) and "'''←''' " or "") | ||
.. ((x >= 5) and "[[" .. ordinal(x - 4) .. "-octave temperaments|" .. ordinal(x - 4) .. "]] • " or "") | .. ((x >= 5) and "[[" .. ordinal(x - 4) .. "-octave temperaments|" .. ordinal(x - 4) .. "]] • " or "") | ||
Line 76: | Line 77: | ||
.. "[[" .. ordinal(x + 3) .. "-octave temperaments|" .. ordinal(x + 3) .. "]] • " | .. "[[" .. ordinal(x + 3) .. "-octave temperaments|" .. ordinal(x + 3) .. "]] • " | ||
.. "[[" .. ordinal(x + 4) .. "-octave temperaments|" .. ordinal(x + 4) .. "]] '''→'''}}" | .. "[[" .. ordinal(x + 4) .. "-octave temperaments|" .. ordinal(x + 4) .. "]] '''→'''}}" | ||
.. "}}" | .. "}}" | ||
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 |