Module:IPA: Difference between revisions

Jump to navigation Jump to search
ਕੋਈ ਸੋਧ ਸਾਰ ਨਹੀਂ
No edit summary
No edit summary
Line 17: Line 17:
["E"] = "ɛ",
["E"] = "ɛ",
["O"] = "ɔ",
["O"] = "ɔ",
["%%"] = "ˌ",
["%:"] = "ː",
["%:"] = "ː",
['%"'] = "ˈ",
['%"'] = "ˈ",
["%%"] = "ˌ",
["%'"] = "ʲ",
["'"] = "ʲ",
["%_j"] = "ʲ",
["%_j"] = "ʲ",
}
}
for from, to in pairs(correspondences) do
for from, to in pairs(correspondences) do
ipa = mw.ustring.gsub(ipa, "'''", "★★")
ipa = mw.ustring.gsub(ipa, "'''", "ʹʹ")
ipa = mw.ustring.gsub(ipa, "''", "")
ipa = mw.ustring.gsub(ipa, "''", "ʹ")
ipa = mw.ustring.gsub(ipa, from, to)
ipa = mw.ustring.gsub(ipa, from, to)
ipa = mw.ustring.gsub(ipa, "★★", "'''")
ipa = mw.ustring.gsub(ipa, "ʹʹ", "'''")
ipa = mw.ustring.gsub(ipa, "", "''")
ipa = mw.ustring.gsub(ipa, "ʹ", "''")
end
end
return ipa
return ipa
Line 45: Line 45:
if i > 1 then out = out .. ", " end
if i > 1 then out = out .. ", " end
out = out .. '<span class="' .. class .. '">'
out = out .. '<span class="' .. class .. '">'
local pieces = {}
if mw.ustring.match(i_ipa, "%*[^%*]+%*") then
for pre, escaped, post in mw.ustring.gmatch(i_ipa, "([^%*]*)(%*[^%*]+%*)([^%*]*)") do
local pieces = {}
table.insert(pieces, get_SAMPAd(pre) .. '</span>' .. mw.ustring.match(escaped, "^%*([^%*]+)%*$") .. '<span class="' .. class .. '">' .. get_SAMPAd(post))
for pre, escaped, post in mw.ustring.gmatch(i_ipa, "([^%*]*)(%*[^%*]+%*)([^%*]*)") do
table.insert(pieces, get_SAMPAd(pre) .. '</span>' .. mw.ustring.match(escaped, "^%*([^%*]+)%*$") .. '<span class="' .. class .. '">' .. get_SAMPAd(post))
end
i_ipa = table.concat(pieces)
else
i_ipa = get_SAMPAd(i_ipa)
end
end
i_ipa = table.concat(pieces)
if linked then
if linked then
out = out .. "[[" .. language_pron .. "|" .. i_ipa .. "]]"
out = out .. "[[" .. language_pron .. "|" .. i_ipa .. "]]"

Navigation menu