Module:Navbar: Difference between revisions

ArrowHead294 (talk | contribs)
mNo edit summary
ArrowHead294 (talk | contribs)
mNo edit summary
Line 8: Line 8:
namespace = namespace or "Template"
namespace = namespace or "Template"
local p_name = namespace .. ":" .. name
local p_name = string.format("%s:%s", namespace, name)
local p_talk_name = namespace .. " talk:" .. name
local p_talk_name = string.format("%s talk:%s", namespace, name)
local p_edit_name = "Special:EditPage/" .. namespace .. ":".. name
local p_edit_name = "special:editpage/" .. p_name
local s = ((mode == "v" or mode == "vmini") and "<br />" or " &bull; ")
local s = ((mode == "v" or mode == "vmini") and "<br />" or " &bull; ")
Line 30: Line 30:


function p.lumatone_map(frame)
function p.lumatone_map(frame)
local page_name = frame:preprocess("{{ARTICLEROOTPAGENAME}}")
local arpn = frame:preprocess("{{ARTICLEROOTPAGENAME}}")
local debugg = yesno(frame.args["debug"])
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 = arpn: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
Line 39: Line 39:
.. "|name=Navbox Lumatone"
.. "|name=Navbox Lumatone"
.. "|Title=[[Lumatone|Lumatone mappings]]"
.. "|Title=[[Lumatone|Lumatone mappings]]"
.. "|Data 1={{center|"
.. "|Data 1={{centre|"
.. ((x >= thresh + 4) and "'''&larr;''' " or "")
.. ((x >= thresh + 4) and "'''&larr;''' " or "")
.. ((x >= thresh + 3) and "[[Lumatone mapping for " .. (x - 3) .. "edo|" .. (x - 3) .. "edo]] &bull; " or "")
.. ((x >= thresh + 3) and "[[Lumatone mapping for " .. (x - 3) .. "edo|" .. (x - 3) .. "edo]] &bull; " or "")
Line 50: Line 50:
.. "}}"
.. "}}"
if string.lower(page_name) ~= "template:navbox lumatone" then
if string.lower(arpn) ~= "template:navbox lumatone" then
out_str = out_str .. " [[Category:Lumatone mappings]] [[Category:" .. x .. "edo]]"
out_str = out_str .. " [[Category:Lumatone mappings]] [[Category:" .. x .. "edo]]"
end
end