मॉड्यूल:columns/auto
दिखावट
"इस मॉड्यूल हेतु प्रलेख मॉड्यूल:columns/auto/doc पर बनाया जा सकता है"
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("Module:table")
column_args = m_table.shallowcopy(column_args)
local lang = require("Module: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("Module:columns").display_from(column_args, list_args)
end
function export.display(frame)
return export.display_from(frame.args, frame:getParent().args)
end
return export