Module:Navbar: Difference between revisions
fractional-octave and lumatone functions (should be) no longer needed; numlinks+navbox modules/templates handle everything now |
ArrowHead294 (talk | contribs) mNo edit summary |
||
| (3 intermediate revisions by 2 users not shown) | |||
| Line 1: | Line 1: | ||
local getArgs = require("Module:Arguments").getArgs | |||
local yesno = require("Module:Yesno") | |||
local p = {} | local p = {} | ||
-- Main function called by navigation box templates | -- Main function called by navigation box templates | ||
| Line 16: | Line 16: | ||
local links = (mode == mini and {"V", "T", "E"} or {"View", "Talk", "Edit"}) | 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;\"> | 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 | end | ||
return p | return p | ||