local p =
function p.main(frame) local data = mw.loadData('Module:Sandbox/Nardog/5d') -- local segments = mw.loadData('Module:IPAc/' .. frame.args.lang).rawSegments local segments = mw.loadData('Module:Sandbox/Nardog/6').rawSegments local ret = -- Error detection do local labels = for k, _ in pairs(data.defLabels) do labels[k] = true end if data.langs[frame.args.lang].labels then for k, _ in pairs(data.langs[frame.args.lang].labels) do labels[k] = true end end local dialects = data.langs[frame.args.lang].dialects if dialects then for codePat, _ in pairs(data.defDiaCodes) do for diaCode, _ in pairs(dialects) do labels[codePat:format(diaCode)] = true end end end local codes, dupes, labelDupes =,, local function check(s) if codes[s] then table.insert(dupes, s) else codes[s] = true end s = s:lower if labels[s] then table.insert(labelDupes, s) end end for _, v in ipairs(segments) do check(v.code) if v.aliases then for _, alias in ipairs(v.aliases) do check(alias) end end end if dupes[1] or labelDupes[1] then for _, v in ipairs(dupes) do table.insert(ret, string.format('*Error: "%s" is defined more than once.\n', mw.text.nowiki(v))) end for _, v in ipairs(labelDupes) do table.insert(ret, string.format('*Error: "%s" is already defined as a label code.\n', mw.text.nowiki(v))) end else table.insert(ret, 'No errors were found.\n') end end -- Table of segments table.insert(ret, '
Code | Aliases | Output | Tooltip\n') for _, v in ipairs(segments) do local aliases = if v.aliases then aliases = for i, alias in ipairs(v.aliases) do aliases[i] = '' .. mw.text.nowiki(alias) .. ' ' end aliases = table.concat(aliases, ', ') end table.insert(ret, string.format(' | -\n | %s | %s | %s | %s\n', mw.text.nowiki(v.code), aliases, v.text, v.tooltip and mw.text.nowiki(v.tooltip) or )) end table.insert(ret, ' |
---|
return p