summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--doc/context/third/transliterator/transliterator.tex33
-rw-r--r--tex/context/interface/third/t-transliterator.xml3
-rw-r--r--tex/context/third/transliterator/trans_tables_sr.lua12
3 files changed, 41 insertions, 7 deletions
diff --git a/doc/context/third/transliterator/transliterator.tex b/doc/context/third/transliterator/transliterator.tex
index 9ed70c6..0acd300 100644
--- a/doc/context/third/transliterator/transliterator.tex
+++ b/doc/context/third/transliterator/transliterator.tex
@@ -308,7 +308,7 @@ actual transliteration of text passages.
\setup{transliterate}
-\section{Module loading and configuration}
+\section{Loading and Configuring the Module}
In order to use the Transliterator in a document we put the following somewhere before
\type{\starttext}.
\starttyping
@@ -335,6 +335,8 @@ By the time of this writing this can be one of the following set:
\bTR\bTC \type{ru_transcript_de} \eTC\bTC German transcription for Russian \eTC\eTR
\bTR\bTC \type{ru_transcript_en} \eTC\bTC English transcription for Russian \eTC\eTR
\bTR\bTC \type{iso9_ocs} \eTC\bTC == \type{all} plus non-ISO additions for Old (Church) Slavonic \eTC\eTR
+ \bTR\bTC \type{sr_tolt} \eTC\bTC Serbian, Cyrillic to Latin \eTC\eTR
+ \bTR\bTC \type{sr_tocy} \eTC\bTC Serbian, Latin to Cyrillic \eTC\eTR
\bTR\bTC \type{ocs} \eTC\bTC “scientific” transliteration for Old (Church) Slavonic\eTC\eTR
\bTR\bTC \type{ocs_gla} \eTC\bTC “scientific” transliteration for Old (Church) Slavonic / Glagolitic alphabet\eTC\eTR
\bTR\bTC \type{ru_cz} \eTC\bTC Czech transcription for Russian\eTC\eTR
@@ -710,9 +712,36 @@ different scripts; they are not, however, as easily reversible as ISO~9.
мечникъ, аще иꙁъгои будеть, любо словенинъ, то 40 гривенъ положити ꙁа нь.
}
+\subsection{Serbian}
+The tables for converting Serbian text between Cyrillic and Latin
+alphabets are \type{sr_tolt} and \type{sr_tocy}.
+\trlex{sr_tolt}{sr}{hr}{computer-modern-unicode}{%
+ Transliteration ћирилица \rightarrow\ латиница.%
+}{%
+ Српски језик је један од словенских језика из породице
+ индоевропских језика. Први писани споменици у српској редакцији
+ старословенског језика потичу из XI и XII века.
+
+ Српски језик је стандардни језик у службеној употреби у Србији,
+ Босни и Херцеговини и Црној Гори, а у употреби је и у другим
+ земљама где живе Срби, међу осталима и у Хрватској.%
+}
+
+\trlex{sr_tocy}{hr}{sr}{computer-modern-unicode}{%
+ Transliteration latinica \rightarrow\ ćirilica.%
+}{%
+ Srpski jezik je jedan od slovenskih jezika iz porodice
+ indoevropskih jezika. Prvi pisa- ni spomenici u srpskoj
+ redakciji starosloven- skog jezika potiču iz XI i XII veka.
+
+ Srpski jezik je standardni jezik u službenoj upotrebi u Srbiji,
+ Bosni i Hercegovini i Crnoj Gori, a u upotrebi je i u drugim
+ zemljama gde žive Srbi, među ostalima i u Hrvatskoj.%
+}
+
\subsection{Legacy national transcriptions}
-At the moment there are tables for old school transcription into three
+At the moment there are tables for “old school” transcription into three
languages: English (via \type{ru_transcript_en}), German
(\type{ru_transcript_de}) and Czech (\type{ocs_cz}).
At least the German one is almost unreadable if used with
diff --git a/tex/context/interface/third/t-transliterator.xml b/tex/context/interface/third/t-transliterator.xml
index b5b189f..f80c48e 100644
--- a/tex/context/interface/third/t-transliterator.xml
+++ b/tex/context/interface/third/t-transliterator.xml
@@ -17,6 +17,8 @@
<cd:constant type="ru_transcript_de_exp"/>
<cd:constant type="ru_transcript_en"/>
<cd:constant type="all"/>
+ <cd:constant type="sr_tolt"/>
+ <cd:constant type="sr_tocy"/>
<cd:constant type="iso9_ocs"/>
<cd:constant type="ocs"/>
<cd:constant type="ocs_gla"/>
@@ -28,6 +30,7 @@
<cd:parameter name="hyphenate">
<cd:constant type="cs" default="yes"/>
<cd:constant type="sk"/>
+ <cd:constant type="hr"/>
</cd:parameter>
</cd:assignments>
</cd:arguments>
diff --git a/tex/context/third/transliterator/trans_tables_sr.lua b/tex/context/third/transliterator/trans_tables_sr.lua
index 9abe5b2..84319b0 100644
--- a/tex/context/third/transliterator/trans_tables_sr.lua
+++ b/tex/context/third/transliterator/trans_tables_sr.lua
@@ -100,14 +100,16 @@ end
local t = translit
local function sr (mode, text)
- local P, R, S, V, Cs = lpeg.P, lpeg.R, lpeg.S, lpeg.V, lpeg.Cs
+ local P, R, Cs = lpeg.P, lpeg.R, lpeg.Cs
local utfchar = translit.utfchar
- local trl_sr = translit.make_add_dict{}
- trl_sr = t[mode.."_upper"] + t[mode.."_lower"]
+ local trl_sr = translit.make_add_dict{}
+ trl_sr = t[mode.."_upper"] + t[mode.."_lower"]
- local _p_sr = translit.addrules (trl_sr, _p_sr)
- local p_sr = Cs((_p_sr / trl_sr + utfchar)^0)
+ -- 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)
return p_sr:match(text)
end