Module:Infobox: Difference between revisions

Ganaram inukshuk (talk | contribs)
add tiu module
Ganaram inukshuk (talk | contribs)
try to bugfix
Line 69: Line 69:
local data  = row_content["Data"  ]
local data  = row_content["Data"  ]
if #row_content > 1 then
if header and data then
local lines = {}
local lines = {}
table.insert(lines, '|-')
table.insert(lines, '|-')
Line 76: Line 76:
return table.concat(lines, "\n")
return table.concat(lines, "\n")
elseif #row_content == 1 then
elseif header and not data then
local lines = {}
local lines = {}
table.insert(lines, '|-')
table.insert(lines, '|-')
table.insert(lines, '| colspan="2" style="text-align: center;" | ' .. data)
table.insert(lines, '| colspan="2" style="text-align: center;" | ' .. header)
return table.concat(lines, "\n")
return table.concat(lines, "\n")
Line 253: Line 253:


-- Helper function; preprocess infobox rows from old format to new format
-- Helper function; preprocess infobox rows from old format to new format
-- One-element entries are interpreted as dataless headers, as it already is.
function p.preprocess_entries(entries)
function p.preprocess_entries(entries)
local processed = {}
local processed = {}