Module:Navbar

From Xenharmonic Wiki
Revision as of 10:33, 11 October 2025 by Ganaram inukshuk (talk | contribs) (remove unused modules)
Jump to navigation Jump to search
Module documentation[view] [edit] [history] [purge]
This module implements a metatemplate, and may be invoked by templates using its corresponding template Template:Navbar, or used directly from other modules.

This module is used by Template:Navbar to generate View/Talk/Edit links on templates.

To include this module in other modules, use local navbar = require("Module:Navbar")._navbar.


Introspection summary for Module:Navbar 
Functions provided (2)
Line Function Params
4 _navbar (main) (name, mode, text, namespace)
22 navbar (invokable) (frame)
Lua modules required (0)
Variable Module Functions used

No function descriptions were provided. The Lua code may have further information.


local p = {}

-- Main function called by navigation box templates
function p._navbar(name, mode, text, namespace)
	mode = mode or ""
	text = (text == nil and "" or text .. " ")
	namespace = namespace or "Template"
	
	local p_name = string.format("%s:%s", namespace, name)
	local p_talk_name = string.format("%s talk:%s", namespace, name)
	local p_edit_name = "Special:EditPage/" .. p_name
	local s = " • "
	local links = (mode == mini and {"V", "T", "E"} or {"View", "Talk", "Edit"})
	
	return "<span style=\"font-size: 0.75em; font-weight: normal; font-style: normal;\">"
		.. string.format("%s[[%s|%s]]%s[[%s|%s]]%s[[%s|%s]]",
			text, p_name, links[1], s, p_talk_name, links[2], s, p_edit_name, links[3])
		.. "</span>"
end

-- Wrapper function for [[Template:Navbar]]
function p.navbar(frame)
	local name = frame.args["name"]
	local namespace = frame.args["namespace"]
	local mode = frame.args["mode"]
	local text = frame.args["text"]
	local debugg = frame.args["debug"]
	local result = p._navbar(name, mode, text, namespace)
	
	-- Debugger option
	if debugg == true then
		result = "<syntaxhighlight lang=\"wikitext\">" .. result .. "</syntaxhighlight>"
	end
	
	return frame:preprocess(result)
end

return p