Module:columns: Difference between revisions

ਕੋਈ ਸੋਧ ਸਾਰ ਨਹੀਂ
No edit summary
No edit summary
Line 15: Line 15:


function export.create_list(data)
function export.create_list(data)
if not data.terms then error("{{columns}} must be supplied with a list of terms") end
local terms = table.sort(data.terms, function(a, b) return a.term > b.term end)
local terms = table.sort(data.terms, function(a, b) return a.term > b.term end)
local out = '<div class="ul-columns" data-column-count="' .. data.columns .. '">'
local out = '<div class="ul-columns" data-column-count="' .. data.columns .. '">'
Line 28: Line 29:
local terms = {}
local terms = {}
local i = 1
local i = 1
while args[i + 1] do
while args[2][i] do
table.insert(terms, {
table.insert(terms, {
term = args[2][i],
term = args[2][i],