Module:Navbox: Difference between revisions

Ganaram inukshuk (talk | contribs)
m todo
Ganaram inukshuk (talk | contribs)
Moved div placement to _navbox function
Line 61: Line 61:


-- Navbox title
-- Navbox title
-- A title is added if it's provided.
-- Child navboxes used for subcategories don't need a title or collapse options.
-- Child navboxes used for subcategories don't need a title or collapse options.
function p.navbox_title(title, is_collapsible, is_collapsed)
function p.navbox_title(title, is_collapsible, is_collapsed)
local is_collapsible = is_collapsible or true -- Not implemented
local is_collapsible = is_collapsible or true -- Not implemented
local is_collapsed = is_collapsed or true -- Not working?
local is_collapsed = is_collapsed or true -- Not working?
local navbox_type = navbox_type or "Normal"
local navbox_title = ''
local navbox_title = ''
Line 72: Line 72:
else
else
navbox_title = navbox_title
navbox_title = navbox_title
.. '<div class="wikitable">'
.. '<table class="mw-collapsible' .. (is_collapsed and ' mw-collapsed ' or '') .. 'nowraplinks" style="width: 100%; border-spacing:0px">\n'
.. '<table class="mw-collapsible' .. (is_collapsed and ' mw-collapsed ' or '') .. 'nowraplinks" style="width: 100%; border-spacing:0px">\n'
.. '<tr>\n'
.. '<tr>\n'
Line 84: Line 83:
-- 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"]
local title          = args["Title"] or "Navbox Title"
local rows            = args["Rows"]
local rows            = args["Rows"]
local is_collapsible  = args["Is Collapsible"] -- Not implemented
local is_collapsible  = yesno(args["Is Collapsible"], true )
local is_collapsed    = args["Is Collapsed"  ] -- Not working?
local is_collapsed    = yesno(args["Is Collapsed"  ], false)
local navbox_type    = ((args["Navbox Type"] == nil) and "Normal" or args["Navbox Type"])
-- Start of table
-- Start of table
Line 98: Line 98:
navbox = navbox
navbox = navbox
.. '</table>\n'
.. '</table>\n'
.. '</div>'
if navbox_type == "Nested" then
navbox = '<div class="wikitable">\n' .. navbox .. '</div>'
end
return navbox
return navbox
Line 107: Line 110:
function p.navbox(frame)
function p.navbox(frame)
local args = getArgs(frame)
local args = getArgs(frame)
-- Prepropress boolean args
args["Is Collapsible" ] = yesno(args["Is Collapsible" ])
args["Is Collapsed"  ] = yesno(args["Is Collapsed"  ])
-- Preprocess individual entries for, headers, data, and is-row-child into
-- Preprocess individual entries for, headers, data, and is-row-child into