Module:IPA/data/export explained

require('strict')

local rawData = mw.title.getCurrentTitle.subpageText

'sandbox' and mw.loadData('Module:IPA/data/sandbox') or mw.loadData('Module:IPA/data')local data =

local function getNameAndLink(code) local res = require('Module:Lang')._name_from_tag local name = res:match('([^%[|%]]+)%]%]$') local link = res:match('^%[%[([^|%]]+)') return name, linkend

local function augmentData(lect) if lect.name and not lect.link then lect.generatedLink = lect.name:find(' languages$') and lect.name or lect.name .. ' language' end lect.extName, lect.extLink = getNameAndLink(lect.code)end

for code, lang in pairs(rawData.langs) do local langData = augmentData(langData) table.insert(data, langData) if lang.dialects then local aliases = for diaCode, dialect in pairs(lang.dialects) do if dialect.aliasOf then aliases[dialect.aliasOf] = aliases[dialect.aliasOf] or table.insert(aliases[dialect.aliasOf], diaCode) end end for _, t in pairs(aliases) do table.sort(t) end for diaCode, dialect in pairs(lang.dialects) do if not dialect.aliasOf then local diaAliases = aliases[diaCode] if dialect.isVariant then diaCode = diaCode:lower end local diaData = augmentData(diaData) table.insert(data, diaData) end end endend

table.sort(data, function (a, b) return a.code < b.code end)

return data