Module:Navbox: Difference between revisions

Ganaram inukshuk (talk | contribs)
bugfix nesting
Ganaram inukshuk (talk | contribs)
m comments; bugfix dataless header row
Line 45: Line 45:
-- Row is a dataless header row...
-- Row is a dataless header row...
local data_style = is_content_navbox
local data_style = is_content_navbox
and '| style="padding: 0;" colspan="2" |\n' -- For nested navboxes; requires a newline for it to work
and '! style="padding: 0;" colspan="2" |\n' -- For nested navboxes; requires a newline for it to work
or  '| style="font-size: 0.9em; padding: 0.25em 0.5em;" colspan="2" | ' -- For normal content
or  '! style="font-size: 0.9em; padding: 0.25em 0.5em;" colspan="2" | ' -- For normal content
table.insert(row, "|-")
table.insert(row, "|-")
Line 200: Line 200:
local args = getArgs(frame)
local args = getArgs(frame)
-- Preprocess bools for rows that have either a header or data.
-- Preprocess bools for rows that indicate whether that row is a nested
-- Absence of data defaults to false.
-- navbox. A row is considered valid if it has either a header or data. If
-- a bool exists but not its header or data, it's skipped. If a valid row
-- exists but not its bool, it defaults to false.
local is_data_navbox = {}
local is_data_navbox = {}
for i = 1, 30 do
for i = 1, 30 do
Line 207: Line 209:
local data  = args["Data "  .. i]
local data  = args["Data "  .. i]
local key = string.format("Is Data %d Navbox", i)
local key = string.format("Is Data %d Navbox", i)
local row_contains_entry = header and data
if header or data then
if header or data then