Module:Language list

local exports = {}

function exports.makeLanguageList(frame) local templateArgs = frame:getParent.args local listNode = mw.html.create('ul'):addClass('language-list')

-- style as plain list - ideally, styling would be done in MediaWiki:Common.css listNode:css({       ['list-style'] = 'none';        ['margin'] = '0';    })

-- add collapsible classes if requested if templateArgs.collapse == 'yes' then listNode:addClass('mw-collapsible'):addClass('mw-collapsed') end

for index, value in ipairs(templateArgs) do       local listItemNode = listNode:tag('li') local languageName = mw.language.fetchLanguageName(value)

-- for recognised languages, use their native name with the language code in brackets if languageName ~= '' then listItemNode :wikitext(languageName) :tag('span') :css('font-size', '0.8em') :wikitext(' (' .. value .. ')')       else listItemNode:wikitext(value) end end

return tostring(listNode) end

return exports