Module:IPA: Difference between revisions

ਕੋਈ ਸੋਧ ਸਾਰ ਨਹੀਂ
No edit summary
No edit summary
 
Line 15: Line 15:
}
}


function get_SAMPAd(ipa)
function export.get_SAMPAd(ipa)
local correspondences = mw.loadData("Module:IPA/SAMPA")
local correspondences = mw.loadData("Module:IPA/SAMPA")


Line 45: Line 45:
local pieces = {}
local pieces = {}
for pre, escaped, post in mw.ustring.gmatch(i_ipa, "([^%*]*)(%*[^%*]+%*)([^%*]*)") do
for pre, escaped, post in mw.ustring.gmatch(i_ipa, "([^%*]*)(%*[^%*]+%*)([^%*]*)") do
local piece = get_SAMPAd(pre) .. '</span>' .. mw.ustring.match(escaped, "^%*([^%*]+)%*$") .. '<span class="' .. class .. '">' .. get_SAMPAd(post)
local piece = export.get_SAMPAd(pre) .. '</span>' .. mw.ustring.match(escaped, "^%*([^%*]+)%*$") .. '<span class="' .. class .. '">' .. export.get_SAMPAd(post)
table.insert(pieces, piece)
table.insert(pieces, piece)
end
end
Line 57: Line 57:
end
end
else
else
i_ipa = get_SAMPAd(i_ipa)
i_ipa = export.get_SAMPAd(i_ipa)
end
end
if linked then
if linked then