Module:Lumatone mapping navigation

From Xenharmonic Wiki
Jump to navigation Jump to search

Documentation transcluded from /doc
Note: Do not invoke this module directly; use the corresponding template instead: Template:Lumatone mapping navigation.

This module automatically generates a navigation bar for Lumatone mapping pages.


local p = {}

function p.main(frame)
	local root_page_name = frame:preprocess("{{ROOTPAGENAME}}")
	local a = root_page_name:match("[Ll]umatone%s*[Mm]apping%s*[Ff]or%s*(%d+)%s*[Ee][Dd][2Oo]")
	local x = tonumber(a) or tonumber(frame.args["edo"])
	local out_str = "<br /><div style=\"text-align: center;\">\n'''&larr;''' "
		.. "[[Lumatone mapping for " .. (x - 3) .. "edo|" .. (x - 3) .. "edo]] &bull; "
		.. "[[Lumatone mapping for " .. (x - 2) .. "edo|" .. (x - 2) .. "edo]] &bull; "
		.. "[[Lumatone mapping for " .. (x - 1) .. "edo|" .. (x - 1) .. "edo]] &bull;"
		.. " '''Lumatone mapping for " .. x .. "edo''' &bull; "
		.. "[[Lumatone mapping for " .. (x + 1) .. "edo|" .. (x + 1) .. "edo]] &bull; "
		.. "[[Lumatone mapping for " .. (x + 2) .. "edo|" .. (x + 2) .. "edo]] &bull; "
		.. "[[Lumatone mapping for " .. (x + 3) .. "edo|" .. (x + 3) .. "edo]] '''&rarr;'''\n"
		.. "</div>"
	
	if (string.lower(root_page_name) ~= "lumatone mapping navigation") then
		out_str = out_str .. " [[Category:Lumatone mappings]] [[Category:" .. x .. "edo]]"
	end

	return out_str
end

return p