606
modifications
(Testing for new building infobox template; credits for this draft to @levrin) |
(Error "Lua error in Module:InfoboxBuilding at line 61: attempt to call global 'createDataRow' (a nil value)." after trying to invoke this with Template:BuildingInfobox, so after trying to learn a bit about LUA I am seeing if moving function createDataRow above localrowClass to see if it fixes it) |
||
| Ligne 50 : | Ligne 50 : | ||
end | end | ||
local function createDataRow(label, value, defaultValue) | |||
local function createDataRow(label, value, defaultValue) | |||
if not value and not defaultValue then | if not value and not defaultValue then | ||
return nil | return nil | ||
| Ligne 92 : | Ligne 73 : | ||
return dataRow | return dataRow | ||
end | |||
local rowClass = 'infobox-row' | |||
if columnCount then | |||
rowClass = rowClass .. ' data-rows-' .. columnCount | |||
end | |||
local rowContainer = mw.html.create('div') | |||
rowContainer:addClass(rowClass) | |||
for _, item in ipairs(data) do | |||
local dataRow = createDataRow(item.label, item.value, item.defaultValue) | |||
if dataRow then | |||
rowContainer:node(dataRow) | |||
end | |||
end | |||
box:node(rowContainer) | |||
return box | |||
end | end | ||
modifications