Module:Navbar
- 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 | ||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
| |||||||||||||||
No function descriptions were provided. The Lua code may have further information.
local getArgs = require("Module:Arguments").getArgs
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 string.format("<span style=\"font-size: 0.75em; font-weight: normal; font-style: normal;\">%s[[%s|%s]]%s[[%s|%s]]%s[[%s|%s]]</span>",
text, p_name, links[1], s, p_talk_name, links[2], s, p_edit_name, links[3])
end
-- Wrapper function for [[Template:Navbar]]
function p.navbar(frame)
local args = getArgs(frame)
local name = frame.args["name"]
local namespace = frame.args["namespace"]
local mode = frame.args["mode"]
local text = frame.args["text"]
local wtext = yesno(frame.args["wtext"] or args["wtext"])
local result = p._navbar(name, mode, text, namespace)
-- Debugger option
if wtext then
result = "<syntaxhighlight lang=\"wikitext\">" .. result .. "</syntaxhighlight>"
end
return frame:preprocess(result)
end
return p