diff options
Diffstat (limited to 'tex')
-rw-r--r-- | tex/context/third/transliterator/trans_tables_sr.lua | 17 |
1 files changed, 13 insertions, 4 deletions
diff --git a/tex/context/third/transliterator/trans_tables_sr.lua b/tex/context/third/transliterator/trans_tables_sr.lua index 0a601e3..0f9eae4 100644 --- a/tex/context/third/transliterator/trans_tables_sr.lua +++ b/tex/context/third/transliterator/trans_tables_sr.lua @@ -91,16 +91,25 @@ 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 = { + local except = { ["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) + local sub, upper = unicode.utf8.sub, unicode.utf8.upper + + local sre, p_sre = {} + for lat, cyr in next, except do + local Lat = upper(sub(lat, 1, 1)) .. sub(lat, 2) + local Cyr = upper(sub(cyr, 1, 1)) .. sub(cyr, 2) + local LAT, CYR = upper(lat), upper(cyr) + p_sre = p_sre and p_sre + P(lat) + Lat + LAT or P(lat) + Lat + LAT + sre[lat], sre[Lat], sre[LAT] = cyr, Cyr, CYR end + translit.serbian_exceptions = sre + translit.p_serbian_exceptions = p_sre + translit.done_serbian = true end |