Modul:columns/auto
Dokumentacija za tutón modul hodźi so na Modul:columns/auto/dokumentacija wutworić
-- TODO needs a complete redesign
local export = {}
function export.decide_number_of_columns(lang, number_of_items)
if number_of_items <= 3 then
return 1
elseif number_of_items <= 9 then
return 2
elseif number_of_items <= 27 then
return 3
elseif number_of_items <= 81 then
return 4
else
return 5
end
end
function export.display_from(column_args, list_args)
if not column_args["columns"] then
local m_table = require("Modul:table")
column_args = m_table.shallowcopy(column_args)
local lang = require("Modul:languages").getByCode(mw.text.trim(list_args[1]), 1)
column_args["columns"] = export.decide_number_of_columns(lang, m_table.length(list_args))
end
return require("Modul:columns").display_from(column_args, list_args)
end
function export.display(frame)
return export.display_from(frame.args, frame:getParent().args)
end
return export