summaryrefslogtreecommitdiff
path: root/tex/context/third
diff options
context:
space:
mode:
authorPhilipp Gesang <pgesang@ix.urz.uni-heidelberg.de>2011-05-10 14:20:45 +0200
committerPhilipp Gesang <pgesang@ix.urz.uni-heidelberg.de>2011-05-10 14:20:45 +0200
commit2adaa27b0259a19d6fae19e27ec6f81a3db14738 (patch)
treeff2a5b5c812e90f752a66bb5b1a1ad2e82e4f6f8 /tex/context/third
parent93bef7be0cbc4a69caabaece0a71ffe3fa1eb0f7 (diff)
downloadtransliterator-2adaa27b0259a19d6fae19e27ec6f81a3db14738.tar.gz
Serbian exception handling
Diffstat (limited to 'tex/context/third')
-rw-r--r--tex/context/third/transliterator/trans_tables_sr.lua14
1 files changed, 13 insertions, 1 deletions
diff --git a/tex/context/third/transliterator/trans_tables_sr.lua b/tex/context/third/transliterator/trans_tables_sr.lua
index 84319b0..0a601e3 100644
--- a/tex/context/third/transliterator/trans_tables_sr.lua
+++ b/tex/context/third/transliterator/trans_tables_sr.lua
@@ -91,6 +91,16 @@ if not translit.done_serbian then
translit.sr_tocy_lower = translit.make_add_dict(__inverse_tab(translit.sr_tolt_lower))
translit.sr_tocy_upper = translit.make_add_dict(__inverse_tab(translit.sr_tolt_upper))
+ translit.serbian_exceptions = {
+ ["nadživeti"] = "надживети",
+ ["Nadživeti"] = "Надживети",
+ }
+
+ local P = lpeg.P
+ for lat, _ in next, translit.serbian_exceptions do
+ translit.p_serbian_exceptions = translit.p_serbian_exceptions and translit.p_serbian_exceptions + P(lat) or P(lat)
+ end
+
translit.done_serbian = true
end
@@ -98,10 +108,12 @@ end
-- End Of Tables --
--===========================================================================--
+
local t = translit
local function sr (mode, text)
local P, R, Cs = lpeg.P, lpeg.R, lpeg.Cs
local utfchar = translit.utfchar
+ local _p_sre = translit.p_serbian_exceptions / translit.serbian_exceptions
local trl_sr = translit.make_add_dict{}
trl_sr = t[mode.."_upper"] + t[mode.."_lower"]
@@ -109,7 +121,7 @@ local function sr (mode, text)
-- transliteration from latin script requires macro handling …
local _p_macro = P[[\]] * R("az", "AZ")^1
local _p_sr = translit.addrules (trl_sr, _p_sr)
- local p_sr = Cs((_p_macro + (_p_sr / trl_sr) + utfchar)^0)
+ local p_sr = Cs((_p_macro + _p_sre + (_p_sr / trl_sr) + utfchar)^0)
return p_sr:match(text)
end