Module:columns: Difference between revisions

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


function export.create_list(data)
function export.create_list(data)
mw.logObject(data.terms)
if not data.terms then error("{{columns}} must be supplied with a list of terms") end
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)
table.sort(data.terms, function(a, b) return a.term < b.term end)
mw.logObject(data.terms)
mw.logObject(terms)
local out = '<div class="ul-columns" data-column-count="' .. data.columns .. '">'
local out = '<div class="ul-columns" data-column-count="' .. data.columns .. '">'
for _, term in ipairs(terms) do
for _, term in ipairs(data.terms) do
out = out .. '\n* ' .. m_links.full_link{term = term.term, language = data.language, alt = term.alt, gloss = text.gloss, pos = text.pos}
out = out .. '\n* ' .. m_links.full_link{term = term.term, language = data.language, alt = term.alt, gloss = text.gloss, pos = text.pos}
end
end

Navigation menu