Module:Sandbox/Nardog/3

local p = {} local getArgs = require('Module:Arguments').getArgs

function p._main(args) local data = require('Module:IPA symbol/data') local ret = {} local obj table.insert(ret, '{| class="wikitable sortable"\n') table.insert(ret, '! Name\n') table.insert(ret, '! Symbols\n') table.insert(ret, '! Wiki page\n') table.insert(ret, '! Redirect target\n') table.insert(ret, '! Sound file\n') table.insert(ret, '! Type\n') table.insert(ret, '! X-SAMPA\n') for k, v in pairs(data.correspondences) do		table.insert(ret, '|-\n| ') table.insert(ret, k)		table.insert(ret, '\n| ') if v.symbols then table.insert(ret, ', ') end table.insert(ret, '\n| ') if v.wikipage and v.wikipage ~= '' then table.insert(ret, string.format('%s', v.wikipage)) end table.insert(ret, '\n| ') local obj = mw.title.new(v.wikipage) if obj and obj.isRedirect then obj = obj:getContent obj = string.match(				obj,				"^%s*#[Rr][Ee][Dd][Ii][Rr][Ee][Cc][Tt]%s*:?%s*(%[%^%-%]%])"				) table.insert(ret, obj) end table.insert(ret, '\n| ') if v.soundfile and v.soundfile ~= '' then table.insert(ret, string.format('%s', v.soundfile, v.soundfile)) end table.insert(ret, '\n| ') if v.type and v.tpe ~= '' then table.insert(ret, v.type) end table.insert(ret, '\n| ') if v.XSAMPA and v.XSAMPA ~= '' then table.insert(ret, string.format(' ', mw.text.nowiki(v.XSAMPA))) end table.insert(ret, '\n') end table.insert(ret, '|}') return table.concat(ret) end

function p.main(frame) local args = getArgs(frame, {removeBlanks = false}) return frame:preprocess{ text = p._main(args) } end

return p