Module:Navbox: Difference between revisions
ArrowHead294 (talk | contribs) mNo edit summary |
ArrowHead294 (talk | contribs) m rv |
||
Line 49: | Line 49: | ||
return row | return row | ||
end | |||
-- Navbar (vte links) | |||
-- work in progress | |||
function p.navbar(title, template_page) | |||
if template_page ~= nil then | |||
local v_link = string.format("[[%s|v]]") | |||
local t_link = string.format("[[%s|t]]") | |||
local e_link = string.format("[[Special:EditPage/%s|e]]") | |||
return '<div><div style="width: 5em; float: left;">' .. v_link .. ' • ' .. t_link .. ' • ' .. e_link .. '</div><div>' .. title .. '</div></div>' | |||
else | |||
return title | |||
end | |||
end | end | ||
-- Navbox title | -- Navbox title | ||
-- Nested navboxes have slightly smaller title text | -- Nested navboxes have slightly smaller title text | ||
function p.navbox_title(title, | function p.navbox_title(title, name, is_root_navbox) | ||
local is_root_navbox = (is_root_navbox == nil and is_root_navbox or true) -- If not specified, default to TRUE | local is_root_navbox = (is_root_navbox == nil and is_root_navbox or true) -- If not specified, default to TRUE | ||
local navbox_title = '' | local navbox_title = '' | ||
Line 61: | Line 74: | ||
.. 'text-align: center; background-color: #eaecf0; white-space: nowrap; margin: 0em 4em 0em 4em;' | .. 'text-align: center; background-color: #eaecf0; white-space: nowrap; margin: 0em 4em 0em 4em;' | ||
.. 'padding: 0.25em 0.5em; border: 1px solid white;" colspan="2" | ' | .. 'padding: 0.25em 0.5em; border: 1px solid white;" colspan="2" | ' | ||
.. | .. '<span style="float: left; text-align: left; font-size: 0.8em; font-weight: normal; font-style: normal;">' | ||
.. '[[Template:' .. name .. '|V]] • ' .. '[[Template talk:' .. name .. '|T]] • ' .. '[[Special:EditPage/Template:' .. name .. '|E]]' | |||
.. '</span>' .. title .. "\n" | |||
end | end | ||
return navbox_title | return navbox_title | ||
Line 67: | Line 82: | ||
-- Navbox to be called by other modules; also called by wrapper function | -- Navbox to be called by other modules; also called by wrapper function | ||
function p._navbox(args | function p._navbox(args) | ||
local title = args["Title"] or "Navbox Title" | local title = args["Title"] or "Navbox Title" | ||
local name = args["name"] | local name = args["name"] | ||
Line 87: | Line 102: | ||
.. '{| width="100%" style="mw-border-collapse: collapse; border-spacing: 0; margin: 0"' | .. '{| width="100%" style="mw-border-collapse: collapse; border-spacing: 0; margin: 0"' | ||
.. (is_collapsible and ('class="mw-collapsible' .. (is_collapsed and ' mw-collapsed"' or '"')) or '') .. '\n' | .. (is_collapsible and ('class="mw-collapsible' .. (is_collapsed and ' mw-collapsed"' or '"')) or '') .. '\n' | ||
.. p.navbox_title(title, | .. p.navbox_title(title, name, false) | ||
-- Add header | -- Add header | ||
Line 196: | Line 211: | ||
args["Is Data Navbox"] = is_data_navbox | args["Is Data Navbox"] = is_data_navbox | ||
return p._navbox(args) | |||
return p._navbox(args | |||
end | end | ||
return p | return p |