Module:Navbar: Difference between revisions
ArrowHead294 (talk | contribs) mNo edit summary |
ArrowHead294 (talk | contribs) mNo edit summary |
||
(2 intermediate revisions by the same user not shown) | |||
Line 1: | Line 1: | ||
local p = {} | |||
local ordinal = require("Module:Ordinal")._ordinal | local ordinal = require("Module:Ordinal")._ordinal | ||
local yesno = require("Module: | local yesno = require("Module:Yesno") | ||
-- Main function called by navigation box templates | |||
function p._navbar(name, mode, text, namespace) | function p._navbar(name, mode, text, namespace) | ||
mode = mode or "" | mode = mode or "" | ||
Line 10: | Line 12: | ||
local p_name = string.format("%s:%s", namespace, name) | local p_name = string.format("%s:%s", namespace, name) | ||
local p_talk_name = string.format("%s talk:%s", namespace, name) | local p_talk_name = string.format("%s talk:%s", namespace, name) | ||
local p_edit_name = " | local p_edit_name = "Special:EditPage/" .. p_name | ||
local s = " • " | 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;\">" | return "<span style=\"font-size: 0.75em; font-weight: normal; font-style: normal;\">" | ||
.. string.format( | .. string.format("%s[[%s|%s]]%s[[%s|%s]]%s[[%s|%s]]", | ||
text, p_name, s, p_talk_name, s, p_edit_name) | text, p_name, links[1], s, p_talk_name, links[2], s, p_edit_name, links[3]) | ||
.. "</span>" | .. "</span>" | ||
end | end | ||
-- Wrapper function for [[Template:Navbar]] | |||
function p.navbar(frame) | function p.navbar(frame) | ||
local name = frame.args["name"] | local name = frame.args["name"] | ||
Line 24: | Line 28: | ||
local mode = frame.args["mode"] | local mode = frame.args["mode"] | ||
local text = frame.args["text"] | local text = frame.args["text"] | ||
local debugg = frame.args["debug"] | |||
local result = p._navbar(name, mode, text, namespace) | |||
return | -- Debugger option | ||
if debugg == true then | |||
result = "<syntaxhighlight lang=\"wikitext\">" .. result .. "</syntaxhighlight>" | |||
end | |||
return frame:preprocess(result) | |||
end | end | ||
-- Navbox for lumatone mappings | |||
function p.lumatone_map(frame) | function p.lumatone_map(frame) | ||
local debugg = yesno(frame.args["debug"]) | local debugg = yesno(frame.args["debug"]) | ||
Line 68: | Line 80: | ||
.. "}}" | .. "}}" | ||
-- Debugger option | |||
if debugg == true then | |||
result = "<syntaxhighlight lang=\"wikitext\">" .. result .. "</syntaxhighlight>" | |||
end | |||
return frame:preprocess(result) | |||
end | end | ||
-- Navbox for fractional-octave temperaments | |||
function p.frac_octave(frame) | function p.frac_octave(frame) | ||
local arpn = frame:preprocess("{{ARTICLEROOTPAGENAME}}") | local arpn = frame:preprocess("{{ARTICLEROOTPAGENAME}}") | ||
Line 120: | Line 138: | ||
.. "}}" | .. "}}" | ||
-- Debugger option | |||
if debugg == true then | |||
result = "<syntaxhighlight lang=\"wikitext\">" .. result .. "</syntaxhighlight>" | |||
end | |||
return frame:preprocess(result) | |||
end | end | ||
return p | return p |