Module:Navbox: Difference between revisions

Ganaram inukshuk (talk | contribs)
m add white border to dataless header row
Ganaram inukshuk (talk | contribs)
m minor renaming
 
(3 intermediate revisions by the same user not shown)
Line 7: Line 7:
local p = {}
local p = {}


-- TODO: bugfix headerless data row and dataless header row to make sure they
-- TODO (medium priority): add/use navbox/styles.css
-- work properly, especially with nested navboxes


-- TODO (medium priority): nest and refactor helper functions
-- TODO (medium priority): nest and refactor helper functions
Line 45: Line 44:
local data_style = is_content_navbox
local data_style = is_content_navbox
and '! style="padding: 0;" colspan="2" |\n' -- For nested navboxes; in case nav elements are ever added here, such as numlinks
and '! style="padding: 0;" colspan="2" |\n' -- For nested navboxes; in case nav elements are ever added here, such as numlinks
or  [[ style="font-size: 0.9em; padding: 0.25em 0.5em;
or  '! style="white-space: nowrap; font-size: 0.9em; width: 5%; background-color: #eaecf0; padding: 0.25em 0.5em; border: 1px solid white;" colspan="2" |'
background-color: #eaecf0; border: 1px solid white;"
colspan="2" |]] -- For normal content
table.insert(row, "|-")
table.insert(row, "|-")
Line 105: Line 102:
-- 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 name            = args["name"]
local name            = args["name"]
local rows            = args["Rows"]
local rows            = args["Rows"]
Line 220: Line 217:
-- Preprocess individual entries for headers and data
-- Preprocess individual entries for headers and data
local rows = tiu.header_data_pairs_to_table(args, 30)
local rows = tiu.numbered_header_data_args_to_table(args, 30)
args["Rows"] = rows
args["Rows"] = rows