summaryrefslogtreecommitdiff
path: root/tex
diff options
context:
space:
mode:
Diffstat (limited to 'tex')
-rw-r--r--tex/context/third/transliterator/t-transliterator.mkiv50
1 files changed, 28 insertions, 22 deletions
diff --git a/tex/context/third/transliterator/t-transliterator.mkiv b/tex/context/third/transliterator/t-transliterator.mkiv
index 25c4231..7ba1f01 100644
--- a/tex/context/third/transliterator/t-transliterator.mkiv
+++ b/tex/context/third/transliterator/t-transliterator.mkiv
@@ -14,19 +14,26 @@
\writestatus{loading}{Transliteration from non-Latin scripts}
-\startmodule[transliterator]
+\unprotect
+
+\definenamespace [TRL] [
+ name=transliterate,
+ type=module,
+ setup=list,
+ parent=TRL,
+ style=no,
+ version=hg-r16,
+ comment=Transliteration from non-Latin scripts.,
+]
%\ctxlua{environment.loadluafile ("transliterator")}
\ctxlua{dofile ("transliterator.lua")}
-\unprotect
%D Use the Transliterator by adding \type{\usemodule[transliterator]} somewhere
%D before \type{\starttext}. Adjust the Transliterator through the
%D \type{\setuptransliterate} command. As a first argument it accepts a set of
%D key-value options; at present you may configure \type{mode} and
%D \type{hyphenate}.
-% emendation by Wolfgang Schuster
-\def\setuptransliterate{\dodoubleargument\getparameters[TRL]}
%D At first we'll set some defaults:
\setuptransliterate[mode=ru_old,hyphenate=cz,debug=false]
@@ -55,6 +62,7 @@
%D
%D The user-level command to output a single substitution table is
%D \type{\showOneTranslitTab{#1}}.
+
\define[1]\showOneTranslitTab{%
\startluacode
environment.loadluafile ("trans_tables_iso9")
@@ -65,19 +73,19 @@
environment.loadluafile ("trans_tables_gr")
translit.gen_rules_en()
translit.gen_rules_de()
- translit.show_tab("\luaescapestring{#1}")
+ translit.show_tab(translit["\luaescapestring{#1}"])
\stopluacode
}
%D The user-level command to output all defined tables is
%D \type{\showTranslitTabs}.
+
\define\showTranslitTabs{%
\ctxlua{translit.show_all_tabs()}%
}
\def\translitDebug#1{%
- \doif{\TRLdebug}{true}{%
- %\inmargin{\ctxlua{translit.debug_next()} #1}% Unreadable with too many debug messages.
+ \doif{\transliterateparameter{debug}}{yes}{%
{\ss\inmargin{\ctxlua{translit.debug_next()}} #1}%
}%
}
@@ -98,36 +106,34 @@
%D
% All credits for rewriting the TeX code go to Wolfgang as well.
% http://www.ntg.nl/pipermail/ntg-context/2010/047816.html
+
\def\dotransliterate[#1]#2{%
- \bgroup
- \iffirstargument
- \getparameters[TRL][#1]%
+ \bgroup\iffirstargument
+ \setuptransliterate[#1]%
\fi
- \language[\TRLhyphenate]%
- \ctxlua{translit.transliterate("\TRLmode","\luaescapestring{#2}")}%
- \egroup
+ \language[\transliterateparameter{hyphenate}]%
+ \ctxlua{translit.transliterate("\transliterateparameter{mode}","\luaescapestring{#2}")}%
+ \egroup%
}
\unexpanded\def\transliterate{\dosingleempty\dotransliterate}
\unexpanded\def\starttransliterate{%
\bgroup%
- \dosingleempty\dostarttransliterate
+ \dosingleempty\dostarttransliterate%
}
\let\stoptransliterate\relax
\def\dostarttransliterate[#1]#2\stoptransliterate{%
\iffirstargument
- \setuptransliterate[#1]%
-\fi
- \language[\TRLhyphenate]%
- \ctxlua{translit.transliterate("\TRLmode","\luaescapestring{#2}")}%
- \egroup
+ \setuptransliterate[#1]%
+ \fi
+ \language[\transliterateparameter{hyphenate}]%
+ \ctxlua{translit.transliterate("\transliterateparameter{mode}","\luaescapestring{#2}")}%
+ \egroup%
}
-\protect
-
-\endinput
+\protect \endinput
% vim:ft=context