Commits

Philipp Gesang committed 05db239

macros for conditional expansion (needed e.g. in (lazy) indices)

Comments (0)

Files changed (1)

tex/context/third/transliterator/t-transliterator.mkiv

 
 \unexpanded\def\transliterate{\dosingleempty\dotransliterate}
 
-\def\expandabletransliterate[#1]#2{%
+\def\expandabletransliterate#1{%
   %\bgroup
     %\setuptransliterate[#1]%
     %\language[\transliterateparameter{hyphenate}]%
     \ctxlua{
       thirddata.translit.deficient_font = "\transliterateparameter{deficient_font}"
-      thirddata.translit.transliterate("\transliterateparameter{mode}","#2")
+      thirddata.translit.transliterate("\transliterateparameter{mode}","#1")
     }%
   %\egroup%
 }
 
-
 \unexpanded\def\starttransliterate{%
   \bgroup%
   \dosingleempty\dostarttransliterate%
   \egroup%
 }
 
+\newconditional\transliterate_useexpanded \setfalse\transliterate_useexpanded
+
+\def\transliterate_conditional[#1]#2{%
+  \ifconditional\transliterate_useexpanded
+    \transliterate[#1]{#2}%
+  \else
+    \expandabletransliterate{#2}%
+  \fi%
+}
+
 \protect \endinput
 
 %   vim:ft=context