Module:IPA: Difference between revisions

ਕੋਈ ਸੋਧ ਸਾਰ ਨਹੀਂ
No edit summary
No edit summary
Line 17: Line 17:
["E"] = "ɛ",
["E"] = "ɛ",
["O"] = "ɔ",
["O"] = "ɔ",
[":"] = "ː",
["%:"] = "ː",
["'"] = "ˈ",
['%"'] = "ˈ",
["%%"] = "ˌ",
["'"] = "ʲ",
["%_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 42: 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 .. '">'
i_ipa = get_SAMPAd(i_ipa)
local pieces = {}
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)
if linked then
if linked then
out = out .. "[[" .. language_pron .. "|" .. i_ipa .. "]]"
out = out .. "[[" .. language_pron .. "|" .. i_ipa .. "]]"
Line 72: Line 79:


return export
return export
--[[
=p.show(mw.getCurrentFrame():newChild{title="parent", args={"rad", "nom", ["nopre"] = "true"}}:newChild{title="child"})
]]--