summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--doc/context/third/transliterator/COPYING2
-rw-r--r--doc/context/third/transliterator/transliterator.tex41
-rw-r--r--scripts/context/lua/mtx-transliterate.lua2
-rw-r--r--tex/context/interface/third/t-transliterator.xml1
-rw-r--r--tex/context/third/transliterator/t-transliterator.mkiv22
-rw-r--r--tex/context/third/transliterator/trans_tables_bg.lua107
-rw-r--r--tex/context/third/transliterator/trans_tables_glag.lua2
-rw-r--r--tex/context/third/transliterator/trans_tables_gr.lua1
-rw-r--r--tex/context/third/transliterator/trans_tables_iso9.lua2
-rw-r--r--tex/context/third/transliterator/trans_tables_scntfc.lua1
-rw-r--r--tex/context/third/transliterator/trans_tables_sr.lua3
-rw-r--r--tex/context/third/transliterator/trans_tables_trsc.lua3
-rw-r--r--tex/context/third/transliterator/transliterator.lua10
13 files changed, 167 insertions, 30 deletions
diff --git a/doc/context/third/transliterator/COPYING b/doc/context/third/transliterator/COPYING
index 1ddfc42..80cc2f0 100644
--- a/doc/context/third/transliterator/COPYING
+++ b/doc/context/third/transliterator/COPYING
@@ -1,4 +1,4 @@
-Copyright 2010 Philipp Gesang. All rights reserved.
+Copyright 2010, 2011 Philipp Gesang. All rights reserved.
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are met:
diff --git a/doc/context/third/transliterator/transliterator.tex b/doc/context/third/transliterator/transliterator.tex
index 2f17dfa..07bd868 100644
--- a/doc/context/third/transliterator/transliterator.tex
+++ b/doc/context/third/transliterator/transliterator.tex
@@ -25,7 +25,7 @@
align=middle,
number=no,
style={\rm\setcharacterkerning[capitals]\WORD},
- before={\blank[line]},
+ before={\blank[line,force]},
after={\blank[line]}
]
@@ -33,7 +33,7 @@
align=middle,
number=no,
style={\tf\sc\word},
- before={\blank[line]},
+ before={\blank[line,force]},
after={\blank[line]}
]
@@ -283,9 +283,9 @@
\framed [frame=off,topframe=on] {%
\tfxx\ss\setupinterlinespace[small]
The {\em Transliterator} module and mini-manual,\par
-by Philipp Gesang, Dossenheim.\par
+by Philipp Gesang, Heidelberg.\par
Mail any patches or suggestions to\par
-pgesang -- AT -- ix -- DOT -- urz -- DOT -- uni-heidelberg -- DOT -- de\par
+gesang -- AT -- stud -- DOT -- uni-heidelberg -- DOT -- de\par
}
\stopstandardmakeup
@@ -329,20 +329,21 @@ By the time of this writing this can be one of the following set:
\bTR\bTH mode \eTH\bTH description \eTH\eTR
\eTABLEhead
\bTABLEbody
- \bTR\bTC \type{ru} \eTC\bTC ISO~9 Russian \eTC\eTR
- \bTR\bTC \type{ru_old} \eTC\bTC ISO~9 Russian plus pre-1918 chars (the default)\eTC\eTR
\bTR\bTC \type{all} \eTC\bTC ISO~9 complete \eTC\eTR
- \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{bg_de} \eTC\bTC Bulgarian, German „scientific“ transliteration\eTC\eTR
+ \bTR\bTC \type{gr} \eTC\bTC transliteration for Greek \eTC\eTR
+ \bTR\bTC \type{gr_n} \eTC\bTC transliteration for Greek obeying nasalizations \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_cz} \eTC\bTC Czech transcription 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} \eTC\bTC ISO~9 Russian \eTC\eTR
\bTR\bTC \type{ru_cz} \eTC\bTC Czech transcription for Russian\eTC\eTR
- \bTR\bTC \type{ocs_cz} \eTC\bTC Czech transcription for Old (Church) Slavonic\eTC\eTR
- \bTR\bTC \type{gr} \eTC\bTC transliteration for Greek \eTC\eTR
- \bTR\bTC \type{gr_n} \eTC\bTC transliteration for Greek obeying nasalizations \eTC\eTR
+ \bTR\bTC \type{ru_old} \eTC\bTC ISO~9 Russian plus pre-1918 chars (the default)\eTC\eTR
+ \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{sr_tocy} \eTC\bTC Serbian, Latin to Cyrillic \eTC\eTR
+ \bTR\bTC \type{sr_tolt} \eTC\bTC Serbian, Cyrillic to Latin \eTC\eTR
\eTABLEbody
\bTABLEfoot
\bTR\bTH mode \eTH\bTH description \eTH\eTR
@@ -431,11 +432,11 @@ The Transliterator module is meant to provide both: have the original in the
source and a transliteration only in the final document.
Another way of handling foreign languages is {\em transcription}.
-It is aims at producing some representation that does not rely on symbolisms
+It aims at producing some representation that does not rely on symbolisms
alien to the language and thus to be at least \quotation{pronouncable}
without further know\-ledge.
As transcription methods are language specific and highly idiosyncratic they
-complicate the restoration of the original phrase and information may be lost.
+complicate the restoration of the original phrase because information may be lost.
The Transliterator provides means of transcription as well but in most cases
you should refrain from using them (\type{[mode=ru_transcript_en]},
\type{[mode=ru_transcript_de]}).
@@ -468,6 +469,7 @@ the scholarly transliterations.
To amend the situation the Transliterator provides an extension to ISO~9 for
Old Slavonic containing the glyphs
\startluacode
+local translit = thirddata.translit
environment.loadluafile("trans_tables_scntfc")
local cnt, len = 0, 0
for i,j in pairs(translit.ocs_add_low) do
@@ -757,6 +759,15 @@ alphabets are \type{sr_tolt} and \type{sr_tocy}.
zemljama gde žive Srbi, među ostalima i u Hrvatskoj.%
}
+\subsection{Bulgarian}
+
+\trlex{bg_de}{bg}{cs}{computer-modern-unicode}{%
+ German scientific transliteration for Bulgarian (based on old ISO~9 standard).%
+}{%
+ Българският език е индоевропейски език от групата на
+ южнославянските езици. Той е официалният език на Република
+ България и един от 23-те официални езика на Европейския съюз.
+}
\subsection{Legacy national transcriptions}
At the moment there are tables for “old school” transcription into three
diff --git a/scripts/context/lua/mtx-transliterate.lua b/scripts/context/lua/mtx-transliterate.lua
index 3188256..a6e3968 100644
--- a/scripts/context/lua/mtx-transliterate.lua
+++ b/scripts/context/lua/mtx-transliterate.lua
@@ -11,6 +11,8 @@
environment.loadluafile("transliterator")
+local translit = thirddata.translit
+
translit.__script = true
scripts = scripts or { }
scripts.transliterate = { }
diff --git a/tex/context/interface/third/t-transliterator.xml b/tex/context/interface/third/t-transliterator.xml
index db62f09..f2ec522 100644
--- a/tex/context/interface/third/t-transliterator.xml
+++ b/tex/context/interface/third/t-transliterator.xml
@@ -19,6 +19,7 @@
<cd:constant type="all"/>
<cd:constant type="sr_tolt"/>
<cd:constant type="sr_tocy"/>
+ <cd:constant type="bg_de"/>
<cd:constant type="iso9_ocs"/>
<cd:constant type="ocs"/>
<cd:constant type="ocs_gla"/>
diff --git a/tex/context/third/transliterator/t-transliterator.mkiv b/tex/context/third/transliterator/t-transliterator.mkiv
index b6b841c..1f73c43 100644
--- a/tex/context/third/transliterator/t-transliterator.mkiv
+++ b/tex/context/third/transliterator/t-transliterator.mkiv
@@ -36,14 +36,14 @@
\def\set_serbian_exceptions{%
\doifelse{\transliterateparameter{sr_exceptions}}\v!yes
- {\ctxlua{translit.sr_except = true}}
- {\ctxlua{translit.sr_except = false}}%
+ {\ctxlua{thirddata.translit.sr_except = true}}
+ {\ctxlua{thirddata.translit.sr_except = false}}%
}
\def\set_hinting{%
\doifelse{\transliterateparameter{hinting}}\v!yes
- {\ctxlua{translit.hinting = true}}
- {\ctxlua{translit.hinting = false}}%
+ {\ctxlua{thirddata.translit.hinting = true}}
+ {\ctxlua{thirddata.translit.hinting = false}}%
}
\appendtoks \set_serbian_exceptions \to \everysetuptransliterate
@@ -93,9 +93,9 @@
environment.loadluafile ("trans_tables_trsc")
environment.loadluafile ("trans_tables_glag")
environment.loadluafile ("trans_tables_gr")
- translit.gen_rules_en()
- translit.gen_rules_de()
- translit.show_tab(translit["\luaescapestring{#1}"])
+ thirddata.translit.gen_rules_en()
+ thirddata.translit.gen_rules_de()
+ thirddata.translit.show_tab(translit["\luaescapestring{#1}"])
\stopluacode
}
@@ -103,12 +103,12 @@
%D \type{\showTranslitTabs}.
\define\showTranslitTabs{%
- \ctxlua{translit.show_all_tabs()}%
+ \ctxlua{thirddata.translit.show_all_tabs()}%
}
\def\translitDebug#1{%
\doif{\transliterateparameter{debug}}{yes}{%
- {\ss\inmargin{\ctxlua{translit.debug_next()}} #1}%
+ {\ss\inmargin{\ctxlua{thirddata.translit.debug_next()}} #1}%
}%
}
@@ -134,7 +134,7 @@
\setuptransliterate[#1]%
\fi
\language[\transliterateparameter{hyphenate}]%
- \ctxlua{translit.transliterate("\transliterateparameter{mode}","\luaescapestring{#2}")}%
+ \ctxlua{thirddata.translit.transliterate("\transliterateparameter{mode}","\luaescapestring{#2}")}%
\egroup%
}
@@ -152,7 +152,7 @@
\setuptransliterate[#1]%
\fi
\language[\transliterateparameter{hyphenate}]%
- \ctxlua{translit.transliterate("\transliterateparameter{mode}","\luaescapestring{#2}")}%
+ \ctxlua{thirddata.translit.transliterate("\transliterateparameter{mode}","\luaescapestring{#2}")}%
\egroup%
}
diff --git a/tex/context/third/transliterator/trans_tables_bg.lua b/tex/context/third/transliterator/trans_tables_bg.lua
new file mode 100644
index 0000000..c20e0c8
--- /dev/null
+++ b/tex/context/third/transliterator/trans_tables_bg.lua
@@ -0,0 +1,107 @@
+--===========================================================================--
+-- Bulgarian --
+--===========================================================================--
+
+local translit = thirddata.translit
+
+if not translit.done_bg then
+ ---------------------------------------------------------------------------
+ -- Uppercase Bulgarian -> „scientific“ transliteration --
+ ---------------------------------------------------------------------------
+
+ translit.bg_upp = translit.make_add_dict{
+ ["А"] = "A",
+ ["Б"] = "B",
+ ["В"] = "V",
+ ["Г"] = "G",
+ ["Д"] = "D",
+ ["Е"] = "E",
+ ["Ж"] = "Ž",
+ ["З"] = "Z",
+ ["И"] = "I",
+ ["Й"] = "J",
+ ["К"] = "K",
+ ["Л"] = "L",
+ ["М"] = "M",
+ ["Н"] = "N",
+ ["О"] = "O",
+ ["П"] = "P",
+ ["Р"] = "R",
+ ["С"] = "S",
+ ["Т"] = "T",
+ ["У"] = "U",
+ ["Ф"] = "F",
+ ["Х"] = "Ch",
+ ["Ц"] = "C",
+ ["Ч"] = "Č",
+ ["Ш"] = "Š",
+ ["Щ"] = "Št",
+ ["Ъ"] = "Ă",
+ ["Ь"] = "′",
+ ["Ю"] = "Ju",
+ ["Я"] = "Ja",
+ }
+ translit.tables["Bulgarian \\quotation{scientific} transliteration uppercase"] = translit.bg_upp
+
+ ---------------------------------------------------------------------------
+ -- Lowercase Bulgarian -> „scientific“ transliteration --
+ ---------------------------------------------------------------------------
+ translit.bg_low = translit.make_add_dict{
+ ["а"] = "a",
+ ["б"] = "b",
+ ["в"] = "v",
+ ["г"] = "g",
+ ["д"] = "d",
+ ["е"] = "e",
+ ["ж"] = "ž",
+ ["з"] = "z",
+ ["и"] = "i",
+ ["й"] = "j",
+ ["к"] = "k",
+ ["л"] = "l",
+ ["м"] = "m",
+ ["н"] = "n",
+ ["о"] = "o",
+ ["п"] = "p",
+ ["р"] = "r",
+ ["с"] = "s",
+ ["т"] = "t",
+ ["у"] = "u",
+ ["ф"] = "f",
+ ["х"] = "ch",
+ ["ц"] = "c",
+ ["ч"] = "č",
+ ["ш"] = "š",
+ ["щ"] = "št",
+ ["ъ"] = "ă",
+ ["ь"] = "′",
+ ["ю"] = "ju",
+ ["я"] = "ja",
+ }
+
+ translit.tables["Bulgarian \\quotation{scientific} transliteration lowercase"] = translit.bg_low
+
+ translit.done_bg = true
+end
+
+local P, Cs, lmatch = lpeg.P, lpeg.Cs, lpeg.match
+local addrules = translit.addrules
+local utfchar = translit.utfchar
+
+local memo = { }
+local function bulgarian (mode, text)
+ local bulgarian_parser
+ if memo[mode] then
+ return lmatch(memo[mode], text)
+ end
+ if mode == "de" then
+ local bg = translit.bg_upp + translit.bg_low
+ local p_bg = addrules(bg)
+ bulgarian_parser = Cs((p_bg / bg + utfchar)^0)
+ end
+ memo[mode] = bulgarian_parser
+ return bulgarian_parser and lmatch(bulgarian_parser, text) or ""
+end
+
+translit.methods["bg_de"] = function (text) return bulgarian("de", text) end
+
diff --git a/tex/context/third/transliterator/trans_tables_glag.lua b/tex/context/third/transliterator/trans_tables_glag.lua
index 0c6c0bf..41974fd 100644
--- a/tex/context/third/transliterator/trans_tables_glag.lua
+++ b/tex/context/third/transliterator/trans_tables_glag.lua
@@ -3,6 +3,8 @@
-- Glagolica --
--===========================================================================--
+local translit = thirddata.translit
+
-------------------------------------------
-- Lowercase Glagolitic Transliteration --
-------------------------------------------
diff --git a/tex/context/third/transliterator/trans_tables_gr.lua b/tex/context/third/transliterator/trans_tables_gr.lua
index 31637b8..55b4c54 100644
--- a/tex/context/third/transliterator/trans_tables_gr.lua
+++ b/tex/context/third/transliterator/trans_tables_gr.lua
@@ -2,6 +2,7 @@
-- Greek --
--===========================================================================--
+local translit = thirddata.translit
-- Note that the Greek transliteration mapping isn't bijective so transliterated
-- texts won't be reversible. (Shouldn't be impossible to make one up using
diff --git a/tex/context/third/transliterator/trans_tables_iso9.lua b/tex/context/third/transliterator/trans_tables_iso9.lua
index 9007b20..5f7c6d8 100644
--- a/tex/context/third/transliterator/trans_tables_iso9.lua
+++ b/tex/context/third/transliterator/trans_tables_iso9.lua
@@ -2,6 +2,8 @@
-- ISO 9.1995(E) standardized transliteration for cyrillic --
--===========================================================================--
+local translit = thirddata.translit
+
if not translit.done_iso9 then
-----------------------------------------
-- Lowercase russian cyrillic alphabet --
diff --git a/tex/context/third/transliterator/trans_tables_scntfc.lua b/tex/context/third/transliterator/trans_tables_scntfc.lua
index 9de4b96..904db71 100644
--- a/tex/context/third/transliterator/trans_tables_scntfc.lua
+++ b/tex/context/third/transliterator/trans_tables_scntfc.lua
@@ -2,6 +2,7 @@
-- Other transliterations --
--===========================================================================--
+local translit = thirddata.translit
-- The following are needed because ISO 9 does not cover old Slavonic
-- characters that became obsolete before the advent of гражданский шрифт.
diff --git a/tex/context/third/transliterator/trans_tables_sr.lua b/tex/context/third/transliterator/trans_tables_sr.lua
index 0371b75..2b1bdee 100644
--- a/tex/context/third/transliterator/trans_tables_sr.lua
+++ b/tex/context/third/transliterator/trans_tables_sr.lua
@@ -3,6 +3,9 @@
-- Serbian --
--===========================================================================--
+local translit = thirddata.translit
+
+
-- Special thanks to Mojca Miklavec and Arthur Reutenauer for their
-- assistance in creating these transliteration routines.
diff --git a/tex/context/third/transliterator/trans_tables_trsc.lua b/tex/context/third/transliterator/trans_tables_trsc.lua
index 355f735..e80048a 100644
--- a/tex/context/third/transliterator/trans_tables_trsc.lua
+++ b/tex/context/third/transliterator/trans_tables_trsc.lua
@@ -1,6 +1,9 @@
--===========================================================================--
-- Legacy national transliterations --
--===========================================================================--
+
+local translit = thirddata.translit
+
---------------------------------
-- German simple transcription --
---------------------------------
diff --git a/tex/context/third/transliterator/transliterator.lua b/tex/context/third/transliterator/transliterator.lua
index b64f888..c046ffb 100644
--- a/tex/context/third/transliterator/transliterator.lua
+++ b/tex/context/third/transliterator/transliterator.lua
@@ -9,9 +9,11 @@
--------------------------------------------------------------------------------
--
-translit = translit or {}
-translit.tables = translit.tables or {}
-translit.methods = translit.methods or {}
+thirddata = thirddata or { }
+thirddata.translit = thirddata.translit or { }
+local translit = thirddata.translit
+translit.tables = translit.tables or { }
+translit.methods = translit.methods or { }
--------------------------------------------------------------------------------
-- Predefining vowel lists
@@ -259,6 +261,8 @@ function translit.transliterate (method, text)
environment.loadluafile ("trans_tables_scntfc")
elseif method:match("^sr_") then
environment.loadluafile ("trans_tables_sr")
+ elseif method:match("^bg_") then -- only bg_de for now
+ environment.loadluafile ("trans_tables_bg")
elseif method == "gr" or
method == "gr_n" then
environment.loadluafile ("trans_tables_gr")